Is there a way to start a parellel pool with maximum available workers as the cores on the machine?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Is there a way to start a parellel pool with maximum available workers as the cores on the machine?
I am using a compiled code which then is being run on a cluster, each cluster node can have a different number of available cores. Is there a way to start parpool with the maximum possible amount of workers? If I start pool = parpool('local'); I only get 12 workers even though on the node, where such code is run, I have 32 cores allocated.
2 comentarios
KSSV
el 24 de Ag. de 2021
Check the parallel preferences, there you can increase the number of workers.
Respuestas (1)
Raymond Norris
el 24 de Ag. de 2021
pool = parpool('local',maxNumCompThreads);
Alternatively, if you're running this through a scheduler (e.g. PBS), you could query the scheduler first.
% Query for available cores (assume either Slurm or PBS)
sz = str2num([getenv('SLURM_CPUS_PER_TASK') getenv('PBS_NP')]); %#ok<ST2NM>
if isempty(sz)
% Not running through a scheduler, get default size
sz = maxNumCompThreads; end
pool = parpool('local',sz);
0 comentarios
Ver también
Categorías
Más información sobre Parallel Computing Fundamentals 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!