mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   User activity feature request (https://www.mersenneforum.org/showthread.php?t=21265)

bgbeuning 2016-05-03 13:26

User activity feature request
 
Sometimes when my machine feels slow, I am tempted to turn off prime95 until
I am done using my machine. But then when I am done, I always forget to turn
prime95 back on.

There is a Windows API GetLastInputInfo() that tells a program when the last
user input (keyboard or mouse I think) happened.

[URL="https://msdn.microsoft.com/en-us/library/windows/desktop/ms646302%28v=vs.85%29.aspx"]https://msdn.microsoft.com/en-us/library/windows/desktop/ms646302%28v=vs.85%29.aspx[/URL]

My request is for something like this

While prime95 is running, every X seconds check for user input and if found suspend
While prime95 is suspended, every Y seconds check for user input and if none, then resume

I would set X at 15 to 30 seconds, and Y at 5 to 10 min.

This does not work when prime95 is a service. Or if two users are on one
machine using remote desktop. But I am OK with those restrictions.

Thanks,

kladner 2016-05-03 16:46

Are the applications you are stopping P95 for predictable enough that you could cover most needs with "PauseWhileRunning" and/or "LowMemWhileRunning"?

NBtarheel_33 2016-05-03 17:13

Prime95 is almost certainly *not* slowing down your computer. It is designed to run at the lowest priority, and will hence "get out of the way" of nearly any other task that needs to run. The only other possibility is that the priority settings of your Prime95 installation have been inappropriately raised, or Prime95 has been granted too much RAM for a P-1 assignment, causing repeated thrashing of the memory and hard disk.

I would check to be sure that you do not have a virus or malware that is potentially slowing down your system at certain intervals. Prime95 can actually be helpful here: if you watch your iteration times, and notice a jump every so many iterations (without your touching anything), this can be indicative of the presence of malware or viruses that are robbing spare CPU cycles.

kladner 2016-05-03 17:39

The one exception that I know of involves major Adobe apps like Photoshop and Lightroom. I don't think there is any real explanation, but things can slow down to where drawing the workspace is slow. Stopping a worker takes care of this.

rudi_m 2016-05-03 18:21

I'm using this, see undoc.txt (LINUX/FREEBSD/APPLE only):

In prime.txt you can have mprime suspend one worker when the system load gets above a threshold.
MaxLoad=a
MinLoad=b
PauseTime=c


[QUOTE=NBtarheel_33;433024]Prime95 is almost certainly *not* slowing down your computer.[/QUOTE]

This is not true. For a very simple test you can run two prime95 instances, one on high priority, one on low priority. I'm sure that the high priority instance is at least 5-10% slower while the low priority one is running. In some situations (hyperthreading CPU) the slow down will be more than 50% (similar as if both instances would run with the same priority).

bgbeuning 2016-05-03 19:30

measurements
 
I am a big proponent of taking measurements. So I timed one of my usual
tasks with and without prime95 running. The task is compiling a solution
in Visual Studio 2013 with about 90 projects.

Prime95 running (1st time) 25:20 (min:sec)
Prime95 not running 13:00
Prime95 running (2nd time) 24:00

I am not sure why there is such a difference given the scheduler priority
prime95 uses. My guess is the processes are kicking each others data
out of the L1/L2/L3 caches. The compile waits on lots of disk I/O. Every
time the compiler waits, prime95 runs and boots the compilers data out
of the caches.

The plan I suggested in the original post would not completely fix this compile
case because prime95 would start back up 10 minutes into the compile.

I could tell prime95 to look for the compiler (cl.exe & link.exe) running,
but this is just one example of what I use my PC for.

Task manager says the process Base Priority is Normal, but it does not
show the worker thread priority. I did not see thread priority in sysinternals
Process Explorer either. A second machine shows the same Base Priority.

The Linux I/O scheduler has a disk priority that says "only after no one else
has used the disk in X milliseconds". That would be a great OS priority to
have for the CPU also (prime95 can use the CPU after no other process has
run for X milliseconds).

TheJudger 2016-05-03 19:43

[QUOTE=NBtarheel_33;433024]Prime95 is almost certainly *not* slowing down your computer. It is designed to run at the lowest priority, and will hence "get out of the way" of nearly any other task that needs to run.[/QUOTE]

That is no longer true. This might be true on systems with just a single CPU core. But on a modern systems with e.g. a quadcore CPU Prime95 tries to utilize all 4 cores which is OK. When a user application needs CPU resources on just a single CPU core than it will get CPU time because of its (much) higher priority... BUT(!) the other cores are still running Prime95. This causes[LIST][*]all cores (3 cores Prime95 and 1 core user application) are [B]competing about shared resources[/B] like[LIST][*][B]memory bandwidth[/B][*]caches[*]thermal/power envelope (max turbo speed)[/LIST][*]unable to do max singlecore turbo on that CPU which runs the user application[*]...[/LIST]
Oliver

Dubslow 2016-05-03 21:38

[QUOTE=NBtarheel_33;433024]Prime95 is almost certainly *not* slowing down your computer. It is designed to run at the lowest priority, and will hence "get out of the way" of nearly any other task that needs to run. [/QUOTE]

Sorry, but this aint true. No common operating system I know of has a scheduler that's truly capable of idle-only scheduling. (At least, not Windows, Mac OS, or Linux. I know little about the *BSD kernels.)

Madpoo 2016-05-04 19:20

[QUOTE=TheJudger;433038]That is no longer true. This might be true on systems with just a single CPU core. But on a modern systems with e.g. a quadcore CPU Prime95 tries to utilize all 4 cores which is OK. When a user application needs CPU resources on just a single CPU core than it will get CPU time because of its (much) higher priority... BUT(!) the other cores are still running Prime95. This causes[LIST][*]all cores (3 cores Prime95 and 1 core user application) are [B]competing about shared resources[/B] like[LIST][*][B]memory bandwidth[/B][*]caches[*]thermal/power envelope (max turbo speed)[/LIST][*]unable to do max singlecore turbo on that CPU which runs the user application[*]...[/LIST]
Oliver[/QUOTE]

I've seen an instance here and there, pretty isolated and honestly I don't remember what it was, but I think it involved manipulating a large amount of files... it was kind of slow so I stopped Prime95 and it kicked into high gear.

George did explain in one post that if you have HT enabled, the OS will see all of these available "cores" and may not throttle back these idle-priority tasks. But if what you're doing is competing for resources that Prime95 is using (memory, AVX, whatever) you may find yourself in a situation where that idle-priority thread is still running full throttle on a core, leaving some other higher priority process waiting for resources.

I don't know if that fairly and accurately summarized what George said, so I beg pardon if I took it the wrong way.

For bgbeuning, I'd ask:
- Is hyperthreading enabled on your system?
- If so, could you disable in the BIOS and then try those VS compilations again to see if it's any different?

At the least, that would prove or disprove the idea that HT is playing any part in the OS giving too many cycles to an idle priority thread...

retina 2016-05-05 00:58

[QUOTE=NBtarheel_33;433024]Prime95 is almost certainly *not* slowing down your computer.[/QUOTE]Technically true, the computer won't go slower. But it will make other tasks run slower even at its lowest priority. All tasks have to share limited hardware resources, so things like the caches, memory controller paths, FPU/SEE/AVX registers, etc. need to be updated/saved/refreshed during each task switch. And programs that use lots of RAM and/or cache will experience slower operation when another task on another core is also using RAM and/or cache.

retina 2016-05-05 01:01

[QUOTE=Madpoo;433099]At the least, that would prove or disprove the idea that HT is playing any part in the OS giving too many cycles to an idle priority thread...[/QUOTE]This "idea" is already a known problem. The CPU doesn't have any method to introduce priority between threads. Two hardware threads on one core will share the same resources equally.

bgbeuning 2016-05-11 13:53

[QUOTE=Madpoo;433099]

For bgbeuning, I'd ask:
- Is hyperthreading enabled on your system?
- If so, could you disable in the BIOS and then try those VS compilations again to see if it's any different?

[/QUOTE]

The box has a Q9550 CPU which does not support hyper-threading.

bgbeuning 2016-05-11 19:59

Ran the VS compile test on another machine.

Machine Dual Opteron (24 core total) with prime95 running
as a service with 12 workers.

Run 1 (with p95) 22 min
Run 2 (w/o p95) 11 min
Run 3 (with p95) 20 min
Run 4 (w/o p95) 12 min

I expect any CPU bound task will not see this issue because the OS scheduler
will put prime95 to sleep. Most tasks are some mix of I/O and CPU.

When a machine is idle, prime95 will get all the system time. When some other
process starts running, the prime95 CPU usage will drop. I am thinking of making a program that uses Windows GetProcessTimes() and GetSystemTimes() to control
prime95. So periodically check the prime95 CPU usage and when
(Assuming 4 core machine with 4 prime95 workers.)
[LIST=1][*]Other process CPU usage < 10% of system time (or prime95 > 90% system time), do nothing[*]Other process usage between 10% and 35%, pause 1 worker thread[*]Other usage between 35% and 60%, pause 2 workers[*]Between 60% and 85%, pause 3 workers[*]Over 85%, stop all 4 workers[*]When the other process CPU usage drops enough, start some workers again[/LIST]

Madpoo 2016-05-15 00:12

[QUOTE=bgbeuning;433672]Ran the VS compile test on another machine.

Machine Dual Opteron (24 core total) with prime95 running
as a service with 12 workers.

Run 1 (with p95) 22 min
Run 2 (w/o p95) 11 min
Run 3 (with p95) 20 min
Run 4 (w/o p95) 12 min
[/QUOTE]

Hmm... those are interesting stats. Prime95 runs at idle priority, so it kind of makes me think the VS compiler is also running at a low priority, perhaps?

Is it running any custom tasks during the compile? For example, with the build our devs work with at my job, the build runs a lot of other things like Grunt, SASS, etc and I've noticed that some of those things run kind of slow as is. We've seen builds take over 30 minutes and that doesn't even include the time taken to deploy to a test environment.

So even though I'm fairly certain VS runs at a typical priority 7 or whatever, who knows what some other things might be doing...

Try using Process Explorer during a build and check out what's using CPU at any given time... Process Explorer lets you see all the details of the process like what priority it (or any sub-threads) is using... could be helpful.

In my case, if I'm doing massive disk activity, I'm better off stopping Prime95 for the duration. By "massive disk activity" I mean analyzing millions of files... not sure if that's something most people would run across.

bgbeuning 2016-05-15 12:45

A compile does a lot of I/O. My compile has 17,000 source files and
4000 objects files that need to be read and written.

I have the pauser program sort of working. With it controlling prime95,
the Q9550 based compile takes 12 minutes. Some parts are not done
and I need to tune the control algorithm for other situations.

I left it running overnight and it was amazing how often other things run
when I am away from the keyboard. Something runs every 15 minutes.
And AVG (anti-virus) seems to run quite often. I would prefer to let prime95
run full speed against these background processes, but I don't know how
to do that and still pause prime95 for foreground tasks.

henryzz 2016-05-15 18:15

A Q9550 will almost certainly be memory bandwidth bound. The bandwidth on the core 2s was very limited. The level 2 cache is split in two as well which won't help 4 threads on 1 worker.
Generally I would expect a CPU that old to be sensitive to slowing down. My Q6600 has got increasingly sensitive over the years.


All times are UTC. The time now is 22:08.

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