Page 2 of 2

Re: Setting affinity to maximize efficiency on an AMD cpu with Linux: a "case of study"

Posted: Thu Feb 26, 2026 11:28 am
by arisu
muziqaz wrote: Thu Feb 05, 2026 9:34 am Few percent is margin of error. Not worth potentially messing up stability.
It is always advised to leave things as they are and let Linux scheduler do it's job. Especially when you are doing mission critical workloads. I am certain the people who maintain the scheduler side of things have much better expertise of what is optimised or not.
GROMACS actually recommends to pin CPUs like that. The scheduler is focused on latency, not throughput (although you could help it a little by marking the processes SCHED_BATCH). I get a consistent 5% (sometimes up to 10%) improvement in performance when doing CPU pinning, appropriate interrupt affinity, and offload timer ticks to a bookkeeping processor. On my system with 4 Zen 5 cores and 12 Zen 5c cores, CPU pinning actually improves performance by about 60% (for core a8, not a9, because a9 can actually load balance on heterogeneous cores), but that's just because keeping folding off of "efficiency" cores is a good thing. :)

GROMACS also has a built-in ability to pin threads and it is usually on by default, but FAH overrides that and turns it off, presumably because it could cause issues with slowing down people's computers by preventing the scheduler from shuffling folding threads around (which would slightly hurt folding performance but would improve system responsiveness).

Generally-speaking, you'll get very small to small improvements in performance by doing CPU pinning on non-hybrid systems (if not oversubscribed), but you risk other stuff like browsing getting a little bit slower. If you have experience in HPC I'd recommend doing that, otherwise don't do it because it can make life frustrating when your other apps start lagging.

Handling GPU folding at the same time as CPU folding is a little more tricky, especially for Nvidia. I wrote a bit about that here, but it's one of those big YMMV things and depends on a few different factors: viewtopic.php?p=369459

Re: Setting affinity to maximize efficiency on an AMD cpu with Linux: a "case of study"

Posted: Thu Feb 26, 2026 11:43 am
by muziqaz
Thus my suggestion to not mess about with affinity

Re: Setting affinity to maximize efficiency on an AMD cpu with Linux: a "case of study"

Posted: Thu Feb 26, 2026 11:46 am
by arisu
muziqaz wrote: Thu Feb 26, 2026 11:43 am Thus my suggestion to not mess about with affinity
Agreed. It's fine for a dedicated folding machine or for someone who's willing to risk their browser slowing down a bit, but the average person should not be messing with it. A single person accidentally pinning two threads to one core would undo the performance benefit of 100 people doing it right!