diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-17 21:22:08 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-17 21:30:01 -0400 |
| commit | ecf6547fdce39b3ec0f333c9b391b0f1c25deba5 (patch) | |
| tree | c6f25afe348be22172bed024ffe8881323e74aaf /dis/run_pair_convexity.sh | |
| parent | 1120161286ee5c855b630bccc9e0b37bb8a3ee65 (diff) | |
All the DIS runner scripts as used for the (rejected) RTSS'20 submission
DANGER! There's an inconsistency in the input files used for the
all-pairs tests and those used for the baseline tests.
Baselines: run_all_dis.sh calls run_dis.sh to do all baselines.
All-pairs: Uses old TACLe script (not included here).
Cache allocation 2nd-order effects on SMT friendliness: run_pair_convexity.sh
Diffstat (limited to 'dis/run_pair_convexity.sh')
| -rw-r--r-- | dis/run_pair_convexity.sh | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/dis/run_pair_convexity.sh b/dis/run_pair_convexity.sh new file mode 100644 index 0000000..a4e204f --- /dev/null +++ b/dis/run_pair_convexity.sh | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | firstCore=$1 | ||
| 4 | secondCore=$2 | ||
| 5 | maxJobs=$3 | ||
| 6 | userRunID=$4 | ||
| 7 | #template_input=$9 | ||
| 8 | tacleNames=tacleNames.txt | ||
| 9 | |||
| 10 | if [ $# -lt 7 ]; then | ||
| 11 | echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [bench names file] [WSS setings] [cache settings] [--contend]" # [input file]" | ||
| 12 | exit | ||
| 13 | fi | ||
| 14 | |||
| 15 | if [ $# -gt 4 ]; then | ||
| 16 | echo "Using list of benchmarks from $5" | ||
| 17 | tacleNames=$5 | ||
| 18 | fi | ||
| 19 | |||
| 20 | if [ $# -gt 5 ]; then | ||
| 21 | echo "Using WSS settings from $6" | ||
| 22 | wss_settings=$6 | ||
| 23 | fi | ||
| 24 | |||
| 25 | if [ $# -gt 6 ]; then | ||
| 26 | echo "Using cache settings from $7" | ||
| 27 | cache_settings=$7 | ||
| 28 | fi | ||
| 29 | #echo "Using template input from $9" | ||
| 30 | |||
| 31 | if [ "$EUID" -ne 0 ] | ||
| 32 | then | ||
| 33 | echo "You need to be root to enable interrupt isolation and real-time execution!" | ||
| 34 | exit | ||
| 35 | fi | ||
| 36 | |||
| 37 | echo "Making sure that binaries are up to date..." | ||
| 38 | while read i; do | ||
| 39 | make bin/$i | ||
| 40 | done < $tacleNames | ||
| 41 | echo "Done. Disabling real-time throttling..." | ||
| 42 | |||
| 43 | # Turn off rt throttling | ||
| 44 | echo -1 > /proc/sys/kernel/sched_rt_runtime_us | ||
| 45 | echo "Done. Redirecting all interrupts to core 0..." | ||
| 46 | |||
| 47 | # Redirect all interrupts to core 0 | ||
| 48 | i=0 | ||
| 49 | for IRQ in /proc/irq/* | ||
| 50 | do | ||
| 51 | # Skip default_smp_affinity | ||
| 52 | if [ -d $IRQ ]; then | ||
| 53 | irqList[$i]=$(cat $IRQ/smp_affinity_list) | ||
| 54 | echo 0 2> /dev/null > $IRQ/smp_affinity_list | ||
| 55 | fi | ||
| 56 | i=$(( $i + 1 )) | ||
| 57 | done | ||
| 58 | |||
| 59 | # Read the names of each benchmark | ||
| 60 | j=0 | ||
| 61 | while read i; do | ||
| 62 | tacleProg[$j]=$i | ||
| 63 | j=$(( $j + 1 )) | ||
| 64 | done < $tacleNames | ||
| 65 | |||
| 66 | echo "Done. Checking for wbinvd module..." | ||
| 67 | if [[ ! -f "/proc/wbinvd" ]]; then | ||
| 68 | echo "ERROR: wbinvd module not loaded. Exiting..." | ||
| 69 | exit | ||
| 70 | fi | ||
| 71 | |||
| 72 | echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." | ||
| 73 | echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor | ||
| 74 | echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governor | ||
| 75 | |||
| 76 | # Enable L3 isolation | ||
| 77 | echo "Done. Enabling L3 isolation..." | ||
| 78 | mount -t resctrl resctrl /sys/fs/resctrl | ||
| 79 | mkdir -p /sys/fs/resctrl/benchmarks | ||
| 80 | mkdir -p /sys/fs/resctrl/benchmarks2 | ||
| 81 | echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list | ||
| 82 | echo $secondCore > /sys/fs/resctrl/benchmarks2/cpus_list | ||
| 83 | # Reset global bandwith control and remove L3 from global | ||
| 84 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
| 85 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
| 86 | # Alloc L3 to benchmark | ||
| 87 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata | ||
| 88 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks2/schemata | ||
| 89 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
| 90 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks2/schemata | ||
| 91 | echo "Done. Verifying configuration with user..." | ||
| 92 | |||
| 93 | # Generate file name string | ||
| 94 | # We append to this as we parse the environment settings | ||
| 95 | runID=$(date +"%b%d-%H") | ||
| 96 | |||
| 97 | # Confirm configuration with user | ||
| 98 | echo "=== Global Config ===" | ||
| 99 | cat /sys/fs/resctrl/schemata | ||
| 100 | echo "=== Core $firstCore and $secondCore Config ===" | ||
| 101 | cat /sys/fs/resctrl/benchmarks/schemata | ||
| 102 | if [[ $8 == "--contend" ]]; then | ||
| 103 | if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then | ||
| 104 | echo "ERROR: thrasher binary not fonud. Exiting..." | ||
| 105 | exit | ||
| 106 | fi | ||
| 107 | echo "Will run 6 contending tasks" | ||
| 108 | runID=$runID-c | ||
| 109 | else | ||
| 110 | runID=$runID-xc | ||
| 111 | fi | ||
| 112 | if uname -a | grep -q "mc2"; then | ||
| 113 | echo "MC^2 Autodetected. Cache coloring will be enabled." | ||
| 114 | runID=$runID-i | ||
| 115 | else | ||
| 116 | echo "MC^2 not detected. This benchmark requires MC^2! Exiting..." | ||
| 117 | exit | ||
| 118 | fi | ||
| 119 | echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" | ||
| 120 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
| 121 | read | ||
| 122 | |||
| 123 | # Start contending tasks | ||
| 124 | if [[ $8 == "--contend" ]]; then | ||
| 125 | echo "Done. Starting 6 contending tasks..." | ||
| 126 | # Run two contending tasks on each other CCX | ||
| 127 | taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 128 | taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 129 | taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 130 | taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 131 | taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 132 | taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 133 | fi | ||
| 134 | sleep 1 # Wait for contending tasks to start | ||
| 135 | echo "Done. Beginning benchmarks..." | ||
| 136 | |||
| 137 | num_tests=$(wc -l < $tacleNames) | ||
| 138 | for (( ii = 0; ii < $num_tests ; ii++ )) | ||
| 139 | do | ||
| 140 | for (( jj = $ii+1; jj < $num_tests ; jj++ )) #loop through programs | ||
| 141 | do | ||
| 142 | # Execute the benchmark for each WSS and cache config | ||
| 143 | while read k; do | ||
| 144 | echo $k > /sys/fs/resctrl/benchmarks/schemata | ||
| 145 | while read j; do | ||
| 146 | echo $j > /sys/fs/resctrl/benchmarks2/schemata | ||
| 147 | while read i; do | ||
| 148 | ./gen_input.py matrix inputs/Matrix/in0 $i | chrt -r 97 numactl -m 0 taskset -c $firstCore ./${tacleProg[$ii]} ${tacleProg[$ii]}-$i-$k $maxJobs $firstCore $secondCore ${tacleProg[$jj]}-$i-$j $runID-$userRunID-A 1 > /dev/null & PID1=$!; | ||
| 149 | ./gen_input.py transitive inputs/Transitive/in0 $i | chrt -r 97 numactl -m 1 taskset -c $secondCore ./${tacleProg[$jj]} ${tacleProg[$jj]}-$i-$j $maxJobs $secondCore $firstCore ${tacleProg[$ii]}-$i-$k $runID-$userRunID-B 2 > /dev/null & PID2=$!; | ||
| 150 | wait $PID1 $PID2 | ||
| 151 | done < $wss_settings | ||
| 152 | echo "Done with $k $j" | ||
| 153 | done < $cache_settings | ||
| 154 | done < $cache_settings | ||
| 155 | |||
| 156 | # ./gen_input.py $benchmark $template_input $i | chrt -r 97 numactl -m 0 taskset -c $core ./$benchmark $benchmark-$i-$j $maxJobs $core $runID 1 | ||
| 157 | # chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!; | ||
| 158 | # chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!; | ||
| 159 | # wait $PID1 $PID2 | ||
| 160 | echo ${tacleProg[$i]} ${tacleProg[$j]} | ||
| 161 | done | ||
| 162 | echo COMPLETE: ${tacleProg[$i]} | ||
| 163 | done | ||
| 164 | |||
| 165 | # End contending tasks | ||
| 166 | if [[ $8 == "--contend" ]]; then | ||
| 167 | killall thrasher | ||
| 168 | fi | ||
| 169 | |||
| 170 | # Remove semaphores from system | ||
| 171 | # Leaving them won't hurt these tests, but would be messy and is bad practice | ||
| 172 | # TODO: Do this directly in the benchmarks. They should clean up after themselves | ||
| 173 | ./bin/cleanupSemaphores | ||
| 174 | |||
| 175 | # Put smp_affinty back the way it was | ||
| 176 | i=0 | ||
| 177 | for IRQ in /proc/irq/* | ||
| 178 | do | ||
| 179 | if [ -d $IRQ ]; then | ||
| 180 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
| 181 | fi | ||
| 182 | i=$(( $i + 1 )) | ||
| 183 | done | ||
| 184 | |||
