Page 5 of 7
Re: Configurable affinity changer for Windows
Posted: Wed Nov 05, 2008 11:15 pm
by baobab
Thanks for the feedback to both of you.
BTW BrgHW, since you have an Intel quad and you use 2 cores for the SMP, you can refine your profiles to always use two cores that share an L2 cache for the SMP, and use the other PAIR of cores for the GPUs (eventually balance the GPU clients by memory as well).
None of this will have a huge effect, mind you. But for the SMP client it will eliminate the synchronization and sharing of data to go over the north bridge.
PAIR0 always contains physical core 0 and the other core that happens to share the L2 cache with core 0. So you can place your GPU clients on PAIR1. Just replace CPU3 with PAIR1::CPU1 and CPU2 with PAIR1::CPU0.
Optionally, if your GPU clients have some common path prefix, you can write a rule to balance them across the cores based on memory use. I do not expect any big effect on PPD here.
Code: Select all
CoomonPathPrefixToGPUClients*\FahCore_*.exe := PAIR1 [assign=1,resource=memuse,policy=pseudobalanced]
Note the '*' to match all of them.
And it might help a little for the SMP client to be on a PAIR of cores because the four SMP processes exchange data every time step and there are 250K or 500K simulation steps typically for each unit. Replace CPU1 with PAIR0::CPU1 and CPU0 with PAIR0::CPU0 in your profile for the SMP client.
Re: Configurable affinity changer for Windows
Posted: Fri Nov 07, 2008 11:13 pm
by extrasalty
Thank you for making this great piece of software! I just recently found out about this tool and I have to say it's incredible. Now my Athlon can run SMP without starving the GPU- tried all kinds of tools before, but none was as reliable or customizable as this.
I think you should make it easier for everyone and put all the examples in 1 file and just separate them in sections. A way in the menu to edit the default profile file would be nice too.
Keep up the good work- can't wait to see the new versions!
Re: Configurable affinity changer for Windows
Posted: Sat Nov 08, 2008 12:36 am
by codysluder
baobab wrote:PAIR0 always contains physical core 0 and the other core that happens to share the L2 cache with core 0. So you can place your GPU clients on PAIR1. Just replace CPU3 with PAIR1::CPU1 and CPU2 with PAIR1::CPU0.
I've always wondered if Windows in consistent when it assigns numbers to CPU1, CPU2, and CPU3 and your statement seems to imply that it's not always the came CPUn that is paired with CPU0. Which is correct?
Re: Configurable affinity changer for Windows
Posted: Sat Nov 08, 2008 1:26 am
by baobab
extrasalty wrote:Thank you for making this great piece of software! I just recently found out about this tool and I have to say it's incredible. Now my Athlon can run SMP without starving the GPU- tried all kinds of tools before, but none was as reliable or customizable as this.
I think you should make it easier for everyone and put all the examples in 1 file and just separate them in sections.
Thanks for your comments extrasalty.
I think that putting all examples in one file will make things more confusing. If you just want to see all the examples in one place, you should open the included README.html file in your favorite browser and go to the last section "Sample configuration files". There is a short description for each sample file and links to the sample files. You can find the same thing online as well:
http://affinitychanger.sourceforge.net/#samples
A way in the menu to edit the default profile file would be nice too.
Keep up the good work- can't wait to see the new versions!
That's something that I might implement. I was thinking to add a preferences dialog box to change global settings, and it makes sense to have the default profile file as an option as well.
codysluder wrote:
I've always wondered if Windows in consistent when it assigns numbers to CPU1, CPU2, and CPU3 and your statement seems to imply that it's not always the came CPUn that is paired with CPU0. Which is correct?
On my machine the pairs of cores change on every restart (I have an Intel quad).
Disclaimer: It is possible that cores will have the same numbers on consecutive system restarts, but there are no guarantees for that.
It looks like they are randomly numbered, though I am sure they did not go out of their way to make it random. It is just the result of whatever algorithm they use which may involve some asynchronous events.
Re: Configurable affinity changer for Windows
Posted: Sat Nov 08, 2008 10:22 pm
by extrasalty
My bad- I jumped straight to the examples and didn't read the Readme file...definitely worth reading.
The more I use it now, the more I like it. I have one for GPU client that isolates it from SMP(I'm still experimenting with the floating process- I'm afraid that under XP it won't work as well as fixing all 4 SMP processes to CPU0 and isolate GPU on CPU1):
Code: Select all
C:\Program Files\Folding@home\Folding@home-gpu\FahCore_11.exe := CPU1 [force=yes, priority=BelowNormal]
C:\Program Files\Folding@Home Windows SMP Client V1.01\FahCore_*.exe := CPU0+CPU0+CPU0+CPU0+CPU0+CPU0+CPU0+CPU1 [force=yes,priority=idle,assign=2,resource=MEMUSE,policy=PSEUDOBALANCED]
*\firefox.exe := CPU1
C:\Program Files\* := CPU0
and one for games and SMP:
Code: Select all
C:\Program Files\Folding@Home Windows SMP Client V1.01\FahCore_*.exe := CPU0+CPU0+CPU0+CPU0+CPU1+CPU1+CPU0+CPU1 [force=yes,priority=idle,assign=2,resource=MEMUSE,policy=PSEUDOBALANCED]
*\cmdagent.exe := all
*\cfp.exe := all
* := CPU1 [force=yes]
This script relocates more processes than the first one but it gives me errors. I added the 2 lines for Comodo Firewall as either ALL or SKIP, but the console still throws errors at me :
Code: Select all
11/8/2008 13:47:58 PM: WARNING ApplicationProfile::setAffinityForProcess: Failed to get a handler of process cmdagent.exe with PID 1680.
Warning OpenProcess 6 (The handle is invalid)
11/8/2008 13:47:58 PM: WARNING ApplicationProfile::setAffinityForProcess: Failed to get a handler of process cfp.exe with PID 2824.
It seems to work ok in either script. I have yet to determine the benefits in games. I'll probably get a quad now just to mess with the WinAFC.
Re: Configurable affinity changer for Windows
Posted: Sun Nov 09, 2008 3:00 pm
by baobab
extrasalty wrote:
This script relocates more processes than the first one but it gives me errors. I added the 2 lines for Comodo Firewall as either ALL or SKIP, but the console still throws errors at me :
Code: Select all
11/8/2008 13:47:58 PM: WARNING ApplicationProfile::setAffinityForProcess: Failed to get a handler of process cmdagent.exe with PID 1680.
Warning OpenProcess 6 (The handle is invalid)
11/8/2008 13:47:58 PM: WARNING ApplicationProfile::setAffinityForProcess: Failed to get a handler of process cfp.exe with PID 2824.
That warning means the target process did not exist anymore when WinAFC tried to change its affinity, though it had some prior knowledge of it.
This is more likely to happen when restoring affinities to their initial value if you have any of the three toggleable flags enabled.
WinAFC checks for running processes every 30 seconds by default (you may change that value but let's use the default). Only during these periodic checks it detects new matching processes and processes that have terminated. If you were running an application with its affinity managed by WinAFC and if after the process terminated you perform some action that tries to restore affinities of running processes (Pause, Load another profile, or Exit) before the next periodic check for processes, you will get that warning for the processes that have just terminated when WinAFC attempts to restore their affinities.
If you got those warnings during such a scenario, then it is not really a problem. You can safely ignore the warnings. Though I could detect such cases myself and not print the warning.
However, if you received those warnings in other circumstances, then it could be a more serious problem and I will have to investigate further.
It seems to work ok in either script. I have yet to determine the benefits in games. I'll probably get a quad now just to mess with the WinAFC.
Now you are looking for excuses to buy a quad. But who am I to judge? I bought mine a while ago.
Re: Configurable affinity changer for Windows
Posted: Tue Nov 11, 2008 12:02 pm
by RU_Hil
Well, I tried this 0.9 WinAFC, because the idea is good, and that's the thing I really need. I have Phenom 9750 + NV GF 9800GTX+ here, and under WinXP GPU should have 1 core exclusively to work better. It assignes itself to core3 automatically, but FahCore_a1.exe aren't tha good. So, I set them manually to use cores 0,1,2.
Now I add a profile:
*\FahCore_a1.exe := CPU0+CPU1+CPU2 [force=yes]
Stars WinAFC
this is log:
Auto detecting CPU configuration. Please wait.
11.11.2008 14:37:26: Found 4 CPUs:
CPU0 has mask 00000001
CPU1 has mask 00000002
CPU2 has mask 00000004
CPU3 has mask 00000008
11.11.2008 14:37:26: Found 1 QUADs:
QUAD0<CPU0,CPU1,CPU2,CPU3> has mask 0000000F
11.11.2008 14:37:26: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1820, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:37:26: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1788, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:37:26: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1612, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:37:26: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1824, set affinity to CPU0+CPU1+CPU2
Auto detecting CPU configuration. Please wait.
11.11.2008 14:43:14: Found 4 CPUs:
CPU0 has mask 00000001
CPU1 has mask 00000002
CPU2 has mask 00000004
CPU3 has mask 00000008
11.11.2008 14:43:14: Found 1 QUADs:
QUAD0<CPU0,CPU1,CPU2,CPU3> has mask 0000000F
11.11.2008 14:43:14: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1820, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:43:14: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1788, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:43:14: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1612, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:43:14: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 1824, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:45:44: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 3944, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:45:44: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 2148, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:45:44: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 4024, set affinity to CPU0+CPU1+CPU2
11.11.2008 14:45:44: C:\FAH_SMP_Windows\FahCore_a1.exe with PID 3632, set affinity to CPU0+CPU1+CPU2
several tries, I restarted WinAFC and SMP too (last four lines are about that). It seems OK in log, but does nothing in fact... Affinity is still includes all availiable cpus, 0 to 3...
Have I done something wrong?
Re: Configurable affinity changer for Windows
Posted: Tue Nov 11, 2008 12:08 pm
by GoryanskyAleksey
*\FahCore_a1.exe := CPU0+CPU1+CPU2 [
assign=1,force=yes]
It means that every *\FahCore_a1.exe will be set to only 1 core.
STOP! Did you change or comment in config file string
TestMode = 1 ? If not, do it
Re: Configurable affinity changer for Windows
Posted: Tue Nov 11, 2008 12:24 pm
by RU_Hil
I'm sorry. TestMode is still on.
Lame... am I not...
Re: Configurable affinity changer for Windows
Posted: Tue Nov 11, 2008 2:44 pm
by RU_Hil
Works fine for me. Great!
Re: Configurable affinity changer for Windows
Posted: Tue Nov 11, 2008 4:19 pm
by baobab
Glad to see the issue resolved even before I could notice it.
I already changed the program to print a message when it is running in TestMode (at the suggestion of another user), so it will be easier for new users to understand why no affinities are being changed.
Re: Configurable affinity changer for Windows
Posted: Thu Nov 13, 2008 11:22 pm
by extrasalty
I'm having a little problem. I don't know why, but sometimes explorer.exe's CPU usage goes up, not a 100% but more than it should be and I have to close it through task manager and rerun it again. When it redraws the icons in the taskbar, WinAFC's icon doesn't get redrawn. So to use the menus I have to restart WinAFC. Any way to fix that?
Re: Configurable affinity changer for Windows
Posted: Fri Nov 14, 2008 4:35 am
by baobab
extrasalty wrote:I'm having a little problem. I don't know why, but sometimes explorer.exe's CPU usage goes up, not a 100% but more than it should be and I have to close it through task manager and rerun it again. When it redraws the icons in the taskbar, WinAFC's icon doesn't get redrawn. So to use the menus I have to restart WinAFC. Any way to fix that?
The application has to restore the icon in the systray when the taskbar is recreated. WinAFC was supposed to do that but I never tested this scenario. It turns out there was a small bug. I fixed it and the fix will be in the next release. In the meantime you cannot do much. Hopefully, you will not have to kill explorer too often. Thanks for reporting the bug.
Re: Configurable affinity changer for Windows
Posted: Fri Nov 14, 2008 7:06 pm
by p2501
Very potent tool you have here, but I'm having a little trouble with it.
I'm running Vista64 Ultimate, UAC enabled. The problems occur with starting it as Admin and without admin rights.
First of all the 64 version just dies right on the spot, without anything happening, just the Windows error window telling me it died. Then I tried the 32 bit and that works, at least for the GPU processes with the following config:
Code: Select all
*\vmware-vmx.exe := PAIR0+PAIR1 [assign=2,priority=idle]
C:\Users\root\FAH-GPU\FahCore_11.exe := PAIR0::CPU1 [priority=High]
C:\Users\root\FAH-GPU2\FahCore_11.exe := PAIR1::CPU1 [priority=High]
BUT it doesn't recognise the two running VM's, says no matching processes. Test mode on/off has no impact on that behaviour. Also giving it the complete path to vmware-vmx.exe doesn't help. What am I doing wrong? Do you need additional infos? Help would be much appreciated bc I like what this handy little tool can do!
Edit: Here's the error msg for the VM problem:
Code: Select all
Auto detecting CPU configuration. Please wait.
14.11.2008 20:50:51: Found 4 CPUs:
CPU0 has mask 00000001
CPU1 has mask 00000002
CPU2 has mask 00000004
CPU3 has mask 00000008
14.11.2008 20:50:51: Found 2 PAIRs:
PAIR0<CPU0,CPU1> has mask 00000003
PAIR1<CPU2,CPU3> has mask 0000000C
14.11.2008 20:50:51: C:\Users\root\FAH-GPU2\FahCore_11.exe with PID 3512, set affinity to CPU3
14.11.2008 20:50:51: C:\Users\root\FAH-GPU2\FahCore_11.exe with PID 3512, set priority to High.
14.11.2008 20:50:51: C:\Users\root\FAH-GPU\FahCore_11.exe with PID 3480, set affinity to CPU1
14.11.2008 20:50:51: C:\Users\root\FAH-GPU\FahCore_11.exe with PID 3480, set priority to High.
14.11.2008 20:56:26: C:\Users\root\FAH-GPU2\FahCore_11.exe with PID 3512, set affinity to CPU3
14.11.2008 20:56:26: C:\Users\root\FAH-GPU2\FahCore_11.exe with PID 3512, set priority to High.
14.11.2008 20:56:26: C:\Users\root\FAH-GPU\FahCore_11.exe with PID 3480, set affinity to CPU1
14.11.2008 20:56:26: C:\Users\root\FAH-GPU\FahCore_11.exe with PID 3480, set priority to High.
ONE TIME CHECK: No processes found for profile "C:\Program Files (x86)\VMware\VMware Player\x64\vmware-vmx.exe"
Re: Configurable affinity changer for Windows
Posted: Fri Nov 14, 2008 7:49 pm
by baobab
p2501 wrote:Very potent tool you have here, but I'm having a little trouble with it.
I'm running Vista64 Ultimate, UAC enabled. The problems occur with starting it as Admin and without admin rights.
First of all the 64 version just dies right on the spot, without anything happening, just the Windows error window telling me it died. Then I tried the 32 bit and that works, at least for the GPU processes with the following config:
Code: Select all
*\vmware-vmx.exe := PAIR0+PAIR1 [assign=2,priority=idle]
C:\Users\root\FAH-GPU\FahCore_11.exe := PAIR0::CPU1 [priority=High]
C:\Users\root\FAH-GPU2\FahCore_11.exe := PAIR1::CPU1 [priority=High]
BUT it doesn't recognise the two running VM's, says no matching processes. Test mode on/off has no impact on that behaviour. Also giving it the complete path to vmware-vmx.exe doesn't help. What am I doing wrong? Do you need additional infos? Help would be much appreciated bc I like what this handy little tool can do!
The 32bit version will recognize only 32bit processes running under a Win64 OS. I assume VMWare is a native 64bit application. That's why it is not seen.
In fact the incompatibility between 32bit and 64bit is just getting the full path of a running process. I think you might be able to match the vmware processes if your application mask is just "vmware-vmx.exe", without quotes. But this is not the right way. You should use the 64bit version on a 64bit OS.
You mention you receive an error with the 64bit version. It would help if you posted a screenshot of the error. But I think I have an idea what the problem is. One other user reported a similar problem to me by email. It turned out it was an optimization that I used to reduce the executable size by a few KB. The next release will be compiled without this optimization.
Because this a show stopping bug, I have a recompiled version of version 0.9 (the 64bit binary only) at
http://affinitychanger.sourceforge.net/Temp/
Try that executable and report back if it still does not work for you. It could be some other issue, but I think this is the problem.