Why won't matlab use all logical cores?
43 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am running a highly vectorized code and have noticed that matlab will not use all of my logical cores. Many vector operations are computed on arrays which are on the order of 10^5-10^6 elements. I am running on an 6 physical, 12 logical core i7 4960x. I am using version 2013b.
When I run my code, windows CPU usage statistics indicate that only a maximum of 50% of CPU power is being used. It seems it is only using 6 cores even when forced to recognize 12. I have tried to set maxNumCompThreads=12 to force more core usage, but nothing changes.
It is trivial to show that this is not a fluke of hyperthreading inefficiency or anything of that sort. I can open up the same code in an additional matlab executable and the decrease in run speed is only 10% but with two codes running simultaneously, obviously demonstrating that the extra logical cores are simply not being used. Simultaneously, when hyperthreading is turned off, the increase in speed is a puny 10%. Thus hypertherthreading is a huge boost in my code. Moreover, my core temperatures are about 40C when one code is running, and 75C when two are. Obviously there is unused power here.
Regardless of the details, matlab is clearly failing to saturate 12 cores and thus my code is only running about 60% of the speed it would run at if all cores were used.
Is there a solution to this problem?
3 commentaires
StefanoM64
le 6 Mar 2017
Finally, a smart observation about hyper-threading and Matlab. I think it's correct, the various managers give a misleading information about CPUs load ...
Mehmet Selim Akay
le 16 Avr 2022
Dear Christopher, have you found a solution? In the previous years' Matlab versions I used to set the threads in the parallel preferences and it was working perfectly, but now it defaults to physical core count.
Réponses (2)
ck4e
le 4 Jan 2020
I just ran into this and found a solution. You can set the number of worker threads (and so the number of "cores" used) using maxNumCompThreads.
0 commentaires
per isakson
le 15 Mar 2014
Modifié(e) : per isakson
le 16 Mar 2014
- Matlab is single threaded. However, some functions use more than one core.
- Solution: Parallel Toolbox allows you to use "all" cores. (The Parallel Toolbox license sets an upper limit for the number of cores that may be used. The limit depend on the Matlab release.)
3 commentaires
per isakson
le 16 Mar 2014
Modifié(e) : per isakson
le 16 Mar 2014
Which release of Matlab? What does the Parallel Toolbox license say about number of "local workers"?
Voir également
Catégories
En savoir plus sur MATLAB Coder dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!