Configurable affinity changer for Windows

This forum contains information about 3rd party applications which may be of use to those who run the FAH client and one place where you might be able to get help when using one of those apps.

Moderator: Site Moderators

baobab
Posts: 40
Joined: Wed Mar 26, 2008 3:54 am

Re: Configurable affinity changer for Windows

Post by baobab »

I uploaded a new version of the affinity changing program to the usual place: https://sourceforge.net/project/platfor ... _id=238550

As you may notice, I decided to give the program a less generic name. So now it is released as WinAFC v0.9

This version contains a coupe of bug fixes. However, the main change is that the program has a GUI interface now.
The interface is rather minimal. It consists of an icon installed to the systray area and a pop-up menu activated by right-clicking the icon.

The program can open/hide a console so log/error messages are displayed to the user. The icon itself can be hidden as well and added back to the systray area when the user attempts to start another instance of the program. No more than one instance of the program can run at any given time. Starting a second instance just changes focus to the first instance.

The pop-up menu enables some interaction between the user and the application. One can load a different configuration file without restarting the program, one can pause and resume the monitoring of processes on demand, and restore the affinities changed by the program to their initial values.
The full documentation is at http://affinitychanger.sourceforge.net/

The way the configuration files are written is unchanged and old profiles work the same in the new version.
If you used the console version of the program, then you might want to read only the section that describes the pop-up menu options http://affinitychanger.sourceforge.net/#contextmenu and the section on command line parameters because two new options were added to start the program in a hidden state or with a hidden console: http://affinitychanger.sourceforge.net/#commandline

There were two bug fixes:
- made the CPU detection heuristic more resilient to variations in core speeds as a fix to the problem reported by Anachron with a Phenom quad core.
- cosmetic change: LOG messages print each CPU only once as part of a CPU mask.

I released also an updated console version of the program that incorporates the above two fixes for those who prefer a console version. It is released as AffinityChanger-0.83: https://sourceforge.net/project/showfil ... _id=289964

However, the main version of the program will be the GUI version from now on.
Let me know if you have any issues with running the program, or if you find any bugs.
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

Hi Baobab,

I just installed WinAFC-0.9, and got this message:

Auto detecting CPU configuration. Please wait.
03/11/2008 12:31:48: Found 2 CPUs:
CPU0 has mask 00000001
CPU1 has mask 00000002
03/11/2008 12:31:48: Found 1 PAIRs:
PAIR0<CPU0,CPU1> has mask 00000003
03/11/2008 12:31:48: WARNING CWinAFCDlg::TraverseProcessList: There are no valid application profiles. The program will auto-pause.

how do I have to configure it ? :oops:

Edit:
well, this seems to work:
[My F@H folder]\FahCore_*.exe := PAIR0 [assign=1,resource=CPUUSE,policy=PSEUDOBALANCED]
French member of l'Alliance Francophone (Team 51)

Image
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

My last logs:

Affinity Log:
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 2668 using 143672.0KB of RAM, set affinity to CPU0
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 2500 using 100272.0KB of RAM, set affinity to CPU1
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 1996 using 98568.0KB of RAM, set affinity to CPU1
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 2412 using 97616.0KB of RAM, set affinity to CPU0

Print CPUs:
03/11/2008 13:26:46: Found 2 CPUs:
CPU0 has mask 00000001
CPU1 has mask 00000002
03/11/2008 13:26:46: Found 1 PAIRs:
PAIR0<CPU0,CPU1> has mask 00000003

Print Processes:
03/11/2008 13:26:52: There are 4 processes and 0 threads matching application profiles:
(P1) Process E:\F@H-SMP\FahCore_a1.exe with PID 1996
(P2) Process E:\F@H-SMP\FahCore_a1.exe with PID 2412
(P3) Process E:\F@H-SMP\FahCore_a1.exe with PID 2500
(P4) Process E:\F@H-SMP\FahCore_a1.exe with PID 2668
French member of l'Alliance Francophone (Team 51)

Image
baobab
Posts: 40
Joined: Wed Mar 26, 2008 3:54 am

Re: Configurable affinity changer for Windows

Post by baobab »

Hi Pascal,

It seems you figured it out. Because the program does not target any specific folding client, you have to specify which processes to look for and how to set their affinities in the configuration file.

If your setup consists of one Win SMP client on a dual core machine, the prevailing wisdom says the profile that you wrote is the optimal one. Optionally, you could pin the first two most expensive processes to one core each, and let the lighter two processes float freely on both cores.
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 2668 using 143672.0KB of RAM, set affinity to CPU0
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 2500 using 100272.0KB of RAM, set affinity to CPU1
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 1996 using 98568.0KB of RAM, set affinity to CPU1
03/11/2008 12:51:49: E:\F@H-SMP\FahCore_a1.exe with PID 2412 using 97616.0KB of RAM, set affinity to CPU0
Looking at your posted log, it seems that you specified "resource=memuse" instead of "cpuuse". Tell me that it is so and that it is not actually a bug. It does not really matter if you use cpuuse or memuse in your particular case as the CPU use and memory use seem to be correlated with that client.

baobab
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

Hi Baobab,

Well, I used "resource=memuse" because I took example on the sampleinput3.txt file, which was in the WinAFC examples folder.

I have modified my input file to "resource=cpuuse", and it seems that my cpu fan has slow down, that could mean that my cpu heats less ?

Edit: Now my computer spends 45 minutes per %, instead of 50 minutes. Is it a cpu affinity result ? :D
French member of l'Alliance Francophone (Team 51)

Image
BrgHW
Posts: 26
Joined: Sat Feb 02, 2008 3:12 pm
Location: Bodø, Norway

Re: Configurable affinity changer for Windows

Post by BrgHW »

Hi again.

Thanx for the new version, it's super :D

Now I have rebuilt one of my computers.

It's the XP with Q6600 CPU, now with 2x9800GX2 cards.

So I have 4 GPU clients and a SMP. I have tried putting all GPU folding to CPU3 and SMP on the 3 others. This give me ok result on SMP , but I loose app. 300 ppd pr. GPU client.

Would it be possibe to put 1 GPU to CPU2, 3 on CPU3 and run SMP on CPU0 + CPU1+CPU2(lightest process together with GPU on CPU2) :?:

PS: have found out that I's always best to not have GPU folding on CPU0. I guess that CPU0 is used by operating system and system processes, so it gives a litte lagg on folding.
Image
baobab
Posts: 40
Joined: Wed Mar 26, 2008 3:54 am

Re: Configurable affinity changer for Windows

Post by baobab »

Pascal94 wrote: I have modified my input file to "resource=cpuuse", and it seems that my cpu fan has slow down, that could mean that my cpu heats less ?
Hmm, in general you want better utilization of the CPU. It should not heat less.
Edit: Now my computer spends 45 minutes per %, instead of 50 minutes. Is it a cpu affinity result ? :D
I would like to think so, but honestly, I do not know. It is definitely possible.

You can test, however, 2 or 3 configurations to determine the one that is better. There are not many combination that I would try with one SMP client running on a dual core.

I would test these three configurations.
1) A baseline configuration where all FAH processes can roam freely on both cores. This would correspond to no affinity settings:

Code: Select all

E:\F@H-SMP\FahCore_*.exe := ALL
2) The configuration that you use right now:

Code: Select all

E:\F@H-SMP\FahCore_*.exe := PAIR0 [assign=1,resource=CPUUSE,policy=PSEUDOBALANCED]
3) Pin the most expensive process to core 0 and the next two processes to core 1 and let the last process roam freely on both cores so Windows can load balance them. Hopefully, you get some cache locality benefits from pinning the first three processes.

Code: Select all

E:\F@H-SMP\FahCore_*.exe := CPU0+CPU0+CPU1+CPU1+CPU1+CPU1+CPU0+CPU1 [assign=2,resource=CPUUSE,policy=PSEUDOBALANCED]
As always, the entire rule should be on one line.

You can write each of these profiles in a separate file and load them one at a time. Let it run for a few frames with each one and see if it makes a difference and which one is better.
Though 45-50 minutes per frame is quite large. I assume you have a lower clocked dual core, or maybe these projects are just large. I used a Windows SMP only briefly when I started folding.
One unit would take you 3+ days. I hope you can make the deadlines.

Edit: Note also that if you are using Windows XP, I am not sure if using "resource=cpuuse" is better than using "resorce=memuse" because the FAH clients utilize any available CPU at 100%, even if not doing any useful work.

Edit 2: I tested the Windows SMP client on my machine because I wanted to check a few things, and the best I could get on two cores (of an Intel Quad) under Windows XP was to use the third profile above, except using resource=memuse instead of cpuuse:

Code: Select all

E:\F@H-SMP\FahCore_*.exe := CPU0+CPU0+CPU1+CPU1+CPU1+CPU1+CPU0+CPU1 [assign=2,resource=memuse,policy=PSEUDOBALANCED]
If you are using Vista, I guess it does not make a difference if you use cpuuse or memuse.
Last edited by baobab on Tue Nov 04, 2008 5:47 am, edited 2 times in total.
baobab
Posts: 40
Joined: Wed Mar 26, 2008 3:54 am

Re: Configurable affinity changer for Windows

Post by baobab »

BrgHW wrote:Hi again.

Thanx for the new version, it's super :D

Now I have rebuilt one of my computers.

It's the XP with Q6600 CPU, now with 2x9800GX2 cards.

So I have 4 GPU clients and a SMP. I have tried putting all GPU folding to CPU3 and SMP on the 3 others. This give me ok result on SMP , but I loose app. 300 ppd pr. GPU client.

Would it be possibe to put 1 GPU to CPU2, 3 on CPU3 and run SMP on CPU0 + CPU1+CPU2(lightest process together with GPU on CPU2) :?:

PS: have found out that I's always best to not have GPU folding on CPU0. I guess that CPU0 is used by operating system and system processes, so it gives a litte lagg on folding.
I am glad that you like it more than the old version. :)

Sadly, with Windows XP there is no viable way to mix GPU clients and CPU clients onto the same core. The reason for this is that both the CPU and the GPU FAH cores use busy waiting while synchronizing with the other CPU cores or with the GPU, respectively. If you give one of the clients a lower priority, then it will get starved because the other client will use all the CPU cycles. If you give them both the same priority, then they will fight it out, and maybe each one will get about 50% of the cycles. I never tried it myself. In fact I do not run a Windows SMP to try it.

If you think the least expensive SMP process needs less than 50% of one core to keep up with the other 3 processes sharing two cores, then you can give it a try.

Here is a possible configuration that you can update with the correct paths and try out:

Code: Select all

PathToGPUClient1\FahCore_*.exe := CPU3
PathToGPUClient2\FahCore_*.exe := CPU3
PathToGPUClient3\FahCore_*.exe := CPU3
# I assign priority explicitly to this client to make sure it is the same as the SMP process
PathToGPUClient4\FahCore_*.exe := CPU2 [priority=idle]

PathToWinSMPClient\FahCore_*.exe := CPU1+CPU1+CPU0+CPU0+CPU0+CPU1+CPU2+CPU2 [assign=2,resource=CPUUSE,policy=PSEUDOBALANCED,priority=idle]
Note that for the SMP client I tried to pin the first two processes to one core each, have the third process float on cores 0 and 1, and the fourth process goes to core 2 (same as the fourth GPU client).

One thing that I just realized now: does the program determine the CPU usage correctly for the FAH clients in Windows XP? Since the clients use busy waiting, effectively using all affected cores at 100%, I do not know if using resource=cpuuse is the best thing for Win XP. Maybe you should try changing "resource=cpuuse" to "resource=memuse" (all profile attributes are case insensitive).

Again, I do not know if this will give positive results, but you can try it. If it works better than what you have now, there are also ways to refine it a bit more.

Edit: I was curious about sharing a core between the GPU client and one process of the SMP client, so I tested this myself. It does not work well. The GPU client gets a significant slowdown (800-900 PPD out of 6100-6200).
Also, under Windows XP is better to use resource=memuse to sort the SMP processes, since the CPU usage is not reliable.

You could try using two cores for the GPU clients running two GPU clients per core, and an SMP client on the other two cores. See if this gives you more points than running the four GPU clients on one core and the Windows SMP on 3 cores. You could even run a Linux SMP inside a VMWare on two of the cores instead of the Windows SMP.
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

baobab wrote:Hmm, in general you want better utilization of the CPU. It should not heat less.
well, in fact it slown down because I stoped working on the computer :lol:
I would test these three configurations.
1) A baseline configuration where all FAH processes can roam freely on both cores. This would correspond to no affinity settings:

Code: Select all

E:\F@H-SMP\FahCore_*.exe := ALL
2) The configuration that you use right now:

Code: Select all

E:\F@H-SMP\FahCore_*.exe := PAIR0 [assign=1,resource=CPUUSE,policy=PSEUDOBALANCED]
3) Pin the most expensive process to core 0 and the next two processes to core 1 and let the last process roam freely on both cores so Windows can load balance them. Hopefully, you get some cache locality benefits from pinning the first three processes.

Code: Select all

E:\F@H-SMP\FahCore_*.exe := CPU0+CPU0+CPU1+CPU1+CPU1+CPU1+CPU0+CPU1 [assign=2,resource=CPUUSE,policy=PSEUDOBALANCED]
As always, the entire rule should be on one line.
I will try each one when it will be 15% done
Though 45-50 minutes per frame is quite large. I assume you have a lower clocked dual core, or maybe these projects are just large. I used a Windows SMP only briefly when I started folding.
One unit would take you 3+ days. I hope you can make the deadlines.
the computer is a Pentium D820 @2.80Ghz, whith 1 Go RAM. the deadline is 5 days, so it should be short but I think I can make the deadline :?
Edit 2: I tested the Windows SMP client on my machine because I wanted to check a few things, and the best I could get on two cores (of an Intel Quad) under Windows XP was to use the third profile above, except using resource=memuse instead of cpuuse:

Code: Select all

E:\F@H-SMP\FahCore_*.exe := CPU0+CPU0+CPU1+CPU1+CPU1+CPU1+CPU0+CPU1 [assign=2,resource=memuse,policy=PSEUDOBALANCED]
If you are using Vista, I guess it does not make a difference if you use cpuuse or memuse.
I think it will be the best profile for my computer, it is the first that I will try
French member of l'Alliance Francophone (Team 51)

Image
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

I loaded the third profile, and got this log:
04/11/2008 11:26:25: WARNING ApplicationProfile::finalize: CPU mask for application profile "E:\F@H-SMP\FahCore_*.exe" contains duplicate CPUs. Ignore this error message if duplicates are intentional.
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 440 using 78.9% of CPU time, set affinity to CPU0
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 2876 using 59.0% of CPU time, set affinity to CPU1
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 612 using 37.5% of CPU time, set affinity to CPU1
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 256 using 20.4% of CPU time, set affinity to CPU0+CPU1
I don't know what it means (I'm a Frenchy :biggrin: )
French member of l'Alliance Francophone (Team 51)

Image
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

well, I've done 1% (15%-->16%) whith the profile N°3:
[10:21:46] Completed 37500 out of 250000 steps (15 percent)
[10:24:46] Timered checkpoint triggered.
[10:27:47] Timered checkpoint triggered.
[10:30:48] Timered checkpoint triggered.
[10:33:49] Timered checkpoint triggered.
[10:36:50] Timered checkpoint triggered.
[10:39:51] Timered checkpoint triggered.
[10:42:52] Timered checkpoint triggered.
[10:45:53] Timered checkpoint triggered.
[10:48:54] Timered checkpoint triggered.
[10:51:54] Timered checkpoint triggered.
[10:54:55] Timered checkpoint triggered.
[10:57:56] Timered checkpoint triggered.
[11:00:56] Timered checkpoint triggered.
[11:03:57] Timered checkpoint triggered.
[11:05:53] Writing local files
[11:05:54] Completed 40000 out of 250000 steps (16 percent)
From 10:21:46 to 11:05:54 : 44 minutes to work 1%, and I'm working on this computer :D

It looks good, let's wait up to 20% to do an average of the last frames :wink:

Edit: from 16% to 18%: 44 minutes per frame :biggrin:
French member of l'Alliance Francophone (Team 51)

Image
baobab
Posts: 40
Joined: Wed Mar 26, 2008 3:54 am

Re: Configurable affinity changer for Windows

Post by baobab »

Pascal94 wrote:I loaded the third profile, and got this log:
04/11/2008 11:26:25: WARNING ApplicationProfile::finalize: CPU mask for application profile "E:\F@H-SMP\FahCore_*.exe" contains duplicate CPUs. Ignore this error message if duplicates are intentional.
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 440 using 78.9% of CPU time, set affinity to CPU0
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 2876 using 59.0% of CPU time, set affinity to CPU1
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 612 using 37.5% of CPU time, set affinity to CPU1
04/11/2008 11:26:25: E:\F@H-SMP\FahCore_a1.exe with PID 256 using 20.4% of CPU time, set affinity to CPU0+CPU1
I don't know what it means (I'm a Frenchy :biggrin: )
The warning is fine. Do not forget to test this profile with "resource=memuse" as well. On my machine it was a little better.
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

well, I've done 20%, with an average time per frame about 44/45 minutes
now, I try the same profile, with "ressource=memuse"
Last edited by Pascal94 on Tue Nov 04, 2008 10:16 pm, edited 1 time in total.
French member of l'Alliance Francophone (Team 51)

Image
Pascal94
Posts: 10
Joined: Sun Aug 03, 2008 2:17 pm
Hardware configuration: Q9550@3.11GHz - 4 Go DDR2 - Samsung Spinpoint F1 320 Go - Ubuntu 10.04.1 LTS (lucid)
Location: France

Re: Configurable affinity changer for Windows

Post by Pascal94 »

now I'm close to 30%, using your 3rd profile with with "ressource=memuse"

here are some results of the benchmarks:

Before WinAFC:
Min. Temps / Frame : 49mn 05s - 563.29 ppd
Avg. Temps / Frame : 54mn 59s - 502.84 ppd
No Cur. Temps / Frame
No R3F. Temps / Frame
No Eff. Temps / Frame
I had to cancel this WU beacause I could'nt do the deadline :(

With WinAFC:
Min. Temps / Frame : 42mn 35s - 649.27 ppd
Avg. Temps / Frame : 50mn 12s - 550.76 ppd
Cur. Temps / Frame : 45mn 38s - 605.87 ppd
R3F. Temps / Frame : 45mn 35s - 606.54 ppd
Eff. Temps / Frame : 1h 09mn 35s - 397.34 ppd
This seems better :D

FahMon informations:
Downloaded 1d 10h 04mn
Deadline 4d 13h 54mn
ETA 2d 5h 29mn
These are very good news :biggrin:
French member of l'Alliance Francophone (Team 51)

Image
BrgHW
Posts: 26
Joined: Sat Feb 02, 2008 3:12 pm
Location: Bodø, Norway

Re: Configurable affinity changer for Windows

Post by BrgHW »

baobab wrote: Sadly, with Windows XP there is no viable way to mix GPU clients and CPU clients onto the same core. The reason for this is that both the CPU and the GPU FAH cores use busy waiting while synchronizing with the other CPU cores or with the GPU, respectively. If you give one of the clients a lower priority, then it will get starved because the other client will use all the CPU cycles. If you give them both the same priority, then they will fight it out, and maybe each one will get about 50% of the cycles. I never tried it myself. In fact I do not run a Windows SMP to try it.

Yes, got the best total result, by putting 2 GPU's at CPU3, 2 at CPU2 and the SMP at 0&1. Total this PC is giving 25200ppd at the moment.

Also solved a problem on a Dell computer with your program. It hav only one GPU on a Q6600, but as soon as I startet up the SMP, I lost 1500ppd on the GPU. Don't now why but puttin GPU to CPU3 and letting the SMP use the 3 others did fix it. And this PC is now giving 6500ppd.

Thank You for all help :D
Image
Post Reply