diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-20 13:35:52 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-20 13:41:49 -0400 |
| commit | 03412b9f841f140b9b7410a1890298e3ac2835db (patch) | |
| tree | 8417ed7fa548a571ab88f139da666787766740f3 /run_bench.sh | |
| parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) | |
TACLe and DIS benchmark fixes
- Use consistent approach to prevent computations from being
optimized out in the DIS benchmarks
- Don't print results in the DIS benchmarks
- Fix a memory corruption in TACLe's "epic" benchmark reflect1()
- Fix return codes for all benchmarks
- Rename run_baseline.sh to run_bench.sh in preperation for this
being the main benchmarking script
Diffstat (limited to 'run_bench.sh')
| -rwxr-xr-x | run_bench.sh | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/run_bench.sh b/run_bench.sh new file mode 100755 index 0000000..c5b67b6 --- /dev/null +++ b/run_bench.sh | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 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 | echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." | ||
| 60 | echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor | ||
| 61 | echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo | ||
| 62 | |||
| 63 | # Enable L3 isolation | ||
| 64 | echo "Done. Enabling L3 isolation..." | ||
| 65 | mount -t resctrl resctrl /sys/fs/resctrl | ||
| 66 | mkdir -p /sys/fs/resctrl/benchmarks | ||
| 67 | echo $1 > /sys/fs/resctrl/benchmarks/cpus_list | ||
| 68 | # Reset global bandwith control and remove L3 from global | ||
| 69 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | ||
| 70 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata | ||
| 71 | # Alloc L3 to benchmark | ||
| 72 | echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata | ||
| 73 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata | ||
| 74 | echo "Done. Verifying configuration with user..." | ||
| 75 | |||
| 76 | # Generate file name string | ||
| 77 | # We append to this as we parse the environment settings | ||
| 78 | runID=$(date +"%b%d-%H") | ||
| 79 | |||
| 80 | # Confirm configuration with user | ||
| 81 | echo "=== Global Config ===" | ||
| 82 | cat /sys/fs/resctrl/schemata | ||
| 83 | echo "=== Core $1 Config ===" | ||
| 84 | cat /sys/fs/resctrl/benchmarks/schemata | ||
| 85 | if [[ $5 == "--contend" ]]; then | ||
| 86 | if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then | ||
| 87 | echo "ERROR: thrasher binary not fonud. Exiting..." | ||
| 88 | exit | ||
| 89 | fi | ||
| 90 | echo "Will run 6 contending tasks" | ||
| 91 | runID=$runID-c | ||
| 92 | else | ||
| 93 | runID=$runID-xc | ||
| 94 | fi | ||
| 95 | if uname -a | grep -q "mc2"; then | ||
| 96 | echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled." | ||
| 97 | runID=$runID-i | ||
| 98 | else | ||
| 99 | echo "MC^2 not detected." | ||
| 100 | runID=$runID-xi | ||
| 101 | fi | ||
| 102 | if pwd | grep -qi dis; then | ||
| 103 | echo "Autodetected DIS. Will use script-level looping." | ||
| 104 | fi | ||
| 105 | echo "Results will be saved as $runID-$userRunID.txt" | ||
| 106 | echo "Press enter to confirm environment, Ctrl-C to exit..." | ||
| 107 | read | ||
| 108 | |||
| 109 | # Start contending tasks | ||
| 110 | if [[ $5 == "--contend" ]]; then | ||
| 111 | echo "Done. Starting 6 contending tasks..." | ||
| 112 | # Run two contending tasks on each other CCX | ||
| 113 | taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 114 | taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 115 | taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 116 | taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 117 | taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 118 | taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & | ||
| 119 | fi | ||
| 120 | sleep 1 # Wait for contending tasks to start | ||
| 121 | echo "Done. Beginning benchmarks..." | ||
| 122 | |||
| 123 | num_tests=$(wc -l < $tacleNames) | ||
| 124 | for (( i = 0; i < $num_tests ; i++ )) | ||
| 125 | do | ||
| 126 | # If using DIS, we have to iterate in the script as DIS won't do it for us | ||
| 127 | pwd | grep -qi dis | ||
| 128 | iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") | ||
| 129 | for ((k=0;k<=iters;k++)); do | ||
| 130 | # Check if we're using LITMUS^RT or not | ||
| 131 | if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then | ||
| 132 | ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 | ||
| 133 | else | ||
| 134 | # Interleave memory allocations between all nodes (only 1 node w/out MC^2) | ||
| 135 | chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 | ||
| 136 | #chrt -r 97 numactl -m 0 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID-NOINTERLEAVE 1 | ||
| 137 | fi | ||
| 138 | done | ||
| 139 | echo COMPLETE: ${tacleProg[$i]} | ||
| 140 | done | ||
| 141 | |||
| 142 | # End contending tasks | ||
| 143 | if [[ $5 == "--contend" ]]; then | ||
| 144 | killall thrasher | ||
| 145 | fi | ||
| 146 | |||
| 147 | # Put smp_affinty back the way it was | ||
| 148 | i=0 | ||
| 149 | for IRQ in /proc/irq/* | ||
| 150 | do | ||
| 151 | if [ -d $IRQ ]; then | ||
| 152 | echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list | ||
| 153 | fi | ||
| 154 | i=$(( $i + 1 )) | ||
| 155 | done | ||
| 156 | |||
