diff options
author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 00:08:12 -0400 |
---|---|---|
committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 00:08:12 -0400 |
commit | 3b0aa125061b362b23ecf66afe8319e3a268c874 (patch) | |
tree | 9323b85d5a3a0d14e33a28caa9ffc3b8ce7225be /all_pairs | |
parent | edb491490ccd0cae4bd28ca9c9a7e095a47c749b (diff) |
Add pair benchmarking and isolation specification into run_bench.sh
This allows `run_bench.sh` to replace all previous general paired
benchmarking scripts. See `run_everything.sh` for an example of how
to use the new script.
This also fixes two critical bugs present in the old scripts:
1. The cpus_list was incorrectly set for resctrl when running
synchronous pair timing with L2+L3 isolation (i). Each write
to that file replaces the previous contents, and it was previously
written once for each core. This prevented the entire 1st core
from using any L3 cache.
2. The competing task list was indexed improperly in the asynchronous
pair timing script. This caused the competing task to always be
identical to the task being profiled.
These issues combine to imply that in the rejected RTSS'20 paper:
- All Level-C SMT timing data is suspect
- Level-A and -B SMT timing data with L2+L3 isolation (i) is
wildly optimistic
Diffstat (limited to 'all_pairs')
-rwxr-xr-x | all_pairs/run_all_pairs.sh | 168 | ||||
-rwxr-xr-x | all_pairs/run_all_pairs_L3_ONLY.sh | 170 | ||||
-rw-r--r-- | all_pairs/tacleNames.txt | 18 |
3 files changed, 11 insertions, 345 deletions
diff --git a/all_pairs/run_all_pairs.sh b/all_pairs/run_all_pairs.sh deleted file mode 100755 index 2260216..0000000 --- a/all_pairs/run_all_pairs.sh +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | firstCore=$1 | ||
4 | secondCore=$2 | ||
5 | maxJobs=$3 | ||
6 | userRunID=$4 | ||
7 | tacleNames=tacleNames.txt | ||
8 | |||
9 | if [ $# -lt 4 ]; then | ||
10 | echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]" | ||
11 | exit | ||
12 | fi | ||
13 | |||
14 | if [ $# -gt 4 ]; then | ||
15 | echo "Using alternate list of TACLe benchmarks from $5" | ||
16 | tacleNames=$5 | ||
17 | fi | ||
18 | |||
19 | if [ "$EUID" -ne 0 ] | ||
20 | then | ||
21 | echo "You need to be root to enable interrupt isolation and real-time execution!" | ||
22 | exit | ||
23 | fi | ||
24 | |||
25 | echo "Making sure that binaries are up to date..." | ||
26 | while read i; do | ||
27 | make bin/$i | ||
28 | done < $tacleNames | ||
29 | echo "Done. Disabling real-time throttling..." | ||
30 | |||
31 | # Turn off rt throttling | ||
32 | echo -1 > /proc/sys/kernel/sched_rt_runtime_us | ||
33 | echo "Done. Redirecting all interrupts to core 0..." | ||
34 | |||
35 | # Redirect all interrupts to core 0 | ||
36 | i=0 | ||
37 | for IRQ in /proc/irq/* | ||
38 | do | ||
39 | # Skip default_smp_affinity | ||
40 | if [ -d $IRQ ]; then | ||
41 | irqList[$i]=$(cat $IRQ/smp_affinity_list) | ||
42 | echo 0 2> /dev/null > $IRQ/smp_affinity_list | ||
43 | fi | ||
44 | i=$(( $i + 1 )) | ||
45 | done | ||
46 | |||
47 | # Read the names of each benchmark | ||
48 | j=0 | ||
49 | while read i; do | ||
50 | tacleProg[$j]=$i | ||
51 | j=$(( $j + 1 )) | ||
52 | done < $tacleNames | ||
53 | |||
54 | echo "Done. Checking for wbinvd module..." | ||
55 | if [[ ! -f "/proc/wbinvd" ]]; then | ||
56 | echo "ERROR: wbinvd module not loaded. Exiting..." | ||
57 | exit | ||
58 | fi | ||
59 | |||
60 | echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." | ||
61 | echo "performance" > /sys/devices/system/cpu/cpu$firstCore/cpufreq/scaling_governor | ||
62 | echo "performance" > /sys/devices/system/cpu/cpu$secondCore/cpufreq/scaling_governor | ||
63 | |||
64 | # Enable L3 isolation | ||
65 | echo "Done. Enabling L3 isolation..." | ||
66 | mount -t resctrl resctrl /sys/fs/resctrl | ||
67 | mkdir -p /sys/fs/resctrl/benchmarks | ||
68 | echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
69 | echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
70 | # Reset global bandwith control and remove L3 from global | ||
71 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
72 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
73 | # Alloc L3 to benchmark | ||
74 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata | ||
75 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
76 | echo "Done. Verifying configuration with user..." | ||
77 | |||
78 | # Generate file name string | ||
79 | # We append to this as we parse the environment settings | ||
80 | runID=$(date +"%b%d-%H") | ||
81 | |||
82 | # Confirm configuration with user | ||
83 | echo "=== Global Config ===" | ||
84 | cat /sys/fs/resctrl/schemata | ||
85 | echo "=== Core $firstCore and $secondCore Config ===" | ||
86 | cat /sys/fs/resctrl/benchmarks/schemata | ||
87 | if [[ $6 == "--contend" ]]; then | ||
88 | if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then | ||
89 | echo "ERROR: thrasher binary not fonud. Exiting..." | ||
90 | exit | ||
91 | fi | ||
92 | echo "Will run 6 contending tasks" | ||
93 | runID=$runID-c | ||
94 | else | ||
95 | runID=$runID-xc | ||
96 | fi | ||
97 | if uname -a | grep -q "mc2"; then | ||
98 | echo "MC^2 Autodetected. Cache coloring will be enabled." | ||
99 | runID=$runID-i | ||
100 | else | ||
101 | echo "MC^2 not detected. Cache coloring will be DISABLED." | ||
102 | runID=$runID-xi | ||
103 | fi | ||
104 | if pwd | grep -qi dis; then | ||
105 | echo "Autodetected DIS. Will use script-level looping." | ||
106 | fi | ||
107 | echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" | ||
108 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
109 | read | ||
110 | |||
111 | # Start contending tasks | ||
112 | if [[ $6 == "--contend" ]]; then | ||
113 | echo "Done. Starting 6 contending tasks..." | ||
114 | # Run two contending tasks on each other CCX | ||
115 | taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & | ||
116 | taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & | ||
117 | taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & | ||
118 | taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & | ||
119 | taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & | ||
120 | taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & | ||
121 | fi | ||
122 | sleep 1 # Wait for contending tasks to start | ||
123 | echo "Done. Beginning benchmarks..." | ||
124 | |||
125 | num_tests=$(wc -l < $tacleNames) | ||
126 | for (( i = 0; i < $num_tests ; i++ )) | ||
127 | do | ||
128 | for (( j = $i; j < $num_tests ; j++ )) #loop through programs | ||
129 | do | ||
130 | # If using DIS, we have to iterate in the script as DIS won't do it for us | ||
131 | pwd | grep -qi dis | ||
132 | iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") | ||
133 | for ((k=0;k<=iters;k++)); do | ||
134 | # Autodetect MC^2 | ||
135 | if uname -a | grep -q "mc2"; then | ||
136 | chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!; | ||
137 | chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!; | ||
138 | else | ||
139 | chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!; | ||
140 | chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!; | ||
141 | fi | ||
142 | wait $PID1 $PID2 | ||
143 | done | ||
144 | echo ${tacleProg[$i]} ${tacleProg[$j]} | ||
145 | done | ||
146 | echo COMPLETE: ${tacleProg[$i]} | ||
147 | done | ||
148 | |||
149 | # End contending tasks | ||
150 | if [[ $6 == "--contend" ]]; then | ||
151 | killall thrasher | ||
152 | fi | ||
153 | |||
154 | # Remove semaphores from system | ||
155 | # Leaving them won't hurt these tests, but would be messy and is bad practice | ||
156 | # TODO: Do this directly in the benchmarks. They should clean up after themselves | ||
157 | ./bin/cleanupSemaphores | ||
158 | |||
159 | # Put smp_affinty back the way it was | ||
160 | i=0 | ||
161 | for IRQ in /proc/irq/* | ||
162 | do | ||
163 | if [ -d $IRQ ]; then | ||
164 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
165 | fi | ||
166 | i=$(( $i + 1 )) | ||
167 | done | ||
168 | |||
diff --git a/all_pairs/run_all_pairs_L3_ONLY.sh b/all_pairs/run_all_pairs_L3_ONLY.sh deleted file mode 100755 index 8ed5eeb..0000000 --- a/all_pairs/run_all_pairs_L3_ONLY.sh +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | firstCore=$1 | ||
4 | secondCore=$2 | ||
5 | maxJobs=$3 | ||
6 | userRunID=$4 | ||
7 | tacleNames=tacleNames.txt | ||
8 | |||
9 | if [ $# -lt 4 ]; then | ||
10 | echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]" | ||
11 | exit | ||
12 | fi | ||
13 | |||
14 | if [ $# -gt 4 ]; then | ||
15 | echo "Using alternate list of TACLe benchmarks from $5" | ||
16 | tacleNames=$5 | ||
17 | fi | ||
18 | |||
19 | if [ "$EUID" -ne 0 ] | ||
20 | then | ||
21 | echo "You need to be root to enable interrupt isolation and real-time execution!" | ||
22 | exit | ||
23 | fi | ||
24 | |||
25 | echo "Making sure that binaries are up to date..." | ||
26 | while read i; do | ||
27 | make bin/$i | ||
28 | done < $tacleNames | ||
29 | echo "Done. Disabling real-time throttling..." | ||
30 | |||
31 | # Turn off rt throttling | ||
32 | echo -1 > /proc/sys/kernel/sched_rt_runtime_us | ||
33 | echo "Done. Redirecting all interrupts to core 0..." | ||
34 | |||
35 | # Redirect all interrupts to core 0 | ||
36 | i=0 | ||
37 | for IRQ in /proc/irq/* | ||
38 | do | ||
39 | # Skip default_smp_affinity | ||
40 | if [ -d $IRQ ]; then | ||
41 | irqList[$i]=$(cat $IRQ/smp_affinity_list) | ||
42 | echo 0 2> /dev/null > $IRQ/smp_affinity_list | ||
43 | fi | ||
44 | i=$(( $i + 1 )) | ||
45 | done | ||
46 | |||
47 | # Read the names of each benchmark | ||
48 | j=0 | ||
49 | while read i; do | ||
50 | tacleProg[$j]=$i | ||
51 | j=$(( $j + 1 )) | ||
52 | done < $tacleNames | ||
53 | |||
54 | echo "Done. Checking for wbinvd module..." | ||
55 | if [[ ! -f "/proc/wbinvd" ]]; then | ||
56 | echo "ERROR: wbinvd module not loaded. Exiting..." | ||
57 | exit | ||
58 | fi | ||
59 | |||
60 | # Enable L3 isolation | ||
61 | echo "Done. Enabling L3 isolation..." | ||
62 | mount -t resctrl resctrl /sys/fs/resctrl | ||
63 | mkdir -p /sys/fs/resctrl/benchmarks | ||
64 | mkdir -p /sys/fs/resctrl/benchmarks2 | ||
65 | echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
66 | echo $secondCore > /sys/fs/resctrl/benchmarks2/cpus_list | ||
67 | # Reset global bandwith control and remove L3 from global | ||
68 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
69 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
70 | # Alloc half L3 to benchmark | ||
71 | echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata | ||
72 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
73 | # Alloc other half L3 to benchmark2 | ||
74 | echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata | ||
75 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks2/schemata | ||
76 | echo "Done. Verifying configuration with user..." | ||
77 | |||
78 | # Generate file name string | ||
79 | # We append to this as we parse the environment settings | ||
80 | runID=$(date +"%b%d-%H") | ||
81 | |||
82 | # Confirm configuration with user | ||
83 | echo "=== Global Config ===" | ||
84 | cat /sys/fs/resctrl/schemata | ||
85 | echo "=== Core $firstCore Config ===" | ||
86 | cat /sys/fs/resctrl/benchmarks/schemata | ||
87 | echo "=== Core $secondCore Config ===" | ||
88 | cat /sys/fs/resctrl/benchmarks2/schemata | ||
89 | if [[ $6 == "--contend" ]]; then | ||
90 | if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then | ||
91 | echo "ERROR: thrasher binary not found. Exiting..." | ||
92 | exit | ||
93 | fi | ||
94 | echo "Will run 6 contending tasks" | ||
95 | runID=$runID-c | ||
96 | else | ||
97 | runID=$runID-xc | ||
98 | fi | ||
99 | if uname -a | grep -q "mc2"; then | ||
100 | echo "MC^2 Autodetected. Not supported by this script!." | ||
101 | exit | ||
102 | else | ||
103 | echo "MC^2 not detected. Cache coloring will be enabled in the L3 only.." | ||
104 | runID=$runID-i3 | ||
105 | fi | ||
106 | if pwd | grep -qi dis; then | ||
107 | echo "Autodetected DIS. Will use script-level looping." | ||
108 | fi | ||
109 | echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" | ||
110 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
111 | read | ||
112 | |||
113 | # Start contending tasks | ||
114 | if [[ $6 == "--contend" ]]; then | ||
115 | echo "Done. Starting 6 contending tasks..." | ||
116 | # Run two contending tasks on each other CCX | ||
117 | taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & | ||
118 | taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & | ||
119 | taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & | ||
120 | taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & | ||
121 | taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & | ||
122 | taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & | ||
123 | fi | ||
124 | sleep 1 # Wait for contending tasks to start | ||
125 | echo "Done. Beginning benchmarks..." | ||
126 | |||
127 | num_tests=$(wc -l < $tacleNames) | ||
128 | for (( i = 0; i < $num_tests ; i++ )) | ||
129 | do | ||
130 | for (( j = $i; j < $num_tests ; j++ )) #loop through programs | ||
131 | do | ||
132 | # If using DIS, we have to iterate in the script as DIS won't do it for us | ||
133 | pwd | grep -qi dis | ||
134 | iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") | ||
135 | for ((k=0;k<=iters;k++)); do | ||
136 | # Autodetect MC^2 | ||
137 | if uname -a | grep -q "mc2"; then | ||
138 | chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!; | ||
139 | chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!; | ||
140 | else | ||
141 | chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!; | ||
142 | chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!; | ||
143 | fi | ||
144 | wait $PID1 $PID2 | ||
145 | done | ||
146 | echo ${tacleProg[$i]} ${tacleProg[$j]} | ||
147 | done | ||
148 | echo COMPLETE: ${tacleProg[$i]} | ||
149 | done | ||
150 | |||
151 | # End contending tasks | ||
152 | if [[ $6 == "--contend" ]]; then | ||
153 | killall thrasher | ||
154 | fi | ||
155 | |||
156 | # Remove semaphores from system | ||
157 | # Leaving them won't hurt these tests, but would be messy and is bad practice | ||
158 | # TODO: Do this directly in the benchmarks. They should clean up after themselves | ||
159 | ./bin/cleanupSemaphores | ||
160 | |||
161 | # Put smp_affinty back the way it was | ||
162 | i=0 | ||
163 | for IRQ in /proc/irq/* | ||
164 | do | ||
165 | if [ -d $IRQ ]; then | ||
166 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
167 | fi | ||
168 | i=$(( $i + 1 )) | ||
169 | done | ||
170 | |||
diff --git a/all_pairs/tacleNames.txt b/all_pairs/tacleNames.txt index 8f4845a..2e02966 100644 --- a/all_pairs/tacleNames.txt +++ b/all_pairs/tacleNames.txt | |||
@@ -1,19 +1,23 @@ | |||
1 | petrinet | 1 | petrinet |
2 | ndes | ||
3 | statemate | 2 | statemate |
4 | adpcm_dec | 3 | ndes |
4 | h264_dec | ||
5 | huff_dec | ||
5 | cjpeg_wrbmp | 6 | cjpeg_wrbmp |
7 | fmref | ||
8 | audiobeam | ||
9 | adpcm_dec | ||
6 | adpcm_enc | 10 | adpcm_enc |
11 | g723_enc | ||
12 | huff_enc | ||
13 | gsm_dec | ||
7 | cjpeg_transupp | 14 | cjpeg_transupp |
8 | dijkstra | ||
9 | epic | 15 | epic |
10 | fmref | 16 | anagram |
11 | gsm_dec | ||
12 | h264_dec | ||
13 | huff_enc | ||
14 | rijndael_enc | 17 | rijndael_enc |
15 | rijndael_dec | 18 | rijndael_dec |
16 | gsm_enc | 19 | gsm_enc |
17 | susan | 20 | susan |
21 | dijkstra | ||
18 | ammunition | 22 | ammunition |
19 | mpeg2 | 23 | mpeg2 |