mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   Problem with HT processor (https://www.mersenneforum.org/showthread.php?t=4021)

mimic 2005-04-19 00:18

Problem with HT processor
 
Hi!

I have noticed a problem with HyperThreading P4 processor.

The problem is that Prime95 slows down my system. If I run many programs then this is not a problem as Windows distributes them over (two virtual) CPUs and then because Prime95 has the lowest priority everything works as it should (that is Prime95 does not get many CPU cycles). The problem is if I want to run only one program (next to Prime95 in background). Then because Windows XP thinks I have a dual CPU system it "gives" one CPU to the Prime95 and the other one to my other program. So each of the programs uses 100 % of their CPU. But because those are not real CPUs my program slows down as Prime95 is quite heavy on numerical part of the (physical) CPU. And because I run many numerically intensive programs this means that my programs run at around 50 % of the speed they would run without Prime95 running.

I know this is not the problem in Prime95 itself but I would like to point out this exception to the statement I found stressed many times in a readme file and Prime95 pages that Prime95 uses only idle cycles and does not slow down other programs as it runs under the lowest priority.

And because HT processors are quite common nowdays I would suggest that Prime95 should correct this (somehow). If there is a way to do this, of course. Because very often the user is running only one program intensively and if this program is running at 50 % of normal speed...


Mike

moo 2005-04-19 00:54

Simple Answer
Turn of hyperthreading in bios its really quite useless i mean for what they push it as its not. Noting can do what they claimed it can do all it can do is get you around 30 precent performance and if your proc has HT then its not even worth that 30 because its broken up and its rather hard to get 30% best off go to bios and disable it.

Prime95 2005-04-19 01:05

Some have reported that setting prime95's affinity to CPU 0 will solve the problem.

The problem you describe is, in my opinion, an OS bug. It should not assign a normal priority and an idle priority thread to run together on a hyperthreaded CPU. Worse yet, there are no OS calls that I've found to detect this condition and pause prime95.

TTn 2005-04-19 02:12

[QUOTE]The problem you describe is, in my opinion, an OS bug. It should not assign a normal priority and an idle priority thread to run together on a hyperthreaded CPU. Worse yet, there are no OS calls that I've found to detect this condition and pause prime95.[/QUOTE]

Bummer, I would have thought a SwitchToThread API might help.
I doubt it, but here is the description anyway.

The SwitchToThread function causes the calling thread to yield execution to another thread that is ready to run on the current processor. The operating system selects the thread to yield to.
Private Declare Function SwitchToThread Lib "kernel32.dll" () As Long
Private Sub Form_Load()
SwitchToThread
End Sub

dsouza123 2005-04-19 03:30

Check this thread, two solutions.
[url]http://www.mersenneforum.org/showthread.php?t=3746[/url]

HT P4 with media player was running poorly with Prime95.exe running.

Setting the CPU affinity in Prime95.exe to 0 allowed media player to run well.

The other solution is adding lines to prime.ini
PauseWhileRunning=program.exe
PauseCheckInterval=20

The above means check every 20 seconds to see if program.exe is running
if so pause Prime95.exe

Dresdenboy 2005-04-19 05:53

I think, another source of this problem is, that the 2 threads running simultaneously on a HT CPU simply have the same priority. The CPU doesn't manage different priorities. The OS only manages timeslices and if it sees an idle virtual CPU it even sends an idle priority thread to it, disturbing a high priority thread on the other virtual CPU. If the CPU affinity of Prime95 is set to 0, I think following happens: the Prime95 thread can only be sent to virtual CPU #0, while the other demanding thread is hopping from one virtual CPU to another because it doesn't have such an affinity setting. So it simply hinders Prime95 to run in 50% of the time, thus it effectively reduces the amount of time where ressources are occupied by Prime95 and so it finally has more CPU ressources for itself.

Although 2 demanding threads run smoothly on a HT CPU they still occupy the same hardware ressources as we already know. They seem to run smooth because the threads are "switched" with instruction granularity and not xy ms.

akruppa 2005-04-19 06:08

Could a sudden increase in iteration time be taken as an indicator that the system is otherwise busy and that Prime95 should be paused temporarily?

Alex

Dresdenboy 2005-04-19 08:03

[QUOTE=akruppa]Could a sudden increase in iteration time be taken as an indicator that the system is otherwise busy and that Prime95 should be paused temporarily?

Alex[/QUOTE]The increased iteration time already shows, that Prime95 is at least getting less ressources than usual. But if the performance of the other apps is OK for you, I don't see a reason, why Prime95 should be made even slower.

Dresdenboy 2005-04-19 08:08

I found a nice post on the Intel software forum regarding HT performance:
[url]http://softwareforums.intel.com/ids/board/message?board.id=42&message.id=548[/url]

The answer from the Intel guy also includes some details on how the L1 is shared between these threads (a thing I heard but never got confirmed somewhere). So the logical processors only get half the L1 cache (even if a thread uses only a few bytes of it). So the pure existence of a second thread (always the case if SMT is activated and supported by the OS) could possibly reduce performance of an application optimized for 8kB L1 on Northwood or 16kB L1 on Prescott.

mimic 2005-04-19 12:27

[QUOTE=Prime95]Some have reported that setting prime95's affinity to CPU 0 will solve the problem.[/QUOTE]

This does not work. Prime95 then runs on CPU 0, but the other program jumps to CPU 1 and there is no difference. They both keep running with full priority on their CPU and so my program slows down.

mimic 2005-04-19 12:45

[QUOTE=Dresdenboy]So the pure existence of a second thread (always the case if SMT is activated and supported by the OS) could possibly reduce performance of an application optimized for 8kB L1 on Northwood or 16kB L1 on Prescott.[/QUOTE]

Does this affect Prime95 perfomance? Is Prime95 optimized for different L1 cache sizes?

OT: Does P4 HT processor reports half of the L1 cache when running in HT mode?

So the solution for my problem would probably be that Prime95 would have a setting which would tell what is the lowest iteration time under which it would run. If the iteration time fails bellow this limit Prime95 should pause. I do not think that this would be so hard to implement. But it would really be nice to have. Because I really cannot afford to have programs running at 50 % of their speed.


All times are UTC. The time now is 21:17.

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