Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. MATLAB のホームタブで、並列メニューを選択します。[クラスタの作成と管理]を選択します。

  2. クラスタプロファイルの追加 > MATLAB Job Scheduler をクリックします。

  3. プロファイル名をダブルクリックして、MATLAB Job Scheduler プロファイルの名前を変更します。
    今回はMJSProfile1

  4. プロファイルを選択し、ツールバーの[編集]をクリックして編集します。

  5. [完了]をクリックします。二枚目の画像は、設定後のMATLAB Job Schedulerクラスタ・プロファイルを示します。

  6. Image Removed

    [規定に設定] を選択して、このプロファイルをデフォルトにします。

  7. クラスタープロファイルの検証をクリックします。その後、ユーザー名とパスワードが聞かれます。
    クラスタの検証が成功すると、以下のようになります。

...

  1. 並列処理ありの場合

    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)
  2. Image Modified

    並列処理なしの場合

    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

計算時間の比較(単位:秒)

並列処理なし

並列処理あり

windows

(Local)

windows

(Local)

8 workers

CentOS

(a9 Server)

12 workers

11.97

3.30

2.79

...

  1. 並列処理ありの場合

    Code Block
    Mu = bsxfun(@times,ones(20,300),(1:20)'); % Gaussian mixture mean
    rn300 = randn(300,300);
    Sigma = rn300'*rn300; % Symmetric and positive-definite covariance
    Mdl = gmdistribution(Mu,Sigma); % Define the Gaussian mixture distribution
    
    rng(1); % For reproducibility
    X = random(Mdl,10000);
    % Specify the options for parallel computing.
    stream = RandStream('mlfg6331_64');  % Random number stream
    options = statset('UseParallel',1,'UseSubstreams',1,...
        'Streams',stream);
    % Cluster the data using k-means clustering. Specify that there are k = 200 clusters in the data and increase the number of iterations. Typically, the objective function contains local minima. Specify 10 replicates to help find a lower, local minimum.
    
    tic; % Start stopwatch timer
    [idx,C,sumd,D] = kmeans(X,200,'Options',options,'MaxIter',10000,...
        'Display','final','Replicates',10);
    toc % Terminate stopwatch timer
  2. 並列処理なしの場合

    Code Block
    Mu = bsxfun(@times,ones(20,300),(1:20)'); % Gaussian mixture mean
    rn300 = randn(300,300);
    Sigma = rn300'*rn300; % Symmetric and positive-definite covariance
    Mdl = gmdistribution(Mu,Sigma); % Define the Gaussian mixture distribution
    
    rng(1); % For reproducibility
    X = random(Mdl,10000);
    % Specify the options for parallel computing.
    stream = RandStream('mlfg6331_64');  % Random number stream
    options = statset('UseParallel',false,'UseSubstreams',1,...
        'Streams',stream);
    % Cluster the data using k-means clustering. Specify that there are k = 200 clusters in the data and increase the number of iterations. Typically, the objective function contains local minima. Specify 10 replicates to help find a lower, local minimum.
    
    tic; % Start stopwatch timer
    [idx,C,sumd,D] = kmeans(X,200,'Options',options,'MaxIter',10000,...
        'Display','final','Replicates',10);
    toc % Terminate stopwatch timer

...

  • 並列処理あり

    • コマンドにおいて'UseParallel',true

    • 処理中の際に左下のアイコンが緑色になる。

      Image Modified
  • 並列処理なし

    • コマンドにおいて'UseParallel',false

    • 処理中の際に左下のアイコンが青色になる。

...