How to parallel 4 works with PARFOR with a Core i3 in Matlab

后端 未结 2 599
有刺的猬
有刺的猬 2021-02-09 09:47

I have Matlab R2012b for Ubuntu 64 bits. I have a Intel Core i3 CPU M 330 @ 2.13GHz × 4.

I want to use parfor to parallelize 4 loops at same time. Becau

相关标签:
2条回答
  • 2021-02-09 10:24

    To programmatically change the value of NumWorkers from 2 to 4 of the local cluster profile, you can use:

    myCluster = parcluster('local');
    myCluster.NumWorkers = 4;  % 'Modified' property now TRUE
    saveProfile(myCluster);    % 'local' profile now updated,
                               % 'Modified' property now FALSE    
    
    0 讨论(0)
  • 2021-02-09 10:27

    To increase the default NumWorkers, open the Cluster Profile Manager (Parallel->Manage Cluster Profiles). Pick the localprofile, click edit, and increase NumWorkers to the maximum possible value (in your case 4). Now it is possible to create a matlabpool with more workers than physical cores on your machine.

    However, note that using more workers than cores might lead to decreased performance as compared to having the same number of workers as cores.

    0 讨论(0)
提交回复
热议问题