summaryrefslogtreecommitdiffstats
path: root/run_bench.sh
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2020-10-20 13:35:52 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-20 13:41:49 -0400
commit03412b9f841f140b9b7410a1890298e3ac2835db (patch)
tree8417ed7fa548a571ab88f139da666787766740f3 /run_bench.sh
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
TACLe and DIS benchmark fixes
- Use consistent approach to prevent computations from being optimized out in the DIS benchmarks - Don't print results in the DIS benchmarks - Fix a memory corruption in TACLe's "epic" benchmark reflect1() - Fix return codes for all benchmarks - Rename run_baseline.sh to run_bench.sh in preperation for this being the main benchmarking script
Diffstat (limited to 'run_bench.sh')
-rwxr-xr-xrun_bench.sh156
1 files changed, 156 insertions, 0 deletions
diff --git a/run_bench.sh b/run_bench.sh
new file mode 100755
index 0000000..c5b67b6
--- /dev/null
+++ b/run_bench.sh
@@ -0,0 +1,156 @@
1#!/bin/bash
2
3core=$1
4maxJobs=$2
5userRunID=$3
6tacleNames=tacleNames.txt
7
8if [ $# -lt 3 ]; then
9 echo "Usage $0 <core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
10 exit
11fi
12
13if [ $# -gt 3 ]; then
14 echo "Using alternate list of TACLe benchmarks from $4"
15 tacleNames=$4
16fi
17
18if [ "$EUID" -ne 0 ]
19then
20 echo "You need to be root to enable interrupt isolation and real-time execution!"
21 exit
22fi
23
24echo "Making sure that binaries are up to date..."
25while read i; do
26 make bin/$i
27done < $tacleNames
28echo "Done. Disabling real-time throttling..."
29
30# Turn off rt throttling
31echo -1 > /proc/sys/kernel/sched_rt_runtime_us
32echo "Done. Redirecting all interrupts to core 0..."
33
34# Redirect all interrupts to core 0
35i=0
36for IRQ in /proc/irq/*
37do
38 # Skip default_smp_affinity
39 if [ -d $IRQ ]; then
40 irqList[$i]=$(cat $IRQ/smp_affinity_list)
41 echo 0 2> /dev/null > $IRQ/smp_affinity_list
42 fi
43 i=$(( $i + 1 ))
44done
45
46# Read the names of each benchmark
47j=0
48while read i; do
49 tacleProg[$j]=$i
50 j=$(( $j + 1 ))
51done < $tacleNames
52
53echo "Done. Checking for wbinvd module..."
54if [[ ! -f "/proc/wbinvd" ]]; then
55 echo "ERROR: wbinvd module not loaded. Exiting..."
56 exit
57fi
58
59echo "Done. Setting cores $firstCore and $secondCore to 'performance'..."
60echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor
61echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo
62
63# Enable L3 isolation
64echo "Done. Enabling L3 isolation..."
65mount -t resctrl resctrl /sys/fs/resctrl
66mkdir -p /sys/fs/resctrl/benchmarks
67echo $1 > /sys/fs/resctrl/benchmarks/cpus_list
68# Reset global bandwith control and remove L3 from global
69echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
70echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
71# Alloc L3 to benchmark
72echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
73echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
74echo "Done. Verifying configuration with user..."
75
76# Generate file name string
77# We append to this as we parse the environment settings
78runID=$(date +"%b%d-%H")
79
80# Confirm configuration with user
81echo "=== Global Config ==="
82cat /sys/fs/resctrl/schemata
83echo "=== Core $1 Config ==="
84cat /sys/fs/resctrl/benchmarks/schemata
85if [[ $5 == "--contend" ]]; then
86 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
87 echo "ERROR: thrasher binary not fonud. Exiting..."
88 exit
89 fi
90 echo "Will run 6 contending tasks"
91 runID=$runID-c
92else
93 runID=$runID-xc
94fi
95if uname -a | grep -q "mc2"; then
96 echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled."
97 runID=$runID-i
98else
99 echo "MC^2 not detected."
100 runID=$runID-xi
101fi
102if pwd | grep -qi dis; then
103 echo "Autodetected DIS. Will use script-level looping."
104fi
105echo "Results will be saved as $runID-$userRunID.txt"
106echo "Press enter to confirm environment, Ctrl-C to exit..."
107read
108
109# Start contending tasks
110if [[ $5 == "--contend" ]]; then
111 echo "Done. Starting 6 contending tasks..."
112 # Run two contending tasks on each other CCX
113 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
114 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
115 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
116 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
117 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
118 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
119fi
120sleep 1 # Wait for contending tasks to start
121echo "Done. Beginning benchmarks..."
122
123num_tests=$(wc -l < $tacleNames)
124for (( i = 0; i < $num_tests ; i++ ))
125do
126 # If using DIS, we have to iterate in the script as DIS won't do it for us
127 pwd | grep -qi dis
128 iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))")
129 for ((k=0;k<=iters;k++)); do
130 # Check if we're using LITMUS^RT or not
131 if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then
132 ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1
133 else
134 # Interleave memory allocations between all nodes (only 1 node w/out MC^2)
135 chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1
136#chrt -r 97 numactl -m 0 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID-NOINTERLEAVE 1
137 fi
138 done
139 echo COMPLETE: ${tacleProg[$i]}
140done
141
142# End contending tasks
143if [[ $5 == "--contend" ]]; then
144 killall thrasher
145fi
146
147# Put smp_affinty back the way it was
148i=0
149for IRQ in /proc/irq/*
150do
151 if [ -d $IRQ ]; then
152 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
153 fi
154 i=$(( $i + 1 ))
155done
156