- Pin CPU frequency
- CPUs, especially laptops, have turboboost, (thermal) throttling, and powersave
features. Make sure to pin the CPU core frequency low enough that it can be
sustained for long times without throttling.
In my case, the `performance` governor can fix the CPU frequency. The base frequency of my CPU is
2.6GHz
, but I set it slightly lower since I prefer consistency.sudo cpupower frequency-set -g performance sudo cpupower frequency-set -u 1.8GHz sudo cpupower frequency-set -d 1.8GHz
- Pin program to core
- Make sure your program only executes on one core. Do this using e.g.
taskset -c 0 <shell invocation>
When running multiple experiments in parallel, use distincs ids instead of
0
. - Do not use hyper threads
- Never use both hyper threads of a single core. On my 6-CPU machine, thread
i
and threadi+6
share their core, so I only use threads with id0
to5
. - Limit number of CPUs used
- Memory bound programs share resources, even if running on disjoint CPUs. In my
case, using all 6 cores gives a
30%
slowdown compared to only using 1 core at a time (on some specific experiment). Using 3 cores gives only10%
slowdown, which is acceptable. - Use a low job niceness
- At any point in time, multiple jobs need CPU resources. Use a low job
niceness (like
-20
) to give your experiment a higher priority. As an example, input (keyboard) and audio processing usually runs with a low niceness.