Impact of setting core affinity

Message boards : Number crunching : Impact of setting core affinity
Message board moderation

To post messages, you must log in.

AuthorMessage
gs
Volunteer tester
Avatar

Send message
Joined: 18 May 99
Posts: 45
Credit: 5,412,660
RAC: 8
Germany
Message 1388793 - Posted: 8 Jul 2013, 9:42:47 UTC

Is there an advantage of setting an affinity for tasks to cpu cores? Would setting an affinity of a cpu core to support cuda tasks speed up th calculations?
ID: 1388793 · Report as offensive
Cruncher-American Crowdfunding Project Donor*Special Project $75 donorSpecial Project $250 donor

Send message
Joined: 25 Mar 02
Posts: 1513
Credit: 370,893,186
RAC: 340
United States
Message 1388798 - Posted: 8 Jul 2013, 10:32:23 UTC - in response to Message 1388793.  

Is there an advantage of setting an affinity for tasks to cpu cores? Would setting an affinity of a cpu core to support cuda tasks speed up th calculations?

How would you do that?
ID: 1388798 · Report as offensive
Claggy
Volunteer tester

Send message
Joined: 5 Jul 99
Posts: 4654
Credit: 47,537,079
RAC: 4
United Kingdom
Message 1388799 - Posted: 8 Jul 2013, 10:38:17 UTC - in response to Message 1388793.  
Last modified: 8 Jul 2013, 10:40:00 UTC

Is there an advantage of setting an affinity for tasks to cpu cores? Would setting an affinity of a cpu core to support cuda tasks speed up th calculations?

No, but setting the app's priority to 'normal', 'abovenormal', or 'high' should, by using the supplied mbcuda.cfg file.

Your's is still set to below normal:

<stderr_txt>
setiathome_CUDA: Found 1 CUDA device(s):
Device 1: GeForce GTX 660 Ti, 2048 MiB, regsPerBlock 65536
computeCap 3.0, multiProcs 7
pciBusID = 1, pciSlotID = 0
In cudaAcc_initializeDevice(): Boinc passed DevPref 1
setiathome_CUDA: CUDA Device 1 specified, checking...
Device 1: GeForce GTX 660 Ti is okay
SETI@home using CUDA accelerated device GeForce GTX 660 Ti
pulsefind: blocks per SM 4 (Fermi or newer default)
pulsefind: periods per launch 100 (default)
Priority of process set to BELOW_NORMAL (default) successfully
Priority of worker thread set successfully

setiathome enhanced x41zc, Cuda 5.00

Detected setiathome_enhanced_v7 task. Autocorrelations enabled, size 128k elements.


Claggy
ID: 1388799 · Report as offensive
gs
Volunteer tester
Avatar

Send message
Joined: 18 May 99
Posts: 45
Credit: 5,412,660
RAC: 8
Germany
Message 1388800 - Posted: 8 Jul 2013, 10:38:17 UTC - in response to Message 1388798.  
Last modified: 8 Jul 2013, 10:39:38 UTC

In Win 7 under Task Manager /Processes, you can right click an set an affinity for a task to one of the cores of the cpu. This selected task then would be run on that CPU core only.

I have set affinities like this:
Core 0: AKv8c_Bb_r1846_winx86_SSSE3x
Core 1: AKv8c_Bb_r1846_winx86_SSSE3x
Core 2: AKv8c_Bb_r1846_winx86_SSSE3x
Core 3: Lunatics_x41zc_win32_cuda50
Core 3: Lunatics_x41zc_win32_cuda50
Core 3: Lunatics_x41zc_win32_cuda50

where the AKv8c are CPU tasks, and Core 3 would feed 3 x cuda50 on my GPU.
ID: 1388800 · Report as offensive
Alinator
Volunteer tester

Send message
Joined: 19 Apr 05
Posts: 4178
Credit: 4,647,982
RAC: 0
United States
Message 1388810 - Posted: 8 Jul 2013, 11:41:18 UTC - in response to Message 1388800.  
Last modified: 8 Jul 2013, 11:41:40 UTC

However, setting affinity that way only lasts for as long as the task(s) you do it for runs. Once it finishes, thread control and scheduling reverts to the OS.
ID: 1388810 · Report as offensive
gs
Volunteer tester
Avatar

Send message
Joined: 18 May 99
Posts: 45
Credit: 5,412,660
RAC: 8
Germany
Message 1388830 - Posted: 8 Jul 2013, 12:48:26 UTC - in response to Message 1388810.  

However, setting affinity that way only lasts for as long as the task(s) you do it for runs. Once it finishes, thread control and scheduling reverts to the OS.

I am aware of this, however I find it interesting to figure out, if this would be beneficial to the processing time. Any observations so far?
ID: 1388830 · Report as offensive
Ulrich Metzner
Volunteer tester
Avatar

Send message
Joined: 3 Jul 02
Posts: 1256
Credit: 13,565,513
RAC: 13
Germany
Message 1388835 - Posted: 8 Jul 2013, 13:05:30 UTC

Long time ago there was a special BOINC client made by Crunch3r, that did exactly that processor affinity thingy, unfortunately it was abandoned by him. I used it, until some project (I think it was Einstein) urged me to use a normal stock client. My impression was, the crunching process won from this modification - although not much.
Aloha, Uli

ID: 1388835 · Report as offensive
Profile cov_route
Avatar

Send message
Joined: 13 Sep 12
Posts: 342
Credit: 10,270,618
RAC: 0
Canada
Message 1388848 - Posted: 8 Jul 2013, 13:44:45 UTC

Check this thread

http://setiathome.berkeley.edu/forum_thread.php?id=71057

The updated script is over here.

This is with an ATI GPU. Summary of what I know: Raistmer found some improvement on an AMD APU with MB V6. For my part I find that I don't have to free any cores to run two MB V7 jobs if I set the GPU jobs to a single core. I have a Phenom II.

Increasing priority doesn't seem to help much in my case.

The affinity trick doesn't seem to work with AP and Einstein, I have to free cores for them.

I don't have information about whether or not this works with Nvidia.

This approach is not common. As far as I know I'm the only one doing this.

Here is what my system looks like with all cores loaded and 2 MB GPU jobs. It runs like this 24/7:

ID: 1388848 · Report as offensive
Alinator
Volunteer tester

Send message
Joined: 19 Apr 05
Posts: 4178
Credit: 4,647,982
RAC: 0
United States
Message 1388864 - Posted: 8 Jul 2013, 15:09:37 UTC - in response to Message 1388830.  

I guess it really comes down to a couple of things.

First is what you use the machine for. I suppose on a dedicated crunch box where maximum task throughput is paramount at the expense of everything else then it might be worth it. If it's on your daily driver where you like do get your work done efficiently while crunching at the same time in the background, I'm not so sure.

Second would be if you're on an Intel or AMD platform. If you're on an HT enabled Intel, then I can see where affinity might be of use. On AMD's, even Bulldozer/Piledriver's, I haven't seen any advantage to using it, at least with Win 7 or higher (I don't do Vista, aka ME II). Might be a different story on Linux though.
ID: 1388864 · Report as offensive
EdwardPF
Volunteer tester

Send message
Joined: 26 Jul 99
Posts: 389
Credit: 236,772,605
RAC: 374
United States
Message 1389042 - Posted: 9 Jul 2013, 0:30:51 UTC - in response to Message 1388793.  
Last modified: 9 Jul 2013, 0:33:11 UTC

just for fun ... here is a windows ".bat" file

REM
REM a windows batch file to run on 4 cpu's 0,2,4,6
REM on 1 GPU with cpu support from 1,3
REM on 1 GPU with cpu support from 1,3,5
REM on 1 GPU with cpu support from 5,7
REM
start /affinity 01 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31416 --dir C:\BOINC_test_data_1 --detach
REM start /affinity 02 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31417 --dir C:\BOINC_test_data_2 --allow_multiple_clients --detach
start /affinity 04 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31418 --dir C:\BOINC_test_data_3 --allow_multiple_clients --detach
rem start /affinity 08 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31419 --dir C:\BOINC_test_data_4 --allow_multiple_clients --detach
start /affinity 10 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31420 --dir C:\BOINC_test_data_5 --allow_multiple_clients --detach
rem start /affinity 20 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31421 --dir C:\BOINC_test_data_6 --allow_multiple_clients --detach
start /affinity 40 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31422 --dir C:\BOINC_test_data_7 --allow_multiple_clients --detach
rem start /affinity 80 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31423 --dir C:\BOINC_test_data_8 --allow_multiple_clients --detach
start /affinity 0A C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31424 --dir C:\BOINC_test_GPU_1 --allow_multiple_clients --detach
start /affinity 2A C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31425 --dir C:\BOINC_test_GPU_2 --allow_multiple_clients --detach
start /affinity A0 C:\BOINC_test_programs\boinc.exe --gui_rpc_port 31426 --dir C:\BOINC_test_GPU_3 --allow_multiple_clients --detach
cd C:\BOINC_test_data_1
start C:\BOINC_test_programs\boincmgr.exe /s
rem
cd ..\users\xxxxx\boinc_starts
rem


I "think" it helps performance BUT it does help keep track of whar WU is doing what to your computer by watching task manager etc.

Ed F
ID: 1389042 · Report as offensive
Keith White
Avatar

Send message
Joined: 29 May 99
Posts: 392
Credit: 13,035,233
RAC: 22
United States
Message 1389074 - Posted: 9 Jul 2013, 4:11:53 UTC

I used siv (off the BOINC page) to automatically set core affinity for all the CPU tasks back when my GPU task suffered if core 0 had any significant load on it (it may have been because Lunatics at the time had limited affinity of my GPU task to cores 0 or 1, now the latest allows it to run on all cores). I don't use it anymore since the rollout for V7 and it doesn't seem to help/hurt application speed.

But that's my CPU with it's cache size and layout as well as it's memory prefetcher may not make a noticeable difference in performance. YMMV.
"Life is just nature's way of keeping meat fresh." - The Doctor
ID: 1389074 · Report as offensive
gs
Volunteer tester
Avatar

Send message
Joined: 18 May 99
Posts: 45
Credit: 5,412,660
RAC: 8
Germany
Message 1389180 - Posted: 9 Jul 2013, 10:21:53 UTC - in response to Message 1389042.  

just for fun ... here is a windows ".bat" file

Thanks, Ed, interesting piece of software indeed. ;-)
ID: 1389180 · Report as offensive
gs
Volunteer tester
Avatar

Send message
Joined: 18 May 99
Posts: 45
Credit: 5,412,660
RAC: 8
Germany
Message 1389181 - Posted: 9 Jul 2013, 10:23:48 UTC - in response to Message 1388799.  

Is there an advantage of setting an affinity for tasks to cpu cores? Would setting an affinity of a cpu core to support cuda tasks speed up th calculations?

No, but setting the app's priority to 'normal', 'abovenormal', or 'high' should, by using the supplied mbcuda.cfg file.
Claggy


Thanks, Claggy, I changed the file to abovenormal.
ID: 1389181 · Report as offensive

Message boards : Number crunching : Impact of setting core affinity


 
©2024 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.