Why won't matlab use all logical cores?
51 次查看(过去 30 天)
显示 更早的评论
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 个评论
StefanoM64
2017-3-6
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
2022-4-16
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.
回答(2 个)
ck4e
2020-1-4
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 个评论
per isakson
2014-3-15
编辑:per isakson
2014-3-16
- 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 个评论
per isakson
2014-3-16
编辑:per isakson
2014-3-16
Which release of Matlab? What does the Parallel Toolbox license say about number of "local workers"?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!