mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2020-11-02, 09:59   #1
phma
 
Sep 2020

11002 Posts
Default 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?
phma is offline   Reply With Quote
Old 2020-11-02, 10:36   #2
M344587487
 
M344587487's Avatar
 
"Composite as Heck"
Oct 2017

3×5×53 Posts
Default

nice works with values from -20 to 19, you could try running mprime with niceness of 19 and PerfectTIN with niceness -20.
M344587487 is offline   Reply With Quote
Old 2020-11-02, 10:44   #3
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

22·5·307 Posts
Default

Quote:
Originally Posted by phma View Post
How can I make mprime take less CPU when other high-CPU programs are running?
Add PauseWhileRunning to your config.

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.
retina is offline   Reply With Quote
Old 2020-11-02, 11:36   #4
Ensigm
 
Aug 2020

2·3·19 Posts
Default

Quote:
Originally Posted by phma View Post
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
Ensigm is offline   Reply With Quote
Old 2020-11-02, 11:39   #5
Ensigm
 
Aug 2020

2·3·19 Posts
Default

For more detailed information, check undoc.txt.
Ensigm is offline   Reply With Quote
Old 2020-11-02, 15:15   #6
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013

3·977 Posts
Default

Quote:
Originally Posted by M344587487 View Post
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.
Mark Rose is offline   Reply With Quote
Old 2020-11-02, 15:45   #7
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013

3×977 Posts
Default

Quote:
Originally Posted by phma View Post
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.
Mark Rose is offline   Reply With Quote
Old 2020-11-02, 16:42   #8
M344587487
 
M344587487's Avatar
 
"Composite as Heck"
Oct 2017

3×5×53 Posts
Default

Quote:
Originally Posted by Mark Rose View Post
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.
M344587487 is offline   Reply With Quote
Old 2020-11-02, 16:57   #9
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

11111111000112 Posts
Default

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!

Xyzzy is offline   Reply With Quote
Old 2020-11-03, 02:40   #10
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013

3·977 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
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.
Mark Rose is offline   Reply With Quote
Old 2020-11-03, 02:59   #11
phma
 
Sep 2020

C16 Posts
Default

Quote:
Originally Posted by Mark Rose View Post
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:
Originally Posted by retina View Post
Add PauseWhileRunning to your config.
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).
phma is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nice-to-have's kar_bon Prime Wiki 1 2019-02-26 09:57
Nice progress! schickel FactorDB 29 2012-07-18 17:03
Nice pic Dubslow Forum Feedback 0 2012-05-02 02:13
Let's do another nice big GNFS job! fivemack Factoring 84 2011-04-26 10:22
Nice link... Xyzzy Lounge 4 2003-06-28 13:37

All times are UTC. The time now is 06:53.

Tue May 11 06:53:39 UTC 2021 up 33 days, 1:34, 1 user, load averages: 1.55, 1.92, 2.06

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.