MATLAB: Using parfor on cluster, changing number of cores per worker

Parallel Computing Toolbox

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

Best Answer

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.