Cpu usage in parrallel running mode
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ARMIN M
am 10 Aug. 2019
Kommentiert: ARMIN M
am 19 Aug. 2019
Hi. I have code that running in parrallel mode. I have 4 worker(my cpu has 2 core) but when i run it, it shows that cpu fluctuate from 2 to 24 % but physical memory is in 96%(2×30% , 1×20,2×10%) ,anybody knows why cpu does not show more usage ;like 90%?thank you.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 17 Aug. 2019
Bearbeitet: Walter Roberson
am 17 Aug. 2019
Have a look at the attached modified version of your code and see if it does what you want. I am not confident that my changes match your intention.
I did some optimizations in the first parfor, but not in the second one (no point doing that until we know that the first part is acceptable.)
... Be careful you do not remove your own good copy of the file before you are sure that my revised version is right!
12 Kommentare
Walter Roberson
am 18 Aug. 2019
I corrected a minor typing mistake -- I think I had accidentally written "id" in one place where I meant "it".
Using parpool(2) is better since parpool(4) does not improve your performance.
Weitere Antworten (1)
Nicolas B.
am 12 Aug. 2019
Hello Armin,
It is already strange that you have 4 workers for a 2 physical cores CPU. Normally, Matlab runs 1 worker per hardware core. So hyperthreading has no impact on the number of workers.
Looking at your use of RAM (96%), I guess that your PC has to use the swap memory which is running on your harddrive and is much more slower. Therefore, if the access to the memory is slow, your CPU will not be used at 100% (bottleneck principle).
If you want to reach the 100% use of your CPU, I may recommand you to add some RAM on your PC. Otherwise, try to reduce the number of workers.
7 Kommentare
Walter Roberson
am 17 Aug. 2019
Near line 256 you calculate
det_A=sum(H,2)
This is the last place you use H, so if the value of this det_A is not used then you have no reason to calculate H.
Then you do
F(1,iiii)=a4*det(A_4);
which does not use det_A . You do not use det_A anywhere inside that loop.
You
After the loop, you do some more calculations to build the rest of F, and assign into det_A based on F -- the previous det_A going unused.
Siehe auch
Kategorien
Mehr zu Parallel Computing Fundamentals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!