MATLAB Answers

Matlab 2014a not using all logical cores

57 views (last 30 days)
Arran
Arran on 11 Jun 2014
Commented: Titus Edelhofer on 12 Jun 2014
When looking at the number of cores used the following is produced:
feature('numcores')
MATLAB detected: 32 physical cores.
MATLAB detected: 64 logical cores.
MATLAB was assigned: 64 logical cores by the OS.
MATLAB is using: 32 logical cores.
MATLAB is not using all logical cores because hyper-threading is enabled.
ans =
32')
I have set the NumWorkers value in the Cluster Profile Manager to 64 and parallel preferences are 64 also. Can someone explain why only 32 logical cores are being used instead of all 64?
To clarify, the 64 cores represent 32 physical cores that are hyperthreaded.
Thanks!

  0 Comments

Sign in to comment.

Answers (2)

Thomas Ibbotson
Thomas Ibbotson on 11 Jun 2014
See Edric's answer to another question about hyperthreading here: http://www.mathworks.com/matlabcentral/answers/80129#answer_89842

  2 Comments

Arran
Arran on 11 Jun 2014
Hmm, so I would not see any/little difference in computational benchmarks?
Is there a benchmark I could run that would show a difference between Matlab using hyperthreading and no hyperthreading?
Thomas Ibbotson
Thomas Ibbotson on 12 Jun 2014
As the performance is dependent on the problem, I would recommend measuring the performance of your code using 32 workers, and 64 workers to see if hyperthreading provides any benefit in your case.

Sign in to comment.


Titus Edelhofer
Titus Edelhofer on 11 Jun 2014
Hi,
to clarify: "only 32 logical cores are being used" means you see in the task manager only 50% usage instead of the expected 100%? Have you checked that indeed 64 workers are started (64 MATLAB tasks while doing your computations)?
Titus

  3 Comments

Arran
Arran on 11 Jun 2014
In task manager 100% is being used, and 64 workers are showing in the parallel pool, but the
MATLAB is using: 32 logical cores.
MATLAB is not using all logical cores because hyper-threading is enabled.
Seems to be contradicting that?
Is that logic correct? Or is Matlab actually using all 64 threads?
Thomas Ibbotson
Thomas Ibbotson on 12 Jun 2014
I think to answer your questions we need to be clear about how MATLAB is being multi-threaded. MATLAB even without PCT is multi-threaded for many of the core math functions, and by default it will only use the non-hyper-threaded cores, which is what that message is saying.
If you are using PCT workers however, each worker will use one core. So by starting 64 workers you are indeed using 64 cores. However, as we said before starting more workers than physical cores is unlikely to provide any benefit and may be detrimental to performance.
Titus Edelhofer
Titus Edelhofer on 12 Jun 2014
Hi Arran,
if you are interested in measuring the performance you might play around with using the function maxNumCompThreads. As Thomas wrote, you need to distinguish between explicitly parallelizing (using the Parallel Computing Toolbox with N workers) or implicit parallelization due to multithreading. Here the default MATLAB uses (which in most cases give the best results, there are of course as always exceptions) number of threads = number of physical cores.
Titus

Sign in to comment.

Sign in to answer this question.