目次
Table of Contents |
---|
...
ラボラトリでは並列処理を行うクラスター環境である MATLAB Parallel Serverが利用できます。同サーバは NVIDIA Testa T4 を備え、通常の並列処理だけでなく、GPUによるスケールアウトも可能です。
Info |
---|
MATLAB R2022aのみの提供です。R2022aのみの提供です。クライアント側もR2022aをご利用ください。 |
準備1-MATLAB R2022aのダウンロード
MathWorksアカウント画面へ
MATLAB(Individual)の右の下矢印を押してダウンロード画面へ
※この際に画面左のリリースを選択からR2022aを選択します。{Windows, Mac, Linux}用ダウンロードを押してMATLAB R2022aのダウンロードを開始します。
...
[既定に設定] を選択して、プロファイルをデフォルトにします。
...
5. クラスタープロファイルの検証
クラスタープロファイルの検証をクリックします。ラボラトリのパスワードを聞かれるため、入力します。
...
プロパティの隣の検証のタブに移動し、クラスタープロファイルの「検証(V)」をクリックします。
...
ラボラトリのパスワードを入力します。
...
クラスターの検証が成功すると、以下のように全ての段階のステータスが”パス”になります。
...
localとa9 Serverの切り替えは、それぞれのクラスタープロファイルについて既定の設定を切り替えて行います。
...
7. 並列処理ありとなしの切り替え
並列処理ありとなしの切り替えは、コマンドにおける'UseParallel',trueを'UseParallel',falseに書き換える。
並列処理あり
Code Block |
---|
tic % Start stopwatch timer
% Input image
input_img = "input_img.jpg"; % Add image path
% Initialize Edge detection function
fun = @(block_struct) edge(block_struct.data,"canny");
% Covert source image from RGB to GRAY
input_image= rgb2gray(imread(input_img));
% Perform Parallel Block Process
result = blockproc(input_image,[25 25],fun, ...
'UseParallel',true);
toc % Terminate stopwatch timer
% Show ouput image
imshow(result) |
並列処理なし
...
並列処理の例
例1:大きな画像に対するブロック処理
input_img.pngをC:\Users\ユーザー名\Documents\MATLABに保存する。MATLABに保存します。
保存したファイルが画像左の現在のフォルダーに表示されていれば成功。保存したファイルが下記画像左の「現在のフォルダー」に表示されていることを確認してください。
...
並列処理ありの場合
Code Block tic % Start stopwatch timer % Input image input_img = "input_img.jpg"; % Add image path % Initialize Edge detection function fun = @(block_struct) edge(block_struct.data,"canny"); % Covert source image from RGB to GRAY input_image= rgb2gray(imread(input_img)); % Perform Parallel Block Process result = blockproc(input_image,[25 25],fun, ... 'UseParallel',true); toc % Terminate stopwatch timer % Show ouput image imshow(result)
並列処理なしの場合
Code Block tic % Start stopwatch timer % Input image input_img = "input_img.jpg"; % Add image path % Initialize Edge detection function fun = @(block_struct) edge(block_struct.data,"canny"); % Covert source image from RGB to GRAY input_image= rgb2gray(imread(input_img)); % Perform Parallel Block Process result = blockproc(input_image,[25 25],fun, ... 'UseParallel',false); toc % Terminate stopwatch timer % Show ouput image imshow(result)
処理時間の比較(単位:秒)
...