Matlab parpool gives me 4 workers on Azure VM instead of 8 workers

3 次查看(过去 30 天)
I just deployed Matlab 2024b on Azure VM, with 8gb vCPU, 32gb RAM. However when i start the parpool with
% Start a parallel pool
parpool('local' );
parfor linearIdx = 1:totalCombinations
...
end
it runs with 4 workers whereas i would expect 8 workers since i have 8 vCPUS.
also parcluster('local') gives me
Local Cluster
Properties:
Profile: Processes
Modified: false
Host: matlabvm
NumWorkers: 4
NumThreads: 1
JobStorageLocation: /home/ubuntu/.matlab/local_cluster_jobs/R2024b
RequiresOnlineLicensing: false
PreferredPoolNumWorkers: Inf
Associated Jobs:
Number Pending: 0
Number Queued: 0
Number Running: 1
Number Finished: 0
Please note my Matlab 2024b licence is a Trial version. Could this be the case? Thanks

采纳的回答

Pratyush Swain
Pratyush Swain 2025-1-20
Hi Farouk,
By default Parallel Computing Toolbox will attempt to use a number of workers equal to the number physical cores of the computer. In a cloud environment, a vCPU typically represents a portion of a physical CPU core.
To programmatically alter the maximum number of workers allowed by the 'Processes' or 'local' profile, use:
c = parcluster('Processes')
c.NumWorkers = 8;
saveProfile(c) % will overwrite the profile with the new NumWorkers value
Please also refer to http://www.mathworks.com/matlabcentral/answers/2042101-how-can-i-increase-the-number-of-matlab-workers-inside-parallel-computing-toolbox-to-use-all-the-log for information on why the number of cores detected might not be all of the cores on your machine.
Hope this helps.
  1 个评论
Farouk
Farouk 2025-1-20
Hi Pratyush,
Thanks yes you are right. i later figured it out and did it exactly this way and it worked. Cheers.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by