Ryzen 7950x has two CCDs, that is two groups of 8 cores (16 virtual cores) each.
Usually one CCD can run faster than the other: in my system I set CCD0 to run at 5,3GHz max, under load, and CCD1 to run at max 4.8 GHz, under load. I know: I could have done better, findind the max ceiling for every core: however that would have required much more time of testing and fine tuning, which I don't have, so this compromise is good enough for me, at least for now.
Virtual cores 0-7 and 16-23 belong to CCD0, the fast one, whereas core 8-15 and 24-31 belong to CCD1 (the slow one).
Since I wanna fold both on my GPUs and CPU, I've followed this rules:
1) leave some slow virtual cores free to the system, but link the f@h processes feeding the GPUs (usually one for GPU, so 2 in my situation) to this cores. At the end, I left 4 cores free: two of them are used to feed the GPUs, and two are actually free;
2) never let the OS scheduler to spread processes belonging to the same WU to different CCDs: to reduce the use of the Infinity Fabric link, to optimize the use of caches, to give same speed cores to every WU;
3) since CPU folding is based on GROMACS, prefer resource groups made of a multiple of 4, or 6, or 8 cores to let it comfortably spread the work among them.
What did I do?
I created four resouce groups: one for each GPU (with no CPU cores); one made of 16 virtual CPU cores; one of 8 CPU cores.
Then I created a bash script to set the affinity of the meaningful processes to the cores. Since I use to crunch a bit on BOINC, too, I also linked BOINC processes to 4 slow cores. To be clear: the resource group made of 16 cores has been linked to the 16 fast virtual cores, the resource group made of 8 cores has been linked to the 8 slow virtual cores, the BOINC processes to other 4 slow cores, and the (usually 2) f@h processes feeding my 2 GPUs to the remaining 4 slow cores.
Here is the script:
Code: Select all
#!/bin/bash
export SET_FAH_16="0-7,16-23"
export SET_FAH_8="8-11,24-27"
export SET_BOINC="12-13,28-29"
export SET_GPU_SYS="14-15,30-31"
while true; do
# 1. MANAGING FOLDING@HOME CPU (FahCore_a8)
pgrep -f "FahCore_a8" | while read -r pid; do
[ -z "$pid" ] && continue
threads=$(ps -o nlwp= -p "$pid" | tr -d ' ')
if [ "$threads" -gt 15 ]; then
taskset -acp "$SET_FAH_16" "$pid" >/dev/null 2>&1
elif [ "$threads" -gt 6 ] && [ "$threads" -le 14 ]; then
taskset -acp "$SET_FAH_8" "$pid" >/dev/null 2>&1
fi
done
# 2. MANAGING BOINC
pgrep -u boinc | xargs -r -I % taskset -acp "$SET_BOINC" % >/dev/null 2>&1
# 3. MANAGING FOLDING@HOME GPUs (FahCore_2*)
pgrep -f "FahCore_2" | xargs -r -I % taskset -acp "$SET_GPU_SYS" % >/dev/null 2>&1
sleep 60
doneit's possible to run it with cron every minute (omitting the "sleep 60" command), but i chose to run it as a service.
I created the file /etc/systemd/system/fah-affinity.service with this inside:
Code: Select all
[Unit]
Description=F@H and BOINC affinity manager
After=network.target
[Service]
Type=simple
# Run as root to manage PIDs
ExecStart=/usr/local/bin/fah-affinity.sh
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetThen I enabled and started the service:
Code: Select all
$ sudo systemctl daemon-reload && sudo systemctl enable fah-affinity.service && sudo systemctl start fah-affinity.serviceOf course I post this stuff only as a hint, and everybody should eventually configure it according to his/her hardware, system and preferences. HTH.
--
Bye, Lem