Matlab parpool gives me 4 workers on Azure VM instead of 8 workers
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Farouk
el 19 de En. de 2025
Comentada: Farouk
el 20 de En. de 2025
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 comentarios
Respuesta aceptada
Pratyush Swain
el 20 de En. de 2025
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!