mersenneforum.org Not nice enough
 Register FAQ Search Today's Posts Mark Forums Read

 2020-11-02, 09:59 #1 phma   Sep 2020 22·3 Posts Not nice enough Code:  4427 phma 30 10 1091452 424224 4984 S 430.9 1.3 93463:58 mprime 28163 phma 20 0 3588756 1.8g 80440 R 412.6 5.7 206:19.02 perfecttin-gui I'm running Linux 5.3.0 on a 6-core 12-thread AMD box. Mprime is running six worker threads, all working on the same Mersenne number. PerfectTIN is a program I wrote for work. It has twelve worker threads, all building the same TIN out of the same point cloud. When I'm running PerfectTIN, I'd like it to take nearly all of the CPU. I've seen it take 80 to 98% of the CPU without mprime running. (It has a lock contention bottleneck, so when it's adding triangles as fast as possible, the CPU usage goes down a bit.) How can I make mprime take less CPU when other high-CPU programs are running?
 2020-11-02, 10:36 #2 M344587487     "Composite as Heck" Oct 2017 761 Posts nice works with values from -20 to 19, you could try running mprime with niceness of 19 and PerfectTIN with niceness -20.
2020-11-02, 10:44   #3
retina
Undefined

"The unspeakable one"
Jun 2006
My evil lair

35·52 Posts

Quote:
 Originally Posted by phma How can I make mprime take less CPU when other high-CPU programs are running?

The problem you see isn't with nice values, but the OS scheduler. Windows will do a better job of scheduling within the priorities given, but I wouldn't recommend changing to that.

2020-11-02, 11:36   #4
Ensigm

Aug 2020

11410 Posts

Quote:
 Originally Posted by phma When I'm running PerfectTIN, I'd like it to take nearly all of the CPU.
PauseWhileRunning is probably what you will need. Alternatively, you can set MaxLoad=A and MinLoad=B so that mprime will suspend a worker whenever the system load gets above A and resume a worker when it goes below B. You can start out with something like MaxLoad=8 and MinLoad=6 and try different combinations to see what works best. Nice value is not of much significance here.

Last fiddled with by Ensigm on 2020-11-02 at 11:43

 2020-11-02, 11:39 #5 Ensigm   Aug 2020 11100102 Posts For more detailed information, check undoc.txt.
2020-11-02, 15:15   #6
Mark Rose

"/X\(‘-‘)/X\"
Jan 2013

292910 Posts

Quote:
 Originally Posted by M344587487 nice works with values from -20 to 19, you could try running mprime with niceness of 19 and PerfectTIN with niceness -20.
That's a great way to lock up your machine. Anything that saturates the CPU should never be given a priority higher than 0.

2020-11-02, 15:45   #7
Mark Rose

"/X\(‘-‘)/X\"
Jan 2013

29·101 Posts

Quote:
 Originally Posted by phma Code:  4427 phma 30 10 1091452 424224 4984 S 430.9 1.3 93463:58 mprime 28163 phma 20 0 3588756 1.8g 80440 R 412.6 5.7 206:19.02 perfecttin-gui I'm running Linux 5.3.0 on a 6-core 12-thread AMD box. Mprime is running six worker threads, all working on the same Mersenne number. PerfectTIN is a program I wrote for work. It has twelve worker threads, all building the same TIN out of the same point cloud. When I'm running PerfectTIN, I'd like it to take nearly all of the CPU. I've seen it take 80 to 98% of the CPU without mprime running. (It has a lock contention bottleneck, so when it's adding triangles as fast as possible, the CPU usage goes down a bit.) How can I make mprime take less CPU when other high-CPU programs are running?
Unfortunately mprime doesn't set the scheduling priority to SCHED_IDLE on Linux. You can do that manually by running chrt -i -p 0 ### where ### is mprime's process id.

There was some recent work by Facebook on fixing sched-idle in the CFS scheduler, but I don't know if it's made it into mainline kernels. You might have better performance using a different scheduler like MuQSS or BFS, but that's really only something you should get into if you're comfortable changing kernels and so on.

2020-11-02, 16:42   #8
M344587487

"Composite as Heck"
Oct 2017

761 Posts

Quote:
 Originally Posted by Mark Rose That's a great way to lock up your machine. Anything that saturates the CPU should never be given a priority higher than 0.
That's interesting, can't remember any setting having too much of an impact but I guess I didn't play around with it enough.

 2020-11-02, 16:57 #9 Xyzzy     "Mike" Aug 2002 79·101 Posts With the weird way that a negative nice value is "positive" it is real easy to accidentally give a process the wrong value. As for the computer becoming unresponsive? Yep!
2020-11-03, 02:40   #10
Mark Rose

"/X\(‘-‘)/X\"
Jan 2013

1011011100012 Posts

Quote:
 Originally Posted by Xyzzy With the weird way that a negative nice value is "positive" it is real easy to accidentally give a process the wrong value. As for the computer becoming unresponsive? Yep!
Yeah, remember negative numbers are less nice than normal, not more nice. The semantic is backwards.

2020-11-03, 02:59   #11
phma

Sep 2020

22×3 Posts

Quote:
 Originally Posted by Mark Rose Unfortunately mprime doesn't set the scheduling priority to SCHED_IDLE on Linux. You can do that manually by running chrt -i -p 0 ### where ### is mprime's process id.
I tried that; it doesn't seem to make a difference.
Quote:
That would keep mprime stopped as long as PerfectTIN was running, even after it had finished processing.
Quote:
 The problem you see isn't with nice values, but the OS scheduler. Windows will do a better job of scheduling within the priorities given, but I wouldn't recommend changing to that.
I'm running Linux. What Windows would do is irrelevant. So is BSD (and the top output would look different).

 Similar Threads Thread Thread Starter Forum Replies Last Post kar_bon Prime Wiki 1 2019-02-26 09:57 schickel FactorDB 29 2012-07-18 17:03 Dubslow Forum Feedback 0 2012-05-02 02:13 fivemack Factoring 84 2011-04-26 10:22 Xyzzy Lounge 4 2003-06-28 13:37

All times are UTC. The time now is 14:35.

Thu Feb 25 14:35:10 UTC 2021 up 84 days, 10:46, 0 users, load averages: 4.74, 4.27, 4.04