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

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

 채택된 답변

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

Hi Pratyush,
Thanks yes you are right. i later figured it out and did it exactly this way and it worked. Cheers.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

제품

릴리스

R2024b

질문:

2025년 1월 19일

댓글:

2025년 1월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by