Using parfor on cluster, changing number of cores per worker

I am using parfor on a computing cluster that has 128 workers.
If I use parfor will it utilize multiple cores per worker automatically?
What command can I use to ensure that multiple cores per worker are used?
Currently I am using the following code, but have not made any settings changes.
c = parcluster;
Job = c.batch(@RunParallelForLoop, 2, {}, 'Pool', 127)
to utilize 127 workers to run this function.
Is there any way I can set the number of cores per worker?
Thank you in advance.
JB

 Réponse acceptée

You can set the NumThreads property of your cluster object. For example:

c = parcluster
c.NumThreads = 2;
j = batch(c, @eval, 0, {'spmd, maxNumCompThreads, end'}, 'Pool', 3);
wait(j), diary(j)

demonstrates that each worker in this case is using 2 computational threads.

2 commentaires

Thank you, very helpful!
Hi
I read this topic and found that I get an error with:
c.NumThreads = 2
No public property NumThreads exists for class parallel.cluster.Local.
I am using MATLAB 2016a.
Am I doing something wrong?
Thanks,

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by