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
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!