CPU affinity mask, pretty please?..

Message boards : BOINC client : CPU affinity mask, pretty please?..
Message board moderation

To post messages, you must log in.


Send message
Joined: 21 Apr 15
Posts: 4
Message 61802 - Posted: 21 Apr 2015, 21:17:05 UTC


I've been running boinc for many many years, but I've ran into a problem that will probably make me give it up.

Here is the problem:
I'm running BOINC on a Core 2 Quad, which has 2 cores, due to HT it shows up as 4 cpus. The issue is that Core0 overheats relatively easy, while Core1 remains pretty low on temperature; quite often it's a difference of >80C vs 60C. I would like to make BOINC use only Core1 (CPU2+CPU3), but leave Core0 (CPU0+CPU1) untouched. If I set the percentage of cores to use to 50%, boinc just shuffles the tasks around and uses all cores at around 50%, for some reason dumping relatively more work on Core0, making the problem worse. If I reduce the cpu time, again, all cores get used, but they alternate between 0% and 100% at a fixed frequency, not solving the problem, and this causes annoying glitches at foreground software I happen to be using at the time. I could set the cpu affinity for every task BOINC spawns to only use the CPU2+CPU3 manually through the task manager, but doing this every time for every task is pretty far from convenient...

The question is:
Is there any way to force BOINC to use only specific cores for tasks (in my case, core 1 or CPU2+CPU3)?
Any hacky way would do.

I've googled my brains out at this point trying to find an anwer. All I happen to find are tickets asking for CPU affinity features getting closed with responces like "CPU affinity was shown not to help". Which leaves me puzzled. Help with what? I'm not trying to squeeze more performance here, I'm trying to keep my machine usable while running BOINC at the same time, please...

I'd be very thankful for any responces. :>
ID: 61802 · Report as offensive
Richard Haselgrove
Volunteer tester
Help desk expert

Send message
Joined: 5 Oct 06
Posts: 4025
United Kingdom
Message 61806 - Posted: 21 Apr 2015, 22:26:11 UTC - in response to Message 61802.  

BOINC doesn't do it, and probably never will do it. But Process Lasso can (I think).

(BTW, I'm pretty sure my Core 2 Quads - two Q6600 and a Q9300 - are true 4-core chips, no HT involved)
ID: 61806 · Report as offensive
Profile Richie

Send message
Joined: 2 Jul 14
Posts: 183
Message 61807 - Posted: 21 Apr 2015, 23:14:40 UTC - in response to Message 61802.  

a difference of >80C vs 60C

It is normal to have some cores running a little bit warmer than others, but that much difference made me think there might be some problem with having a proper thermal paste layer in all areas between CPU and heat sink.

(Also, some thermal paste products really are better than others. Much lower temperatures overall can be achieved by using a good paste and a good CPU-cooler... but if you have good cooling setup already, then there's nothing to consider).
ID: 61807 · Report as offensive

Send message
Joined: 21 Apr 15
Posts: 4
Message 61808 - Posted: 21 Apr 2015, 23:37:47 UTC - in response to Message 61806.  

Oh, thank you very much! :>

Sorry, silly me. I assumed my Q9400 was 2 cores with HTs mostly because the software i was monitoring it with reported it as such, showing two temperatures for Core0 and Core1. Yes, checked its datasheet - apparently it's 4 cores after all. I'm guessing it just has two temperature sensors.

I will look into Process Lasso more if my current haphazard solution backfires. Thank you very much! Wish I had heard of it earlier... :)

During the last couple of hours I came up with this powershell script that finds all processes whose parent process is the Boinc process, and then sets their affinity to CPUs 2+3 (1*0 + 2*0 + 4*1 + 8*1 = 12). In theory it should cover whatever processes Boinc or several Boincs spawn:

$boincids = get-process "boinc" -ErrorAction SilentlyContinue | % { $_.id }

$boincids | % {
	$fstr = "ParentProcessID=" + $_
	gwmi win32_process -Filter $fstr | % {
		$proc = (get-process -Id $_.ProcessID)
		if ($proc.ProcessorAffinity -ne 12) {$proc.ProcessorAffinity = 12}

Then just scheduled it to run every 5 minutes using task scheduler:
as Action, it runs Powershell with command line arguments: -File C:\whatever\path\thisScript.ps1
(Making the task run under SYSTEM account hides the command prompt which would popup otherwise.)
(Powershell's execution policy should be set to allow running scripts for this to work.)

It's a pretty clunky solution, but so far it's working well. Perhaps someone will find it useful.
ID: 61808 · Report as offensive

Send message
Joined: 21 Apr 15
Posts: 4
Message 61809 - Posted: 21 Apr 2015, 23:49:22 UTC - in response to Message 61807.  

Ah yes, that's what I investigated initially, but reapplying the paste didn't seem to affect it much. After some experimentation, with what makes it heat up more/less and what results in stability problems, I came to the conclusion that keeping CPU0+1 at less load solved it.

The cooling setup isn't particulary good, but this machine is pretty old and is about to be replaced, so getting a new cooler is something i'd like to avoid.
ID: 61809 · Report as offensive

Send message
Joined: 6 Jul 10
Posts: 585
Message 61817 - Posted: 22 Apr 2015, 17:41:34 UTC - in response to Message 61809.  
Last modified: 22 Apr 2015, 17:42:38 UTC

Process Lasso does an excellent job of maintain application mask associated affinities. Do not forget to set BOINC to 75% of processors [equals 3 of 4 cores], as PL will else start assigning 2 process to 1 core/thread. BOINC could not care less... it just knows it's dealing with a quad, so will launch 4 tasks.
Coelum Non Animum Mutant, Qui Trans Mare Currunt
ID: 61817 · Report as offensive

Send message
Joined: 21 Apr 15
Posts: 4
Message 62073 - Posted: 6 May 2015, 20:02:09 UTC - in response to Message 61817.  

(Sorry for the late reply.)
Oh yes, I forgot to do that, so it was running 4 tasks on 2 cores. Now set it to 50% and it's running 2 tasks on 2 cores, properly. I'm a little surprised, since when it was using 4 cores it would just limit cpu usage to 50% across all cores, instead of switching to less tasks or cores. Thank you for the tip! :>

(Still not using Process Lasso as my little script workaround solved the issue and didn't cause any problems so far. Deffinitely bookmarked it, though. Thank you!)
ID: 62073 · Report as offensive

Message boards : BOINC client : CPU affinity mask, pretty please?..

Copyright © 2020 University of California. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.