File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
actions/run-tests/benchmark
scripts/benchmarks/benches Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -79,14 +79,14 @@ runs:
7979 shell : bash
8080 run : |
8181 # Compute the core range for the first NUMA node; second node is used by
82- # UMF. Skip the first 4 cores as the kernel is likely to schedule more
82+ # UMF. Skip the first 3 cores as the kernel is likely to schedule more
8383 # work on these.
8484 CORES="$(lscpu | awk '
8585 /NUMA node0 CPU|On-line CPU/ {line=$0}
8686 END {
8787 split(line, a, " ")
8888 split(a[4], b, ",")
89- sub(/^0/, "4 ", b[1])
89+ sub(/^0/, "3 ", b[1])
9090 print b[1]
9191 }')"
9292 echo "CPU core range to use: $CORES"
Original file line number Diff line number Diff line change 1010from enum import Enum
1111from itertools import product
1212from pathlib import Path
13+ from psutil import Process
1314
1415from git_project import GitProject
1516from options import options
@@ -417,6 +418,24 @@ def run(
417418 command += self .bin_args (run_trace )
418419 env_vars .update (self .extra_env_vars ())
419420
421+ # Pin compute benchmarks to a CPU cores set to ensure consistent results
422+ # and non-zero CPU count measurements (e.g. avoid E-cores). 4 max freq cores
423+ # are pinned by default to satisfy multiple threads benchmarks.
424+
425+ available_cores = Process ().cpu_affinity ()
426+ # Get 4 cores with the highest available frequency.
427+ core_frequencies = []
428+ for core in available_cores :
429+ with open (
430+ f"/sys/devices/system/cpu/cpu{ core } /cpufreq/cpuinfo_max_freq"
431+ ) as f :
432+ freq = int (f .read ().strip ())
433+ core_frequencies .append ((core , freq ))
434+ core_frequencies .sort (key = lambda x : x [1 ], reverse = True )
435+ available_cores = [core for core , _ in core_frequencies [:4 ]]
436+
437+ command = ["taskset" , "-c" ] + [str (core ) for core in available_cores ] + command
438+
420439 result = self .run_bench (
421440 command , env_vars , run_trace = run_trace , force_trace = force_trace
422441 )
You can’t perform that action at this time.
0 commit comments