Using parfor on cluster, changing number of cores per worker

13 vues (au cours des 30 derniers jours)
James Barnes
James Barnes le 16 Avr 2018
Commenté : Rony Reuveni le 1 Juil 2019
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

Edric Ellis
Edric Ellis le 17 Avr 2018

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
James Barnes
James Barnes le 18 Avr 2018
Thank you, very helpful!
Rony Reuveni
Rony Reuveni le 1 Juil 2019
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)

Community Treasure Hunt

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

Start Hunting!

Translated by