summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 00:08:12 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 00:08:12 -0400
commit3b0aa125061b362b23ecf66afe8319e3a268c874 (patch)
tree9323b85d5a3a0d14e33a28caa9ffc3b8ce7225be
parentedb491490ccd0cae4bd28ca9c9a7e095a47c749b (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
-rwxr-xr-xall_pairs/run_all_pairs.sh168
-rwxr-xr-xall_pairs/run_all_pairs_L3_ONLY.sh170
-rw-r--r--all_pairs/tacleNames.txt18
-rwxr-xr-xbaseline/run_baseline_L3_ONLY.sh152
-rw-r--r--baseline/tacleNames.txt18
-rwxr-xr-xrun_all_tacle.sh58
-rwxr-xr-xrun_bench.sh261
-rwxr-xr-xrun_everything.sh21
-rwxr-xr-xrun_tacle_all.sh49
-rwxr-xr-xsmt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh175
-rwxr-xr-xsmt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh161
11 files changed, 284 insertions, 967 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
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4
7tacleNames=tacleNames.txt
8
9if [ $# -lt 4 ]; then
10 echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
11 exit
12fi
13
14if [ $# -gt 4 ]; then
15 echo "Using alternate list of TACLe benchmarks from $5"
16 tacleNames=$5
17fi
18
19if [ "$EUID" -ne 0 ]
20then
21 echo "You need to be root to enable interrupt isolation and real-time execution!"
22 exit
23fi
24
25echo "Making sure that binaries are up to date..."
26while read i; do
27 make bin/$i
28done < $tacleNames
29echo "Done. Disabling real-time throttling..."
30
31# Turn off rt throttling
32echo -1 > /proc/sys/kernel/sched_rt_runtime_us
33echo "Done. Redirecting all interrupts to core 0..."
34
35# Redirect all interrupts to core 0
36i=0
37for IRQ in /proc/irq/*
38do
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 ))
45done
46
47# Read the names of each benchmark
48j=0
49while read i; do
50 tacleProg[$j]=$i
51 j=$(( $j + 1 ))
52done < $tacleNames
53
54echo "Done. Checking for wbinvd module..."
55if [[ ! -f "/proc/wbinvd" ]]; then
56 echo "ERROR: wbinvd module not loaded. Exiting..."
57 exit
58fi
59
60echo "Done. Setting cores $firstCore and $secondCore to 'performance'..."
61echo "performance" > /sys/devices/system/cpu/cpu$firstCore/cpufreq/scaling_governor
62echo "performance" > /sys/devices/system/cpu/cpu$secondCore/cpufreq/scaling_governor
63
64# Enable L3 isolation
65echo "Done. Enabling L3 isolation..."
66mount -t resctrl resctrl /sys/fs/resctrl
67mkdir -p /sys/fs/resctrl/benchmarks
68echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
69echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list
70# Reset global bandwith control and remove L3 from global
71echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
72echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
73# Alloc L3 to benchmark
74echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
75echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
76echo "Done. Verifying configuration with user..."
77
78# Generate file name string
79# We append to this as we parse the environment settings
80runID=$(date +"%b%d-%H")
81
82# Confirm configuration with user
83echo "=== Global Config ==="
84cat /sys/fs/resctrl/schemata
85echo "=== Core $firstCore and $secondCore Config ==="
86cat /sys/fs/resctrl/benchmarks/schemata
87if [[ $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
94else
95 runID=$runID-xc
96fi
97if uname -a | grep -q "mc2"; then
98 echo "MC^2 Autodetected. Cache coloring will be enabled."
99 runID=$runID-i
100else
101 echo "MC^2 not detected. Cache coloring will be DISABLED."
102 runID=$runID-xi
103fi
104if pwd | grep -qi dis; then
105 echo "Autodetected DIS. Will use script-level looping."
106fi
107echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt"
108echo "Press enter to confirm environment, Ctrl-C to exit..."
109read
110
111# Start contending tasks
112if [[ $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 &
121fi
122sleep 1 # Wait for contending tasks to start
123echo "Done. Beginning benchmarks..."
124
125num_tests=$(wc -l < $tacleNames)
126for (( i = 0; i < $num_tests ; i++ ))
127do
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]}
147done
148
149# End contending tasks
150if [[ $6 == "--contend" ]]; then
151 killall thrasher
152fi
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
160i=0
161for IRQ in /proc/irq/*
162do
163 if [ -d $IRQ ]; then
164 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
165 fi
166 i=$(( $i + 1 ))
167done
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
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4
7tacleNames=tacleNames.txt
8
9if [ $# -lt 4 ]; then
10 echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
11 exit
12fi
13
14if [ $# -gt 4 ]; then
15 echo "Using alternate list of TACLe benchmarks from $5"
16 tacleNames=$5
17fi
18
19if [ "$EUID" -ne 0 ]
20then
21 echo "You need to be root to enable interrupt isolation and real-time execution!"
22 exit
23fi
24
25echo "Making sure that binaries are up to date..."
26while read i; do
27 make bin/$i
28done < $tacleNames
29echo "Done. Disabling real-time throttling..."
30
31# Turn off rt throttling
32echo -1 > /proc/sys/kernel/sched_rt_runtime_us
33echo "Done. Redirecting all interrupts to core 0..."
34
35# Redirect all interrupts to core 0
36i=0
37for IRQ in /proc/irq/*
38do
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 ))
45done
46
47# Read the names of each benchmark
48j=0
49while read i; do
50 tacleProg[$j]=$i
51 j=$(( $j + 1 ))
52done < $tacleNames
53
54echo "Done. Checking for wbinvd module..."
55if [[ ! -f "/proc/wbinvd" ]]; then
56 echo "ERROR: wbinvd module not loaded. Exiting..."
57 exit
58fi
59
60# Enable L3 isolation
61echo "Done. Enabling L3 isolation..."
62mount -t resctrl resctrl /sys/fs/resctrl
63mkdir -p /sys/fs/resctrl/benchmarks
64mkdir -p /sys/fs/resctrl/benchmarks2
65echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
66echo $secondCore > /sys/fs/resctrl/benchmarks2/cpus_list
67# Reset global bandwith control and remove L3 from global
68echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
69echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
70# Alloc half L3 to benchmark
71echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata
72echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
73# Alloc other half L3 to benchmark2
74echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata
75echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks2/schemata
76echo "Done. Verifying configuration with user..."
77
78# Generate file name string
79# We append to this as we parse the environment settings
80runID=$(date +"%b%d-%H")
81
82# Confirm configuration with user
83echo "=== Global Config ==="
84cat /sys/fs/resctrl/schemata
85echo "=== Core $firstCore Config ==="
86cat /sys/fs/resctrl/benchmarks/schemata
87echo "=== Core $secondCore Config ==="
88cat /sys/fs/resctrl/benchmarks2/schemata
89if [[ $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
96else
97 runID=$runID-xc
98fi
99if uname -a | grep -q "mc2"; then
100 echo "MC^2 Autodetected. Not supported by this script!."
101 exit
102else
103 echo "MC^2 not detected. Cache coloring will be enabled in the L3 only.."
104 runID=$runID-i3
105fi
106if pwd | grep -qi dis; then
107 echo "Autodetected DIS. Will use script-level looping."
108fi
109echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt"
110echo "Press enter to confirm environment, Ctrl-C to exit..."
111read
112
113# Start contending tasks
114if [[ $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 &
123fi
124sleep 1 # Wait for contending tasks to start
125echo "Done. Beginning benchmarks..."
126
127num_tests=$(wc -l < $tacleNames)
128for (( i = 0; i < $num_tests ; i++ ))
129do
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]}
149done
150
151# End contending tasks
152if [[ $6 == "--contend" ]]; then
153 killall thrasher
154fi
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
162i=0
163for IRQ in /proc/irq/*
164do
165 if [ -d $IRQ ]; then
166 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
167 fi
168 i=$(( $i + 1 ))
169done
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 @@
1petrinet 1petrinet
2ndes
3statemate 2statemate
4adpcm_dec 3ndes
4h264_dec
5huff_dec
5cjpeg_wrbmp 6cjpeg_wrbmp
7fmref
8audiobeam
9adpcm_dec
6adpcm_enc 10adpcm_enc
11g723_enc
12huff_enc
13gsm_dec
7cjpeg_transupp 14cjpeg_transupp
8dijkstra
9epic 15epic
10fmref 16anagram
11gsm_dec
12h264_dec
13huff_enc
14rijndael_enc 17rijndael_enc
15rijndael_dec 18rijndael_dec
16gsm_enc 19gsm_enc
17susan 20susan
21dijkstra
18ammunition 22ammunition
19mpeg2 23mpeg2
diff --git a/baseline/run_baseline_L3_ONLY.sh b/baseline/run_baseline_L3_ONLY.sh
deleted file mode 100755
index 4183653..0000000
--- a/baseline/run_baseline_L3_ONLY.sh
+++ /dev/null
@@ -1,152 +0,0 @@
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
59# Enable L3 isolation
60echo "Done. Enabling L3 isolation..."
61mount -t resctrl resctrl /sys/fs/resctrl
62mkdir -p /sys/fs/resctrl/benchmarks
63echo $1 > /sys/fs/resctrl/benchmarks/cpus_list
64# Reset global bandwith control and remove L3 from global
65echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
66echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
67# Alloc L3 to benchmark
68echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks/schemata
69echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
70echo "Done. Verifying configuration with user..."
71
72# Generate file name string
73# We append to this as we parse the environment settings
74runID=$(date +"%b%d-%H")
75
76# Confirm configuration with user
77echo "=== Global Config ==="
78cat /sys/fs/resctrl/schemata
79echo "=== Core $1 Config ==="
80cat /sys/fs/resctrl/benchmarks/cpus_list
81cat /sys/fs/resctrl/benchmarks/schemata
82if [[ $5 == "--contend" ]]; then
83 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
84 echo "ERROR: thrasher binary not fonud. Exiting..."
85 exit
86 fi
87 echo "Will run 6 contending tasks"
88 runID=$runID-c
89else
90 runID=$runID-xc
91fi
92if uname -a | grep -q "mc2"; then
93 echo "MC^2 Autodetected. NOT SUPPORTED. Exiting..."
94 exit
95else
96 echo "MC^2 not detected. 50% L3 allocation enabled."
97 runID=$runID-i3
98fi
99if pwd | grep -qi dis; then
100 echo "Autodetected DIS. Will use script-level looping."
101fi
102echo "Results will be saved as $runID-$userRunID.txt"
103echo "Press enter to confirm environment, Ctrl-C to exit..."
104read
105
106# Start contending tasks
107if [[ $5 == "--contend" ]]; then
108 echo "Done. Starting 6 contending tasks..."
109 # Run two contending tasks on each other CCX
110 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
111 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
112 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
113 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
114 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
115 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
116fi
117sleep 1 # Wait for contending tasks to start
118echo "Done. Beginning benchmarks..."
119
120num_tests=$(wc -l < $tacleNames)
121for (( i = 0; i < $num_tests ; i++ ))
122do
123 # If using DIS, we have to iterate in the script as DIS won't do it for us
124 pwd | grep -qi dis
125 iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))")
126 for ((k=0;k<=iters;k++)); do
127 # Check if we're using LITMUS^RT or not
128 if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then
129 ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1
130 else
131 # Interleave memory allocations between all nodes (only 1 node w/out MC^2)
132 chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1
133 fi
134 done
135 echo COMPLETE: ${tacleProg[$i]}
136done
137
138# End contending tasks
139if [[ $5 == "--contend" ]]; then
140 killall thrasher
141fi
142
143# Put smp_affinty back the way it was
144i=0
145for IRQ in /proc/irq/*
146do
147 if [ -d $IRQ ]; then
148 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
149 fi
150 i=$(( $i + 1 ))
151done
152
diff --git a/baseline/tacleNames.txt b/baseline/tacleNames.txt
index 8f4845a..2e02966 100644
--- a/baseline/tacleNames.txt
+++ b/baseline/tacleNames.txt
@@ -1,19 +1,23 @@
1petrinet 1petrinet
2ndes
3statemate 2statemate
4adpcm_dec 3ndes
4h264_dec
5huff_dec
5cjpeg_wrbmp 6cjpeg_wrbmp
7fmref
8audiobeam
9adpcm_dec
6adpcm_enc 10adpcm_enc
11g723_enc
12huff_enc
13gsm_dec
7cjpeg_transupp 14cjpeg_transupp
8dijkstra
9epic 15epic
10fmref 16anagram
11gsm_dec
12h264_dec
13huff_enc
14rijndael_enc 17rijndael_enc
15rijndael_dec 18rijndael_dec
16gsm_enc 19gsm_enc
17susan 20susan
21dijkstra
18ammunition 22ammunition
19mpeg2 23mpeg2
diff --git a/run_all_tacle.sh b/run_all_tacle.sh
new file mode 100755
index 0000000..c0f07cc
--- /dev/null
+++ b/run_all_tacle.sh
@@ -0,0 +1,58 @@
1#!/bin/bash
2# Copyright 2020 Joshua Bakita
3# Runs TACLeBench in every configuration needed
4# for the paper and schedulability studies
5
6maxJobs=$1
7runID=$2
8
9if [ $# -lt 2 ]; then
10 echo "Usage $0 <number of iterations> <run ID>"
11 exit
12fi
13date
14
15# Run the pairs baseline and some comparisons to examine the effect of less cache
16cd baseline
17make all -j32
18# Full L3, full L2 - xi is the baseline for the pairs
19baseXI=baseline/$(date +"%b%d-%H")-c-xi-$runID.txt
20echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I xi $runID
21# Half L3, full L2 - i3 sees effect of half L3
22baseI3=baseline/$(date +"%b%d-%H")-c-i3-$runID.txt
23echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I i3 $runID
24# Half L3, half L2 - additional effect of half L2
25baseI=baseline/$(date +"%b%d-%H")-c-i-$runID.txt
26echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I i $runID
27date
28
29# Run the Level-A/-B pairs
30cd ../all_pairs
31make all -j32
32# No cache isolation
33pairXI=all_pairs/$(date +"%b%d-%H")-c-xi-$runID.txt
34echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi $runID
35# Shared L2, split L3
36pairI3=all_pairs/$(date +"%b%d-%H")-c-i3-$runID.txt
37echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i3 $runID
38# Split L2, split L3
39pairI=all_pairs/$(date +"%b%d-%H")-c-i-$runID.txt
40echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i $runID
41date
42
43# Run the Level-C pairs
44cd ../baseline
45pairC=baseline/$(date +"%b%d-%H")-c-xi-async-$runID.txt
46echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi -A $runID
47date
48
49echo "==== DONE ===="
50echo "Results are in:"
51echo "- $baseXI"
52echo "- $baseI3"
53echo "- $baseI"
54echo "- $pairXI"
55echo "- $pairI3"
56echo "- $pairI"
57echo "- $pairC"
58
diff --git a/run_bench.sh b/run_bench.sh
index 4e09faa..250d843 100755
--- a/run_bench.sh
+++ b/run_bench.sh
@@ -1,24 +1,43 @@
1#!/bin/bash 1#!/bin/bash
2# Copyright 2020 Joshua Bakita
3# A unified script for timing:
4# - SMT pairs with synchronous launches (hard real-time methodolgy)
5# - SMT pairs with asynchronous launches (soft real-time methodolgy)
6# - Unpaired tasks
7# - The cache alloc vs WSS setting exploration for DIS
8# These can all be done with:
9# - No cache management
10# - L3 cache splitting
11# - L2+L3 cache splitting (if OS supported)
12
13if grep -q "#define LITMUS 1" ../extra.h ./extra.h 2> /dev/null; then
14 LITMUS=1
15fi
2 16
3if [ $# -lt 5 ]; then 17if [ $# -lt 5 ]; then
4 echo "Usage $0 -m MODE -p CPU -l LOOPS -b FILE [-c] RUN_ID" 18 echo "Usage $0 -m MODE -p CPU -l LOOPS -b FILE [-B] [-I] RUN_ID"
5 echo " -m base|dis Which benchmarking mode to use" 19 echo " -m base|dis|pair Which benchmarking mode to use"
6 echo " -p CPU Which CPU to run each benchmark on" 20 echo " -p CPU Which CPU to run each benchmark on"
7 echo " -l LOOPS How many loops of each benchmark to do" 21 echo " -l LOOPS How many loops of each benchmark to do"
8 echo " -b FILE List of benchmarks to execute. Optional tab-" 22 echo " -b FILE List of benchmarks to execute. Optional tab-"
9 echo " delimited 2nd column specifies an input" 23 echo " delimited 2nd column specifies an input"
10 echo " generation command (fed to bench via stdin)" 24 echo " generation command (fed to bench via stdin)"
11 echo " -B Enable background contenders on other CCXes" 25 echo " -B Enable background contenders on other CCXes"
26 echo " -I xi|i3|i Isolation mode: none (xi) (default), way-based"
27 echo " L3-only (i3), or color-based L2+L3 (i)"
12 echo "Mode base requires no additional options." 28 echo "Mode base requires no additional options."
13 echo "Mode dis does not support the 2nd col. of -b and needs:" 29 echo "Mode dis does not support the 2nd col. of -b and needs:"
14 echo " -W FILE List of working set sizes to pass gen_input.py" 30 echo " -W FILE List of working set sizes to pass gen_input.py"
15 echo " -T FILE Input template to pass to gen_input.py" 31 echo " -T FILE Input template to pass to gen_input.py"
16 echo " -C FILE List of cache configurations to test" 32 echo " -C FILE List of cache configurations to test"
17 exit 33 echo "Mode pair options:"
34 echo " -P CPU CPU to run the 2nd benchmark on"
35 echo " -A Async. (Don't synchronize the pair at job"
36 echo " boundries.) Typically used SMT in soft realtime"
18fi 37fi
19 38
20# Name options similarly to rtspin 39# Name options similarly to rtspin
21while getopts “m:p:l:b:BW:T:C:” opt; do 40while getopts “m:p:l:b:BI:W:T:C:P:A” opt; do
22 case $opt in 41 case $opt in
23# Required 42# Required
24 m) mode=$OPTARG ;; 43 m) mode=$OPTARG ;;
@@ -27,9 +46,14 @@ while getopts “m:p:l:b:BW:T:C:” opt; do
27 b) benchNames=$OPTARG ;; 46 b) benchNames=$OPTARG ;;
28# Optional 47# Optional
29 B) contend=1 ;; 48 B) contend=1 ;;
49 I) iso_mode=$OPTARG ;;
50# DIS
30 W) wss_settings=$OPTARG ;; 51 W) wss_settings=$OPTARG ;;
31 T) template_input=$OPTARG ;; 52 T) template_input=$OPTARG ;;
32 C) cache_settings=$OPTARG ;; 53 C) cache_settings=$OPTARG ;;
54# Pair
55 P) core_two=$OPTARG ;;
56 A) async=1 ;;
33 esac 57 esac
34done 58done
35# Reset to read operands 59# Reset to read operands
@@ -37,7 +61,7 @@ shift $((OPTIND -1))
37userRunID=$1 61userRunID=$1
38 62
39# Required argument checking 63# Required argument checking
40if [[ "$mode" != "base" ]] && [[ "$mode" != "dis" ]]; then 64if [[ "$mode" != "base" && "$mode" != "dis" && $mode != pair ]]; then
41 echo "Invalid argument: MODE must be either 'base' or 'dis'" 65 echo "Invalid argument: MODE must be either 'base' or 'dis'"
42 exit 66 exit
43fi 67fi
@@ -72,14 +96,37 @@ if [[ "$mode" == "dis" ]] && [[ ! -f "$cache_settings" ]]; then
72 exit 96 exit
73fi 97fi
74 98
99# Pair argument checking
100if [[ "$mode" == "pair" && ! -v core_two ]]; then
101 echo "Missing argument: mode=pair reqires -P"
102 exit
103fi
104if [[ "$mode" != "pair" ]] && [[ -v async || -v core_two ]]; then
105 echo "Invalid argument: -A and -P require mode=pair"
106 exit
107fi
108
109# Additional checks
110if [[ $userRunID == "" ]]; then
111 echo "Missing argument: a run ID is required"
112 exit
113fi
114if [[ -v contend && ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
115 echo "ERROR: cannot find thrasher binary for -B. Exiting..."
116 exit
117fi
118if [[ $iso_mode == "i" && ! $(uname -a | grep "mc2") ]]; then
119 echo "Isolation mode 'i' requires the MC^2 kernel. Exiting..."
120 exit
121fi
122
75# Check permissions and update state 123# Check permissions and update state
76if [ "$EUID" -ne 0 ] 124if [[ "$EUID" != 0 ]]; then
77then
78 echo "You need to be root to enable interrupt isolation and real-time execution!" 125 echo "You need to be root to enable interrupt isolation and real-time execution!"
79 exit 126 exit
80fi 127fi
81 128
82echo "Done. Loading benchmark names and input..." 129echo "Loading benchmark names and input..."
83 130
84# Read the names of each benchmark and load input. 131# Read the names of each benchmark and load input.
85# This might look a bit scary, but all it does is 132# This might look a bit scary, but all it does is
@@ -96,11 +143,16 @@ done < $benchNames
96echo "Making sure that binaries are up to date..." 143echo "Making sure that binaries are up to date..."
97 144
98for b in ${bench[@]}; do 145for b in ${bench[@]}; do
99 make bin/$b 146 # Build "bin/bench" if bin directory
100 if [[ $? ]]; then 147 if [[ -d bin ]]; then
148 make bin/$b
149 fi
150 # If that failed, try a different name
151 if [[ "$?" != 0 || ! -d bin ]]; then
101 make $b 152 make $b
102 fi 153 fi
103 if [[ ! -f $b && ! -f "./bin/$b" ]]; then 154 # If bench is still not in bin or curr dir, fail
155 if [[ ! -f "./$b" && ! -f "./bin/$b" ]]; then
104 echo "Unable to find benchmark $b" 156 echo "Unable to find benchmark $b"
105 exit 157 exit
106 fi 158 fi
@@ -123,26 +175,86 @@ do
123 i=$(( $i + 1 )) 175 i=$(( $i + 1 ))
124done 176done
125 177
178echo "Done. Creating cleanup handler..."
179function cleanup {
180 # End contending tasks
181 if [[ -v contend ]]; then
182 killall thrasher
183 fi
184
185 # Restore cache access to everyone
186 echo "L3:0=ffff;1=ffff;2=ffff;3=ffff" > /sys/fs/resctrl/schemata
187 if [[ -e /sys/fs/resctrl/benchmarks ]]; then
188 echo "" > /sys/fs/resctrl/benchmarks/cpus_list
189 fi
190 if [[ -e /sys/fs/resctrl/benchmarks2 ]]; then
191 echo "" > /sys/fs/resctrl/benchmarks2/cpus_list
192 fi
193
194 # Put smp_affinty back the way it was
195 i=0
196 for IRQ in /proc/irq/*
197 do
198 if [ -d $IRQ ]; then
199 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
200 fi
201 i=$(( $i + 1 ))
202 done
203}
204# This sets the cleanup function to be called when we exit for any reason
205trap cleanup EXIT
206
126echo "Done. Checking for wbinvd module..." 207echo "Done. Checking for wbinvd module..."
127if [[ ! -f "/proc/wbinvd" ]]; then 208if [[ ! -f "/proc/wbinvd" ]]; then
128 echo "ERROR: wbinvd module not loaded. Exiting..." 209 echo "ERROR: wbinvd module not loaded. Exiting..."
129 exit 210 exit
130fi 211fi
131 212
132echo "Done. Setting core $core to 'performance'..." 213echo "Done. Setting cores to 'performance'..."
133echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor 214echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor
215if [[ -v core_two ]]; then
216 echo "performance" > /sys/devices/system/cpu/cpu$core_two/cpufreq/scaling_governor
217fi
134 218
135# Enable L3 isolation 219# Enable L3 isolation
136echo "Done. Enabling L3 isolation..." 220echo "Done. Setting up L3 isolation..."
137mount -t resctrl resctrl /sys/fs/resctrl 221mount -t resctrl resctrl /sys/fs/resctrl
138mkdir -p /sys/fs/resctrl/benchmarks
139echo $core > /sys/fs/resctrl/benchmarks/cpus_list
140# Reset global bandwith control and remove L3 from global 222# Reset global bandwith control and remove L3 from global
141echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata 223echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
142echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata 224echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
143# Alloc L3 to benchmark 225# Alloc L3 to benchmark
144echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata 226# (this logic is safe when $core_two is empty)
145echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata 227if [[ $iso_mode == "i" ]]; then
228 # With "i" we rely on numactl to do isolation
229 # Full L3 access from both cores
230 mkdir -p /sys/fs/resctrl/benchmarks
231 # Must write both at the same time. Appends unsupported!
232 echo $core,$core_two > /sys/fs/resctrl/benchmarks/cpus_list
233 echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
234 # But each core is bound to its own numa mem node
235 numa_arg0="--membind=0"
236 numa_arg1="--membind=1"
237elif [[ $iso_mode == "i3" ]]; then
238 # With "i3" we rely on resctrl to do isolation
239 mkdir -p /sys/fs/resctrl/benchmarks
240 mkdir -p /sys/fs/resctrl/benchmarks2
241 echo $core > /sys/fs/resctrl/benchmarks/cpus_list
242 echo $core_two > /sys/fs/resctrl/benchmarks2/cpus_list
243 echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata
244 echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata
245 # Disable numa-based isolation
246 numa_arg0="--interleave=all"
247 numa_arg1="--interleave=all"
248else
249 iso_mode="xi"
250 # No isolation via numactl or resctrl
251 mkdir -p /sys/fs/resctrl/benchmarks
252 echo $core,$core_two > /sys/fs/resctrl/benchmarks/cpus_list
253 echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
254 # Disable numa-based isolation
255 numa_arg0="--interleave=all"
256 numa_arg1="--interleave=all"
257fi
146echo "Done. Verifying configuration with user..." 258echo "Done. Verifying configuration with user..."
147 259
148# Generate file name string 260# Generate file name string
@@ -152,26 +264,42 @@ runID=$(date +"%b%d-%H")
152# Confirm configuration with user 264# Confirm configuration with user
153echo "=== Global Config ===" 265echo "=== Global Config ==="
154cat /sys/fs/resctrl/schemata 266cat /sys/fs/resctrl/schemata
155echo "=== Core $core Config ===" 267echo "=== NUMA Config ==="
268echo " '$numa_arg0' and '$numa_arg1'"
269echo "=== Core $(cat /sys/fs/resctrl/benchmarks/cpus_list) Config ==="
156cat /sys/fs/resctrl/benchmarks/schemata 270cat /sys/fs/resctrl/benchmarks/schemata
271if [[ -v core_two && $(cat /sys/fs/resctrl/benchmarks2/cpus_list) ]]; then
272 echo "=== Core $(cat /sys/fs/resctrl/benchmarks2/cpus_list) Config ==="
273 cat /sys/fs/resctrl/benchmarks2/schemata
274fi
275
157if [[ -v contend ]]; then 276if [[ -v contend ]]; then
158 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
159 echo "ERROR: thrasher binary not fonud. Exiting..."
160 exit
161 fi
162 echo "Will run 6 contending tasks" 277 echo "Will run 6 contending tasks"
163 runID=$runID-c 278 runID=$runID-c
164else 279else
165 runID=$runID-xc 280 runID=$runID-xc
166fi 281fi
167if uname -a | grep -q "mc2"; then 282
168 echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled." 283runID=$runID-$iso_mode
169 runID=$runID-i 284
285if [[ -v async ]]; then
286 echo "Will use asynchronous job pairing"
287 runID=$runID-async
288fi
289
290if [[ $mode == "pair" && ! -v async ]]; then
291 echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt"
170else 292else
171 echo "MC^2 not detected." 293 echo "Results will be saved as $runID-$userRunID.txt"
172 runID=$runID-xi 294fi
295
296if [[ $core == 0 || "$core_two" == 0 ]]; then
297 echo "!!!!! DANGER !!!!!"
298 echo "! Running real-time tasks on core 0 will conflict with interrupt"
299 echo "! handling and likely freeze your system! Only continue if you know"
300 echo "! exactly what you're doing!!"
301 echo "!!!!!!!!!!!!!!!!!!"
173fi 302fi
174echo "Results will be saved as $runID-$userRunID.txt"
175echo "Press enter to confirm environment, Ctrl-C to exit..." 303echo "Press enter to confirm environment, Ctrl-C to exit..."
176read 304read
177 305
@@ -194,38 +322,72 @@ FAIL_COLOR="\033[0;31m"
194GOOD_COLOR="\033[0;32m" 322GOOD_COLOR="\033[0;32m"
195RESET_COLOR="\033[0m" 323RESET_COLOR="\033[0m"
196 324
197num_tests=$(wc -l < $benchNames)
198# For each benchmark 325# For each benchmark
199for (( i = 0; i < $num_tests ; i++ )); do 326for (( i = 0; i < ${#bench[@]} ; i++ )); do
327 # Search for the benchmark in this directory, than /bin
200 if [[ -f ${bench[$i]} ]]; then 328 if [[ -f ${bench[$i]} ]]; then
201 binary="${bench[$i]}" 329 prefix="."
202 else 330 else
203 binary="./bin/${bench[$i]}" 331 prefix="./bin"
204 fi 332 fi
205 if [[ "$mode" == "base" ]]; then 333 if [[ "$mode" == "base" ]]; then
206 # Just run the benchmark if TACLeBench 334 # Just run the benchmark if TACLeBench
207 # Check if we're using LITMUS^RT or not 335 # Check if we're using LITMUS^RT or not
208 if grep -q "#define LITMUS 1" ../extra.h; then 336 if [[ -v $LITMUS ]]; then
209 echo "Using LITMUS-RT!" 337 echo "${input[$i]}" | numactl $numa_arg0 $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $runID-$userRunID 1
210 echo "${input[$i]}" | numactl -m 0 ./bin/$binary ${bench[$i]} $maxJobs $core $runID-$userRunID 1
211 else 338 else
212 # Interleave memory allocations between all nodes (only 1 node w/out MC^2) 339 # Remember: Unpaired tasks always get access to all colors (so we --interleave all)
213 # (this is right because we're testing a task w/out SMT, so it gets both colors) 340 echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $runID-$userRunID 1
214 echo "${input[$i]}" | chrt -r 97 numactl --interleave=all taskset -c $core ./$binary ${bench[$i]} $maxJobs $core $runID-$userRunID 1
215 fi 341 fi
216 elif [[ "$mode" == "dis" ]]; then 342 elif [[ "$mode" == "dis" ]]; then
217 # Loop through each WSS and cache config if DIS 343 # Loop through each WSS and cache config if DIS
218 while read j; do # For cache setting 344 while read j; do # For cache setting
219 echo $j > /sys/fs/resctrl/benchmarks/schemata 345 echo $j > /sys/fs/resctrl/benchmarks/schemata
220 while read ii; do # For WSS setting 346 while read ii; do # For WSS setting
221 if grep -q "#define LITMUS 1" ../extra.h; then 347 if [[ -v $LITMUS ]]; then
222 echo "Using LITMUS-RT!" 348 ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | numactl $numa_arg0 $prefix/${bench[$i]} $bench[$i]}-$ii-$j $maxJobs $core $runID 1
223 ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | numactl -m 0 ./$binary $bench[$i]}-$ii-$j $maxJobs $core $runID 1
224 else 349 else
225 ./gen_input.py ${bench[$i]} $template_input $ii | chrt -r 97 numactl -m 0 taskset -c $core ./$binary ${bench[$i]}-$ii-$j $maxJobs $core $runID 1 350 ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]}-$ii-$j $maxJobs $core $runID 1
226 fi 351 fi
227 done < $wss_settings 352 done < $wss_settings
228 done < $cache_settings 353 done < $cache_settings
354 elif [[ "$mode" == "pair" ]]; then
355 # Only async truly needs to do all-pairs
356 if [[ ! -v async ]]; then
357 start=$i
358 else
359 start=0
360 fi
361 for (( j = $start; j < ${#bench[@]} ; j++ )); do
362 if [[ ! -v async ]]; then
363 # Synchronize between pairs - original hard real-time SMT approach
364 if [[ -v $LITMUS ]]; then
365 echo "${input[$i]}" | numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $core_two ${bench[$j]} $runID-$userRunID-A 1 & PID1=$!;
366 echo "${input[$j]}" | numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$j]} ${bench[$j]} $maxJobs $core_two $core ${bench[$i]} $runID-$userRunID-B 2 & PID2=$!;
367 else
368 echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $core_two ${bench[$j]} $runID-$userRunID-A 1 & PID1=$!;
369 echo "${input[$j]}" | chrt -r 97 numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$j]} ${bench[$j]} $maxJobs $core_two $core ${bench[$i]} $runID-$userRunID-B 2 & PID2=$!;
370 fi
371 # We launched them asynchronously, so we have to wait
372 wait $PID1 $PID2
373 else
374 # No synchronization between pairs - original soft real-time SMT approach
375 if [[ -v $LITMUS ]]; then
376 echo "${input[$i]}" | numactl $numa_arg0 taskset -c $core $prefix/${bench[$j]} ${bench[$j]} -1 $core NULL 0 & PID1=$!;
377 echo "${input[$j]}" | numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$i]} ${bench[$i]}"+"${bench[$j]} $maxJobs $core_two $runID-$userRunID 1 & PID2=$!;
378 else
379 echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$j]} ${bench[$j]} -1 $core NULL 0 & PID1=$!;
380 echo "${input[$j]}" | chrt -r 97 numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$i]} ${bench[$i]}"+"${bench[$j]} $maxJobs $core_two $runID-$userRunID 1 & PID2=$!;
381 fi
382 wait $PID2
383 kill $PID1
384 fi
385 if [[ $? != 0 ]]; then
386 echo -e ${FAIL_COLOR}FAILED${RESET_COLOR}: ${bench[$i]} ${bench[$j]}
387 else
388 echo -e ${GOOD_COLOR}COMPLETE${RESET_COLOR}: ${bench[$i]} ${bench[$j]}
389 fi
390 done
229 fi 391 fi
230 if [[ $? != 0 ]]; then 392 if [[ $? != 0 ]]; then
231 echo -e ${FAIL_COLOR}FAILED${RESET_COLOR}: ${bench[$i]} 393 echo -e ${FAIL_COLOR}FAILED${RESET_COLOR}: ${bench[$i]}
@@ -234,18 +396,3 @@ for (( i = 0; i < $num_tests ; i++ )); do
234 fi 396 fi
235done 397done
236 398
237# End contending tasks
238if [[ -v contend ]]; then
239 killall thrasher
240fi
241
242# Put smp_affinty back the way it was
243i=0
244for IRQ in /proc/irq/*
245do
246 if [ -d $IRQ ]; then
247 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
248 fi
249 i=$(( $i + 1 ))
250done
251
diff --git a/run_everything.sh b/run_everything.sh
deleted file mode 100755
index 8d46ad7..0000000
--- a/run_everything.sh
+++ /dev/null
@@ -1,21 +0,0 @@
1#!/bin/bash
2
3maxJobs=$1
4runID=$2
5
6if [ $# -lt 2 ]; then
7 echo "Usage $0 <number of iterations> <run ID>"
8 exit
9fi
10
11date
12cd baseline
13make all
14../interference-benchmark/deactivateCoresSMT.bash
15./run_baseline.sh 15 $maxJobs $runID
16date
17cd ../all_pairs
18../../interference-benchmark/activateCores.bash
19make all
20./run_all_pairs.sh 15 31 $maxJobs $runID
21date
diff --git a/run_tacle_all.sh b/run_tacle_all.sh
deleted file mode 100755
index dd5a443..0000000
--- a/run_tacle_all.sh
+++ /dev/null
@@ -1,49 +0,0 @@
1#!/bin/bash
2# Copyright 2020 Joshua Bakita
3# This script runs the baselines and Level-A/B and Level-C all_pairs
4# for TACLe w/out MC^2
5
6if uname -a | grep -q mc2; then
7 echo "You need to run this without MC^2!"
8 exit
9fi
10
11if [ "$EUID" -ne 0 ]; then
12 echo "You need to be root to enable interrupt isolation and real-time execution!"
13 exit
14fi
15
16echo "This will run the contended and uncontended TACLe baseline, all-pairs, and Level-C micro-benchamarks in non-interactive mode."
17echo "Please press enter to confirm (Ctrl-C to abort)..."
18read
19
20echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor
21echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governor
22
23cd baseline
24baseNo=baseline/$(date +"%b%d-%H")-xc-xi-1k.txt
25echo "" | ../run_bench.sh -m base -p 15 -l 1001 -b ../all_pairs/tacleNames.txt 1k
26baseYes=baseline/$(date +"%b%d-%H")-c-xi-1k.txt
27echo "" | ../run_bench.sh -B -m make -p 15 -l 1001 -b ../all_pairs/tacleNames.txt 1k
28
29cd ../all_pairs
30pairsNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k
31echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt
32pairsYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k
33echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt --contend
34
35cd ../baseline
36echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt
37cNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k-LC-TACLe.txt
38echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt --contend
39cYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k-LC-TACLe.txt
40
41echo "==== DONE ==="
42echo "Results are in:"
43echo "- "$baseNo
44echo "- "$baseYes
45echo "- "$pairsNo" (A/B)"
46echo "- "$pairsYes" (A/B)"
47echo "- "$cNo
48echo "- "$cYes
49
diff --git a/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh b/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh
deleted file mode 100755
index 2ac3fc1..0000000
--- a/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh
+++ /dev/null
@@ -1,175 +0,0 @@
1#!/bin/bash
2
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4
7tacleNames=tacleNames.txt
8
9if [ $# -lt 4 ]; then
10 echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
11 exit
12fi
13
14if [ $# -gt 4 ]; then
15 echo "Using alternate list of TACLe benchmarks from $5"
16 tacleNames=$5
17fi
18
19if [ "$EUID" -ne 0 ]
20then
21 echo "You need to be root to enable interrupt isolation and real-time execution!"
22 exit
23fi
24
25echo "Making sure that binaries are up to date..."
26while read i; do
27 make bin/$i
28done < $tacleNames
29echo "Done. Disabling real-time throttling..."
30
31# Turn off rt throttling
32echo -1 > /proc/sys/kernel/sched_rt_runtime_us
33echo "Done. Redirecting all interrupts to core 0..."
34
35# Redirect all interrupts to core 0
36i=0
37for IRQ in /proc/irq/*
38do
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 ))
45done
46
47# Read the names of each benchmark
48j=0
49while read i; do
50 tacleProg[$j]=$i
51 j=$(( $j + 1 ))
52done < $tacleNames
53
54echo "Done. Checking for wbinvd module..."
55if [[ ! -f "/proc/wbinvd" ]]; then
56 echo "ERROR: wbinvd module not loaded. Exiting..."
57 exit
58fi
59
60# Enable L3 isolation
61echo "Done. Enabling L3 isolation..."
62mount -t resctrl resctrl /sys/fs/resctrl
63mkdir -p /sys/fs/resctrl/benchmarks
64echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
65echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list
66# Reset global bandwith control and remove L3 from global
67echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
68echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
69# Alloc L3 to benchmark
70echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
71echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
72echo "Done. Verifying configuration with user..."
73
74# Generate file name string
75# We append to this as we parse the environment settings
76runID=$(date +"%b%d-%H")
77
78# Confirm configuration with user
79echo "=== Global Config ==="
80cat /sys/fs/resctrl/schemata
81echo "=== Core $firstCore and $secondCore Config ==="
82cat /sys/fs/resctrl/benchmarks/schemata
83if [[ $6 == "--contend" ]]; then
84 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
85 echo "ERROR: thrasher binary not fonud. Exiting..."
86 exit
87 fi
88 echo "Will run 6 contending tasks"
89 runID=$runID-c
90else
91 runID=$runID-xc
92fi
93if uname -a | grep -q "mc2"; then
94 echo "MC^2 Autodetected. Cache coloring will be DISABLED."
95 runID=$runID-i
96else
97 echo "MC^2 not detected. Cache coloring will be DISABLED."
98 runID=$runID-xi
99fi
100echo "Results will be saved as $runID-$userRunID-LC-DIS.txt"
101echo "Press enter to confirm environment, Ctrl-C to exit..."
102read
103
104# Start contending tasks
105if [[ $6 == "--contend" ]]; then
106 echo "Done. Starting 6 contending tasks..."
107 # Run two contending tasks on each other CCX
108 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
109 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
110 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
111 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
112 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
113 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
114fi
115sleep 1 # Wait for contending tasks to start
116echo "Done. Beginning benchmarks..."
117
118num_tests=$(wc -l < $tacleNames)
119for (( i = 0; i < $num_tests ; i++ ))
120do
121 # For level-C analysis, we must run all vs all
122 for (( j = 0; j < $num_tests ; j++ )) #loop through programs
123 do
124 # Autodetect MC^2
125 # Get DIS to loop continuously in the background by infinite restarts
126 if uname -a | grep -q "mc2"; then
127 bash -c "while true; do chrt -r 97 numactl --interleave=all taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 &> /dev/null; done" & PID1=$!;
128 else
129 bash -c "while true; do chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 &> /dev/null; done" & PID1=$!;
130 fi
131 # Each sample runs in its own process
132 for ((k=0;k<=maxJobs;k++)); do
133 if uname -a | grep -q "mc2"; then
134 chrt -r 97 numactl --interleave=all taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!;
135 else
136 chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!;
137 fi
138 done
139 # The paired task runs continuously in this configuration, so we have
140 # to kill it once the task that we're measuring finishes.
141 wait $PID2
142 kill $PID1
143 # Killing bash will not kill its children by default - work aronud that here
144 killall transitive &> /dev/null
145 killall matrix &> /dev/null
146 killall pointer &> /dev/null
147 killall field &> /dev/null
148 killall neighborhood &> /dev/null
149 killall update &> /dev/null
150 killall gen_input.py &> /dev/null
151 echo ${tacleProg[$i]} ${tacleProg[$j]}
152 done
153 echo COMPLETE: ${tacleProg[$i]}
154done
155
156# End contending tasks
157if [[ $6 == "--contend" ]]; then
158 killall thrasher
159fi
160
161# Remove semaphores from system
162# Leaving them won't hurt these tests, but would be messy and is bad practice
163# TODO: Do this directly in the benchmarks. They should clean up after themselves
164./bin/cleanupSemaphores
165
166# Put smp_affinty back the way it was
167i=0
168for IRQ in /proc/irq/*
169do
170 if [ -d $IRQ ]; then
171 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
172 fi
173 i=$(( $i + 1 ))
174done
175
diff --git a/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh b/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh
deleted file mode 100755
index 923dba0..0000000
--- a/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh
+++ /dev/null
@@ -1,161 +0,0 @@
1#!/bin/bash
2
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4
7tacleNames=tacleNames.txt
8
9if [ $# -lt 4 ]; then
10 echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
11 exit
12fi
13
14if [ $# -gt 4 ]; then
15 echo "Using alternate list of TACLe benchmarks from $5"
16 tacleNames=$5
17fi
18
19if [ "$EUID" -ne 0 ]
20then
21 echo "You need to be root to enable interrupt isolation and real-time execution!"
22 exit
23fi
24
25echo "Making sure that binaries are up to date..."
26while read i; do
27 make bin/$i
28done < $tacleNames
29echo "Done. Disabling real-time throttling..."
30
31# Turn off rt throttling
32echo -1 > /proc/sys/kernel/sched_rt_runtime_us
33echo "Done. Redirecting all interrupts to core 0..."
34
35# Redirect all interrupts to core 0
36i=0
37for IRQ in /proc/irq/*
38do
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 ))
45done
46
47# Read the names of each benchmark
48j=0
49while read i; do
50 tacleProg[$j]=$i
51 j=$(( $j + 1 ))
52done < $tacleNames
53
54echo "Done. Checking for wbinvd module..."
55if [[ ! -f "/proc/wbinvd" ]]; then
56 echo "ERROR: wbinvd module not loaded. Exiting..."
57 exit
58fi
59
60# Enable L3 isolation
61echo "Done. Enabling L3 isolation..."
62mount -t resctrl resctrl /sys/fs/resctrl
63mkdir -p /sys/fs/resctrl/benchmarks
64echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
65echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list
66# Reset global bandwith control and remove L3 from global
67echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
68echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
69# Alloc L3 to benchmark
70echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
71echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
72echo "Done. Verifying configuration with user..."
73
74# Generate file name string
75# We append to this as we parse the environment settings
76runID=$(date +"%b%d-%H")
77
78# Confirm configuration with user
79echo "=== Global Config ==="
80cat /sys/fs/resctrl/schemata
81echo "=== Core $firstCore and $secondCore Config ==="
82cat /sys/fs/resctrl/benchmarks/schemata
83if [[ $6 == "--contend" ]]; then
84 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
85 echo "ERROR: thrasher binary not fonud. Exiting..."
86 exit
87 fi
88 echo "Will run 6 contending tasks"
89 runID=$runID-c
90else
91 runID=$runID-xc
92fi
93if uname -a | grep -q "mc2"; then
94 echo "MC^2 Autodetected. Cache coloring will be DISABLED."
95 runID=$runID-i
96else
97 echo "MC^2 not detected. Cache coloring will be DISABLED."
98 runID=$runID-xi
99fi
100echo "Results will be saved as $runID-$userRunID-LC-TACLe.txt"
101echo "Press enter to confirm environment, Ctrl-C to exit..."
102read
103
104# Start contending tasks
105if [[ $6 == "--contend" ]]; then
106 echo "Done. Starting 6 contending tasks..."
107 # Run two contending tasks on each other CCX
108 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
109 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
110 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
111 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
112 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
113 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
114fi
115sleep 1 # Wait for contending tasks to start
116echo "Done. Beginning benchmarks..."
117
118num_tests=$(wc -l < $tacleNames)
119for (( i = 0; i < $num_tests ; i++ ))
120do
121 # For level-C analysis, we must run all vs all
122 for (( j = 0; j < $num_tests ; j++ )) #loop through programs
123 do
124 # Autodetect MC^2
125 if uname -a | grep -q "mc2"; then
126 # -1 loops means loop forever
127 chrt -r 97 numactl --interleave=all taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 & PID1=$!;
128 chrt -r 97 numactl --interleave=all taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-TACLe 1 & PID2=$!;
129 else
130 chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 & PID1=$!;
131 chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-TACLe 1 & PID2=$!;
132 fi
133 # The paired task runs continuously in this configuration, so we have
134 # to kill it once the task that we're measuring finishes.
135 wait $PID2
136 kill $PID1
137 echo ${tacleProg[$i]} ${tacleProg[$j]}
138 done
139 echo COMPLETE: ${tacleProg[$i]}
140done
141
142# End contending tasks
143if [[ $6 == "--contend" ]]; then
144 killall thrasher
145fi
146
147# Remove semaphores from system
148# Leaving them won't hurt these tests, but would be messy and is bad practice
149# TODO: Do this directly in the benchmarks. They should clean up after themselves
150./bin/cleanupSemaphores
151
152# Put smp_affinty back the way it was
153i=0
154for IRQ in /proc/irq/*
155do
156 if [ -d $IRQ ]; then
157 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
158 fi
159 i=$(( $i + 1 ))
160done
161