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 | |
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
-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 | ||||
-rwxr-xr-x | baseline/run_baseline_L3_ONLY.sh | 152 | ||||
-rw-r--r-- | baseline/tacleNames.txt | 18 | ||||
-rwxr-xr-x | run_all_tacle.sh | 58 | ||||
-rwxr-xr-x | run_bench.sh | 261 | ||||
-rwxr-xr-x | run_everything.sh | 21 | ||||
-rwxr-xr-x | run_tacle_all.sh | 49 | ||||
-rwxr-xr-x | smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh | 175 | ||||
-rwxr-xr-x | smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh | 161 |
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 | |||
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 |
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 | |||
3 | core=$1 | ||
4 | maxJobs=$2 | ||
5 | userRunID=$3 | ||
6 | tacleNames=tacleNames.txt | ||
7 | |||
8 | if [ $# -lt 3 ]; then | ||
9 | echo "Usage $0 <core ID> <number of iterations> <run ID> [TACLe names file] [--contend]" | ||
10 | exit | ||
11 | fi | ||
12 | |||
13 | if [ $# -gt 3 ]; then | ||
14 | echo "Using alternate list of TACLe benchmarks from $4" | ||
15 | tacleNames=$4 | ||
16 | fi | ||
17 | |||
18 | if [ "$EUID" -ne 0 ] | ||
19 | then | ||
20 | echo "You need to be root to enable interrupt isolation and real-time execution!" | ||
21 | exit | ||
22 | fi | ||
23 | |||
24 | echo "Making sure that binaries are up to date..." | ||
25 | while read i; do | ||
26 | make bin/$i | ||
27 | done < $tacleNames | ||
28 | echo "Done. Disabling real-time throttling..." | ||
29 | |||
30 | # Turn off rt throttling | ||
31 | echo -1 > /proc/sys/kernel/sched_rt_runtime_us | ||
32 | echo "Done. Redirecting all interrupts to core 0..." | ||
33 | |||
34 | # Redirect all interrupts to core 0 | ||
35 | i=0 | ||
36 | for IRQ in /proc/irq/* | ||
37 | do | ||
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 )) | ||
44 | done | ||
45 | |||
46 | # Read the names of each benchmark | ||
47 | j=0 | ||
48 | while read i; do | ||
49 | tacleProg[$j]=$i | ||
50 | j=$(( $j + 1 )) | ||
51 | done < $tacleNames | ||
52 | |||
53 | echo "Done. Checking for wbinvd module..." | ||
54 | if [[ ! -f "/proc/wbinvd" ]]; then | ||
55 | echo "ERROR: wbinvd module not loaded. Exiting..." | ||
56 | exit | ||
57 | fi | ||
58 | |||
59 | # Enable L3 isolation | ||
60 | echo "Done. Enabling L3 isolation..." | ||
61 | mount -t resctrl resctrl /sys/fs/resctrl | ||
62 | mkdir -p /sys/fs/resctrl/benchmarks | ||
63 | echo $1 > /sys/fs/resctrl/benchmarks/cpus_list | ||
64 | # Reset global bandwith control and remove L3 from global | ||
65 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
66 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
67 | # Alloc L3 to benchmark | ||
68 | echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks/schemata | ||
69 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
70 | echo "Done. Verifying configuration with user..." | ||
71 | |||
72 | # Generate file name string | ||
73 | # We append to this as we parse the environment settings | ||
74 | runID=$(date +"%b%d-%H") | ||
75 | |||
76 | # Confirm configuration with user | ||
77 | echo "=== Global Config ===" | ||
78 | cat /sys/fs/resctrl/schemata | ||
79 | echo "=== Core $1 Config ===" | ||
80 | cat /sys/fs/resctrl/benchmarks/cpus_list | ||
81 | cat /sys/fs/resctrl/benchmarks/schemata | ||
82 | if [[ $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 | ||
89 | else | ||
90 | runID=$runID-xc | ||
91 | fi | ||
92 | if uname -a | grep -q "mc2"; then | ||
93 | echo "MC^2 Autodetected. NOT SUPPORTED. Exiting..." | ||
94 | exit | ||
95 | else | ||
96 | echo "MC^2 not detected. 50% L3 allocation enabled." | ||
97 | runID=$runID-i3 | ||
98 | fi | ||
99 | if pwd | grep -qi dis; then | ||
100 | echo "Autodetected DIS. Will use script-level looping." | ||
101 | fi | ||
102 | echo "Results will be saved as $runID-$userRunID.txt" | ||
103 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
104 | read | ||
105 | |||
106 | # Start contending tasks | ||
107 | if [[ $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 & | ||
116 | fi | ||
117 | sleep 1 # Wait for contending tasks to start | ||
118 | echo "Done. Beginning benchmarks..." | ||
119 | |||
120 | num_tests=$(wc -l < $tacleNames) | ||
121 | for (( i = 0; i < $num_tests ; i++ )) | ||
122 | do | ||
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]} | ||
136 | done | ||
137 | |||
138 | # End contending tasks | ||
139 | if [[ $5 == "--contend" ]]; then | ||
140 | killall thrasher | ||
141 | fi | ||
142 | |||
143 | # Put smp_affinty back the way it was | ||
144 | i=0 | ||
145 | for IRQ in /proc/irq/* | ||
146 | do | ||
147 | if [ -d $IRQ ]; then | ||
148 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
149 | fi | ||
150 | i=$(( $i + 1 )) | ||
151 | done | ||
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 @@ | |||
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 |
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 | |||
6 | maxJobs=$1 | ||
7 | runID=$2 | ||
8 | |||
9 | if [ $# -lt 2 ]; then | ||
10 | echo "Usage $0 <number of iterations> <run ID>" | ||
11 | exit | ||
12 | fi | ||
13 | date | ||
14 | |||
15 | # Run the pairs baseline and some comparisons to examine the effect of less cache | ||
16 | cd baseline | ||
17 | make all -j32 | ||
18 | # Full L3, full L2 - xi is the baseline for the pairs | ||
19 | baseXI=baseline/$(date +"%b%d-%H")-c-xi-$runID.txt | ||
20 | echo "" | ../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 | ||
22 | baseI3=baseline/$(date +"%b%d-%H")-c-i3-$runID.txt | ||
23 | echo "" | ../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 | ||
25 | baseI=baseline/$(date +"%b%d-%H")-c-i-$runID.txt | ||
26 | echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I i $runID | ||
27 | date | ||
28 | |||
29 | # Run the Level-A/-B pairs | ||
30 | cd ../all_pairs | ||
31 | make all -j32 | ||
32 | # No cache isolation | ||
33 | pairXI=all_pairs/$(date +"%b%d-%H")-c-xi-$runID.txt | ||
34 | echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi $runID | ||
35 | # Shared L2, split L3 | ||
36 | pairI3=all_pairs/$(date +"%b%d-%H")-c-i3-$runID.txt | ||
37 | echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i3 $runID | ||
38 | # Split L2, split L3 | ||
39 | pairI=all_pairs/$(date +"%b%d-%H")-c-i-$runID.txt | ||
40 | echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i $runID | ||
41 | date | ||
42 | |||
43 | # Run the Level-C pairs | ||
44 | cd ../baseline | ||
45 | pairC=baseline/$(date +"%b%d-%H")-c-xi-async-$runID.txt | ||
46 | echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi -A $runID | ||
47 | date | ||
48 | |||
49 | echo "==== DONE ====" | ||
50 | echo "Results are in:" | ||
51 | echo "- $baseXI" | ||
52 | echo "- $baseI3" | ||
53 | echo "- $baseI" | ||
54 | echo "- $pairXI" | ||
55 | echo "- $pairI3" | ||
56 | echo "- $pairI" | ||
57 | echo "- $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 | |||
13 | if grep -q "#define LITMUS 1" ../extra.h ./extra.h 2> /dev/null; then | ||
14 | LITMUS=1 | ||
15 | fi | ||
2 | 16 | ||
3 | if [ $# -lt 5 ]; then | 17 | if [ $# -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" | ||
18 | fi | 37 | fi |
19 | 38 | ||
20 | # Name options similarly to rtspin | 39 | # Name options similarly to rtspin |
21 | while getopts “m:p:l:b:BW:T:C:” opt; do | 40 | while 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 |
34 | done | 58 | done |
35 | # Reset to read operands | 59 | # Reset to read operands |
@@ -37,7 +61,7 @@ shift $((OPTIND -1)) | |||
37 | userRunID=$1 | 61 | userRunID=$1 |
38 | 62 | ||
39 | # Required argument checking | 63 | # Required argument checking |
40 | if [[ "$mode" != "base" ]] && [[ "$mode" != "dis" ]]; then | 64 | if [[ "$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 |
43 | fi | 67 | fi |
@@ -72,14 +96,37 @@ if [[ "$mode" == "dis" ]] && [[ ! -f "$cache_settings" ]]; then | |||
72 | exit | 96 | exit |
73 | fi | 97 | fi |
74 | 98 | ||
99 | # Pair argument checking | ||
100 | if [[ "$mode" == "pair" && ! -v core_two ]]; then | ||
101 | echo "Missing argument: mode=pair reqires -P" | ||
102 | exit | ||
103 | fi | ||
104 | if [[ "$mode" != "pair" ]] && [[ -v async || -v core_two ]]; then | ||
105 | echo "Invalid argument: -A and -P require mode=pair" | ||
106 | exit | ||
107 | fi | ||
108 | |||
109 | # Additional checks | ||
110 | if [[ $userRunID == "" ]]; then | ||
111 | echo "Missing argument: a run ID is required" | ||
112 | exit | ||
113 | fi | ||
114 | if [[ -v contend && ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then | ||
115 | echo "ERROR: cannot find thrasher binary for -B. Exiting..." | ||
116 | exit | ||
117 | fi | ||
118 | if [[ $iso_mode == "i" && ! $(uname -a | grep "mc2") ]]; then | ||
119 | echo "Isolation mode 'i' requires the MC^2 kernel. Exiting..." | ||
120 | exit | ||
121 | fi | ||
122 | |||
75 | # Check permissions and update state | 123 | # Check permissions and update state |
76 | if [ "$EUID" -ne 0 ] | 124 | if [[ "$EUID" != 0 ]]; then |
77 | then | ||
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 |
80 | fi | 127 | fi |
81 | 128 | ||
82 | echo "Done. Loading benchmark names and input..." | 129 | echo "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 | |||
96 | echo "Making sure that binaries are up to date..." | 143 | echo "Making sure that binaries are up to date..." |
97 | 144 | ||
98 | for b in ${bench[@]}; do | 145 | for 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 )) |
124 | done | 176 | done |
125 | 177 | ||
178 | echo "Done. Creating cleanup handler..." | ||
179 | function 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 | ||
205 | trap cleanup EXIT | ||
206 | |||
126 | echo "Done. Checking for wbinvd module..." | 207 | echo "Done. Checking for wbinvd module..." |
127 | if [[ ! -f "/proc/wbinvd" ]]; then | 208 | if [[ ! -f "/proc/wbinvd" ]]; then |
128 | echo "ERROR: wbinvd module not loaded. Exiting..." | 209 | echo "ERROR: wbinvd module not loaded. Exiting..." |
129 | exit | 210 | exit |
130 | fi | 211 | fi |
131 | 212 | ||
132 | echo "Done. Setting core $core to 'performance'..." | 213 | echo "Done. Setting cores to 'performance'..." |
133 | echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor | 214 | echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor |
215 | if [[ -v core_two ]]; then | ||
216 | echo "performance" > /sys/devices/system/cpu/cpu$core_two/cpufreq/scaling_governor | ||
217 | fi | ||
134 | 218 | ||
135 | # Enable L3 isolation | 219 | # Enable L3 isolation |
136 | echo "Done. Enabling L3 isolation..." | 220 | echo "Done. Setting up L3 isolation..." |
137 | mount -t resctrl resctrl /sys/fs/resctrl | 221 | mount -t resctrl resctrl /sys/fs/resctrl |
138 | mkdir -p /sys/fs/resctrl/benchmarks | ||
139 | echo $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 |
141 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | 223 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata |
142 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | 224 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata |
143 | # Alloc L3 to benchmark | 225 | # Alloc L3 to benchmark |
144 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata | 226 | # (this logic is safe when $core_two is empty) |
145 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | 227 | if [[ $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" | ||
237 | elif [[ $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" | ||
248 | else | ||
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" | ||
257 | fi | ||
146 | echo "Done. Verifying configuration with user..." | 258 | echo "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 |
153 | echo "=== Global Config ===" | 265 | echo "=== Global Config ===" |
154 | cat /sys/fs/resctrl/schemata | 266 | cat /sys/fs/resctrl/schemata |
155 | echo "=== Core $core Config ===" | 267 | echo "=== NUMA Config ===" |
268 | echo " '$numa_arg0' and '$numa_arg1'" | ||
269 | echo "=== Core $(cat /sys/fs/resctrl/benchmarks/cpus_list) Config ===" | ||
156 | cat /sys/fs/resctrl/benchmarks/schemata | 270 | cat /sys/fs/resctrl/benchmarks/schemata |
271 | if [[ -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 | ||
274 | fi | ||
275 | |||
157 | if [[ -v contend ]]; then | 276 | if [[ -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 |
164 | else | 279 | else |
165 | runID=$runID-xc | 280 | runID=$runID-xc |
166 | fi | 281 | fi |
167 | if uname -a | grep -q "mc2"; then | 282 | |
168 | echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled." | 283 | runID=$runID-$iso_mode |
169 | runID=$runID-i | 284 | |
285 | if [[ -v async ]]; then | ||
286 | echo "Will use asynchronous job pairing" | ||
287 | runID=$runID-async | ||
288 | fi | ||
289 | |||
290 | if [[ $mode == "pair" && ! -v async ]]; then | ||
291 | echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" | ||
170 | else | 292 | else |
171 | echo "MC^2 not detected." | 293 | echo "Results will be saved as $runID-$userRunID.txt" |
172 | runID=$runID-xi | 294 | fi |
295 | |||
296 | if [[ $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 "!!!!!!!!!!!!!!!!!!" | ||
173 | fi | 302 | fi |
174 | echo "Results will be saved as $runID-$userRunID.txt" | ||
175 | echo "Press enter to confirm environment, Ctrl-C to exit..." | 303 | echo "Press enter to confirm environment, Ctrl-C to exit..." |
176 | read | 304 | read |
177 | 305 | ||
@@ -194,38 +322,72 @@ FAIL_COLOR="\033[0;31m" | |||
194 | GOOD_COLOR="\033[0;32m" | 322 | GOOD_COLOR="\033[0;32m" |
195 | RESET_COLOR="\033[0m" | 323 | RESET_COLOR="\033[0m" |
196 | 324 | ||
197 | num_tests=$(wc -l < $benchNames) | ||
198 | # For each benchmark | 325 | # For each benchmark |
199 | for (( i = 0; i < $num_tests ; i++ )); do | 326 | for (( 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 |
235 | done | 397 | done |
236 | 398 | ||
237 | # End contending tasks | ||
238 | if [[ -v contend ]]; then | ||
239 | killall thrasher | ||
240 | fi | ||
241 | |||
242 | # Put smp_affinty back the way it was | ||
243 | i=0 | ||
244 | for IRQ in /proc/irq/* | ||
245 | do | ||
246 | if [ -d $IRQ ]; then | ||
247 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
248 | fi | ||
249 | i=$(( $i + 1 )) | ||
250 | done | ||
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 | |||
3 | maxJobs=$1 | ||
4 | runID=$2 | ||
5 | |||
6 | if [ $# -lt 2 ]; then | ||
7 | echo "Usage $0 <number of iterations> <run ID>" | ||
8 | exit | ||
9 | fi | ||
10 | |||
11 | date | ||
12 | cd baseline | ||
13 | make all | ||
14 | ../interference-benchmark/deactivateCoresSMT.bash | ||
15 | ./run_baseline.sh 15 $maxJobs $runID | ||
16 | date | ||
17 | cd ../all_pairs | ||
18 | ../../interference-benchmark/activateCores.bash | ||
19 | make all | ||
20 | ./run_all_pairs.sh 15 31 $maxJobs $runID | ||
21 | date | ||
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 | |||
6 | if uname -a | grep -q mc2; then | ||
7 | echo "You need to run this without MC^2!" | ||
8 | exit | ||
9 | fi | ||
10 | |||
11 | if [ "$EUID" -ne 0 ]; then | ||
12 | echo "You need to be root to enable interrupt isolation and real-time execution!" | ||
13 | exit | ||
14 | fi | ||
15 | |||
16 | echo "This will run the contended and uncontended TACLe baseline, all-pairs, and Level-C micro-benchamarks in non-interactive mode." | ||
17 | echo "Please press enter to confirm (Ctrl-C to abort)..." | ||
18 | read | ||
19 | |||
20 | echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor | ||
21 | echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governor | ||
22 | |||
23 | cd baseline | ||
24 | baseNo=baseline/$(date +"%b%d-%H")-xc-xi-1k.txt | ||
25 | echo "" | ../run_bench.sh -m base -p 15 -l 1001 -b ../all_pairs/tacleNames.txt 1k | ||
26 | baseYes=baseline/$(date +"%b%d-%H")-c-xi-1k.txt | ||
27 | echo "" | ../run_bench.sh -B -m make -p 15 -l 1001 -b ../all_pairs/tacleNames.txt 1k | ||
28 | |||
29 | cd ../all_pairs | ||
30 | pairsNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k | ||
31 | echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt | ||
32 | pairsYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k | ||
33 | echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt --contend | ||
34 | |||
35 | cd ../baseline | ||
36 | echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt | ||
37 | cNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k-LC-TACLe.txt | ||
38 | echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt --contend | ||
39 | cYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k-LC-TACLe.txt | ||
40 | |||
41 | echo "==== DONE ===" | ||
42 | echo "Results are in:" | ||
43 | echo "- "$baseNo | ||
44 | echo "- "$baseYes | ||
45 | echo "- "$pairsNo" (A/B)" | ||
46 | echo "- "$pairsYes" (A/B)" | ||
47 | echo "- "$cNo | ||
48 | echo "- "$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 | |||
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 | echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
65 | echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
66 | # Reset global bandwith control and remove L3 from global | ||
67 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
68 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
69 | # Alloc L3 to benchmark | ||
70 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata | ||
71 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
72 | echo "Done. Verifying configuration with user..." | ||
73 | |||
74 | # Generate file name string | ||
75 | # We append to this as we parse the environment settings | ||
76 | runID=$(date +"%b%d-%H") | ||
77 | |||
78 | # Confirm configuration with user | ||
79 | echo "=== Global Config ===" | ||
80 | cat /sys/fs/resctrl/schemata | ||
81 | echo "=== Core $firstCore and $secondCore Config ===" | ||
82 | cat /sys/fs/resctrl/benchmarks/schemata | ||
83 | if [[ $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 | ||
90 | else | ||
91 | runID=$runID-xc | ||
92 | fi | ||
93 | if uname -a | grep -q "mc2"; then | ||
94 | echo "MC^2 Autodetected. Cache coloring will be DISABLED." | ||
95 | runID=$runID-i | ||
96 | else | ||
97 | echo "MC^2 not detected. Cache coloring will be DISABLED." | ||
98 | runID=$runID-xi | ||
99 | fi | ||
100 | echo "Results will be saved as $runID-$userRunID-LC-DIS.txt" | ||
101 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
102 | read | ||
103 | |||
104 | # Start contending tasks | ||
105 | if [[ $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 & | ||
114 | fi | ||
115 | sleep 1 # Wait for contending tasks to start | ||
116 | echo "Done. Beginning benchmarks..." | ||
117 | |||
118 | num_tests=$(wc -l < $tacleNames) | ||
119 | for (( i = 0; i < $num_tests ; i++ )) | ||
120 | do | ||
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]} | ||
154 | done | ||
155 | |||
156 | # End contending tasks | ||
157 | if [[ $6 == "--contend" ]]; then | ||
158 | killall thrasher | ||
159 | fi | ||
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 | ||
167 | i=0 | ||
168 | for IRQ in /proc/irq/* | ||
169 | do | ||
170 | if [ -d $IRQ ]; then | ||
171 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
172 | fi | ||
173 | i=$(( $i + 1 )) | ||
174 | done | ||
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 | |||
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 | echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
65 | echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
66 | # Reset global bandwith control and remove L3 from global | ||
67 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
68 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
69 | # Alloc L3 to benchmark | ||
70 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata | ||
71 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
72 | echo "Done. Verifying configuration with user..." | ||
73 | |||
74 | # Generate file name string | ||
75 | # We append to this as we parse the environment settings | ||
76 | runID=$(date +"%b%d-%H") | ||
77 | |||
78 | # Confirm configuration with user | ||
79 | echo "=== Global Config ===" | ||
80 | cat /sys/fs/resctrl/schemata | ||
81 | echo "=== Core $firstCore and $secondCore Config ===" | ||
82 | cat /sys/fs/resctrl/benchmarks/schemata | ||
83 | if [[ $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 | ||
90 | else | ||
91 | runID=$runID-xc | ||
92 | fi | ||
93 | if uname -a | grep -q "mc2"; then | ||
94 | echo "MC^2 Autodetected. Cache coloring will be DISABLED." | ||
95 | runID=$runID-i | ||
96 | else | ||
97 | echo "MC^2 not detected. Cache coloring will be DISABLED." | ||
98 | runID=$runID-xi | ||
99 | fi | ||
100 | echo "Results will be saved as $runID-$userRunID-LC-TACLe.txt" | ||
101 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
102 | read | ||
103 | |||
104 | # Start contending tasks | ||
105 | if [[ $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 & | ||
114 | fi | ||
115 | sleep 1 # Wait for contending tasks to start | ||
116 | echo "Done. Beginning benchmarks..." | ||
117 | |||
118 | num_tests=$(wc -l < $tacleNames) | ||
119 | for (( i = 0; i < $num_tests ; i++ )) | ||
120 | do | ||
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]} | ||
140 | done | ||
141 | |||
142 | # End contending tasks | ||
143 | if [[ $6 == "--contend" ]]; then | ||
144 | killall thrasher | ||
145 | fi | ||
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 | ||
153 | i=0 | ||
154 | for IRQ in /proc/irq/* | ||
155 | do | ||
156 | if [ -d $IRQ ]; then | ||
157 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
158 | fi | ||
159 | i=$(( $i + 1 )) | ||
160 | done | ||
161 | |||