Parfor is running much slower on a 18-core PC than a 10-core PC
6 views (last 30 days)
Show older comments
I am currently running a compute-intensive financial trading test; the test has 503 independent loops. I have two PCs in my office, one has 10-core Intel i9-10900k @ 3.7GHz with 128GB DDR4; the other one has 18-core Intel i9-7980XE @ 3.4GHz with 128GB DDR4 as well.
In order to speed up the whole processing, the first 10-core PC runs loop 1-to-189 in parfor; the second 18-core PC runs loop 190-to-503 in parfor.
After one-day running, I found the 10-core PC finished 25 loops, the 18-core PC only finished 4 loops. I found very curious, can anyone know the reason of this problem?
P.S. 10-core PC running MATLAB 2020b with latest updates with MOSEK 9.2.35
18-core PC running MATLAB 2021a with latest updates with MOSEK 9.2.36
I also checked the taskmgr.exe, unlike the 10-core PC, I found in 18-core PC, 10 matlab tasks are in one group, the other 10 tasks are seperated....
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/721784/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/721789/image.jpeg)
6 Comments
Walter Roberson
on 28 Aug 2021
parfor has communications overheads, and if you give each node too little to do, then you can end up spending more time communicating than you get back from splitting the work. So it is possible for progress to get slower as you add more workers. It would be interesting to restrict both machines to (say) four cores and see what their performance is.
The studies I looked at a number of years ago suggested that 4 to 6 cores was the "sweet spot" for a variety of tasks -- at least with the hardware of those days. There are tasks for which the communications might be comparatively small and so net performance can improve as you add cores, even into the tens of thousands, but most code has to be specially written for that kind of situation.
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!