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

If you're new to FAH and need help getting started or you have very basic questions, start here.

Moderators: Site Moderators, FAHC Science Team

arisu
Posts: 596
Joined: Mon Feb 24, 2025 11:11 pm

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

Post 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
Last edited by arisu on Thu Feb 26, 2026 11:44 am, edited 1 time in total.
muziqaz
Posts: 2455
Joined: Sun Dec 16, 2007 6:22 pm
Hardware configuration: 9950x, 9950x3d, 7950x3d, 5950x, 5800x3d
7900xtx, RX9070, Radeon 7, 5700xt, 6900xt, RX550, Intel B580
Location: London
Contact:

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

Post by muziqaz »

Thus my suggestion to not mess about with affinity
FAH Omega tester
Image
arisu
Posts: 596
Joined: Mon Feb 24, 2025 11:11 pm

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

Post 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!
Post Reply