Why won't matlab use all logical cores?
47 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
StefanoM64
am 6 Mär. 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
am 16 Apr. 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.
Antworten (2)
ck4e
am 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 Kommentare
per isakson
am 15 Mär. 2014
Bearbeitet: per isakson
am 16 Mär. 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 Kommentare
per isakson
am 16 Mär. 2014
Bearbeitet: per isakson
am 16 Mär. 2014
Which release of Matlab? What does the Parallel Toolbox license say about number of "local workers"?
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!