From a338d68b02f6adce29b8b161974b67a1dbb37513 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 11 Mar 2021 18:03:17 -0500 Subject: Benchmarks: Automatically detect which cores to run contenders on --- dis/run_pair_convexity.sh | 21 +++++++++++++-------- run_bench.sh | 21 +++++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/dis/run_pair_convexity.sh b/dis/run_pair_convexity.sh index bdd25c8..6ef244b 100644 --- a/dis/run_pair_convexity.sh +++ b/dis/run_pair_convexity.sh @@ -121,15 +121,20 @@ echo "Press enter to confirm environment, Ctrl-C to exit..." read # Start contending tasks +# If we're on CPU 15, this would launch contenders on CPUs 0, 1, 4, 5, 8, and 9 if [[ $8 == "--contend" ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 ../thrasher/thrasher & - taskset -c 2 ../thrasher/thrasher & - taskset -c 5 ../thrasher/thrasher & - taskset -c 6 ../thrasher/thrasher & - taskset -c 9 ../thrasher/thrasher & - taskset -c 10 ../thrasher/thrasher & + echo "Done. Starting contending tasks on other CCXes..." + num_phys_cores=$(grep -m 1 "cpu cores" /proc/cpuinfo | cut -d " " -f 3) + # For each set of 4 cores (CCX) + for (( i = 0; i < ${num_phys_cores} ; i += 4 )); do + # Don't run contending tasks on the CCX we're benchmarking + if (($firstCore / 4 == $i / 4)); then + continue + fi + # Otherwise launch on the other two + taskset -c $i ../thrasher/thrasher & + taskset -c $(($i+1)) ../thrasher/thrasher & + done fi sleep 1 # Wait for contending tasks to start echo "Done. Beginning benchmarks..." diff --git a/run_bench.sh b/run_bench.sh index cf94719..6e4abb5 100755 --- a/run_bench.sh +++ b/run_bench.sh @@ -304,15 +304,20 @@ echo "Press enter to confirm environment, Ctrl-C to exit..." read # Start contending tasks +# If we're on CPU 15, this would launch contenders on CPUs 0, 1, 4, 5, 8, and 9 if [[ -v contend ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 ../thrasher/thrasher & - taskset -c 2 ../thrasher/thrasher & - taskset -c 5 ../thrasher/thrasher & - taskset -c 6 ../thrasher/thrasher & - taskset -c 9 ../thrasher/thrasher & - taskset -c 10 ../thrasher/thrasher & + echo "Done. Starting contending tasks on other CCXes..." + num_phys_cores=$(grep -m 1 "cpu cores" /proc/cpuinfo | cut -d " " -f 3) + # For each set of 4 cores (CCX) + for (( i = 0; i < ${num_phys_cores} ; i += 4 )); do + # Don't run contending tasks on the CCX we're benchmarking + if (($core / 4 == $i / 4)); then + continue + fi + # Otherwise launch on the other two + taskset -c $i ../thrasher/thrasher & + taskset -c $(($i+1)) ../thrasher/thrasher & + done fi sleep 1 # Wait for contending tasks to start echo "Done. Beginning benchmarks..." -- cgit v1.2.2