MATLAB2020b Parallel Computing Number of Workers
40 次查看(过去 30 天)
显示 更早的评论
Hi,
My CPU is Ryzen 3600x 6 Core / 12 Threads, Win10 1909
I used to be able to use 12 workers with 2020a.
All 12 logical processor (i.e. threads) in task manager can acheieve nearlly 100% usage
maxNumCompThreads returns 12.
Now I installed 2020b
maxNumCompThreads returns 6. and same code only run with 6 workders.
The task manager has oddly 7 logical processor at nearly 100% usage and the rest 5 sits at near idle (15% ish).
I don't remember exactally the time of the previous run with 2020a (and I already uninstalled it), but seems to be faster than 2020b.
Could anyone have any suggestion? maybe ways to force 12 threads as a comparasion?
Thanks!
6 个评论
Walter Roberson
2020-10-19
With elapsed time that low, you are spending most of your time setting up the workers and communicating data back and forth.
回答(1 个)
Walter Roberson
2020-10-17
Hyperthreading does not provide additional computation capacity.
What hyperthreading is, is some extra state registers that permit fast switching of process context, instead of the operating system having to specifically go in and save state and load the old state. It makes better use of resources, keeping the CPUs more evenly loaded, less time switching tasks.
However, hyperthreading is not pre-emptive and not scheduled. As far as the technology itself is concerned, hyperthreading is ready to go when a thread voluntarily gives up control of a core, such as if the thread needs to wait for a resource to become available (read from disk), or wait for user interaction.
In the case of heavy mathematical calculations, MATLAB is not voluntarily giving up the core -- so hyperthreading kicks in during the phase where MATLAB is transfering data into a worker thread, and during the phase where MATLAB is transfering results out of the worker thread... and nothing in-between.
Meanwhile, the heat budget of CPUs is based in part around the assumption that cores will be given up to wait for events, giving a bit of time for the cores to cool. When hyperthreading is in effect and there are active threads waiting, then those pauses with cooling do not occur (as much), so the cores do not cool as much. In order to account for that, cores will down-clock when they are using hyperthreading actively.
Putting this all together: using hyperthreading for active mathematical calculation can slow the calculations down instead of speeding them up.
But anyhow... You can control the maximum number of threads by editing your cluster profile. The default maximum is the number of cores, so you would have had to have changed it before, and possibly when you installed R2020b that cluster profile did not get copied from your R2020a directories.
2 个评论
Walter Roberson
2020-10-18
编辑:Walter Roberson
2020-10-19
edit the cluster profile
You did not include performance measurements in your reply to Raymond.
Your original post about 7 logical cores does not show that the physical cores are being underused. You would need to time with both cases, one worker per physical core and one worker per logical core.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!