diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-20 18:20:39 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-20 18:23:06 -0400 |
| commit | ec0512af6bbb8ba05eb13fc1aac7754283dd13aa (patch) | |
| tree | 17b31bba227776734555f9dde3ad17aa39aa54f4 /run_bench.sh | |
| parent | dd606a16e840880e7617b140f6083af8ea83b6b7 (diff) | |
Unify unpaired timing scripts for DIS, TACLe, and SD-VBS
Now supports specifying an input generation command for
each benchmark - see dis/dis2MbInNames.txt for an example.
Diffstat (limited to 'run_bench.sh')
| -rwxr-xr-x | run_bench.sh | 181 |
1 files changed, 138 insertions, 43 deletions
diff --git a/run_bench.sh b/run_bench.sh index c5b67b6..4e09faa 100755 --- a/run_bench.sh +++ b/run_bench.sh | |||
| @@ -1,30 +1,110 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | core=$1 | 3 | if [ $# -lt 5 ]; then |
| 4 | maxJobs=$2 | 4 | echo "Usage $0 -m MODE -p CPU -l LOOPS -b FILE [-c] RUN_ID" |
| 5 | userRunID=$3 | 5 | echo " -m base|dis Which benchmarking mode to use" |
| 6 | tacleNames=tacleNames.txt | 6 | echo " -p CPU Which CPU to run each benchmark on" |
| 7 | echo " -l LOOPS How many loops of each benchmark to do" | ||
| 8 | echo " -b FILE List of benchmarks to execute. Optional tab-" | ||
| 9 | echo " delimited 2nd column specifies an input" | ||
| 10 | echo " generation command (fed to bench via stdin)" | ||
| 11 | echo " -B Enable background contenders on other CCXes" | ||
| 12 | echo "Mode base requires no additional options." | ||
| 13 | 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" | ||
| 15 | echo " -T FILE Input template to pass to gen_input.py" | ||
| 16 | echo " -C FILE List of cache configurations to test" | ||
| 17 | exit | ||
| 18 | fi | ||
| 7 | 19 | ||
| 8 | if [ $# -lt 3 ]; then | 20 | # Name options similarly to rtspin |
| 9 | echo "Usage $0 <core ID> <number of iterations> <run ID> [TACLe names file] [--contend]" | 21 | while getopts “m:p:l:b:BW:T:C:” opt; do |
| 22 | case $opt in | ||
| 23 | # Required | ||
| 24 | m) mode=$OPTARG ;; | ||
| 25 | p) core=$OPTARG ;; | ||
| 26 | l) maxJobs=$OPTARG ;; | ||
| 27 | b) benchNames=$OPTARG ;; | ||
| 28 | # Optional | ||
| 29 | B) contend=1 ;; | ||
| 30 | W) wss_settings=$OPTARG ;; | ||
| 31 | T) template_input=$OPTARG ;; | ||
| 32 | C) cache_settings=$OPTARG ;; | ||
| 33 | esac | ||
| 34 | done | ||
| 35 | # Reset to read operands | ||
| 36 | shift $((OPTIND -1)) | ||
| 37 | userRunID=$1 | ||
| 38 | |||
| 39 | # Required argument checking | ||
| 40 | if [[ "$mode" != "base" ]] && [[ "$mode" != "dis" ]]; then | ||
| 41 | echo "Invalid argument: MODE must be either 'base' or 'dis'" | ||
| 42 | exit | ||
| 43 | fi | ||
| 44 | if [[ ! -v core ]] || [[ ! -v maxJobs ]] || [[ ! -v benchNames ]]; then | ||
| 45 | echo "Missing argument: -p, -l, and -b are required" | ||
| 46 | exit | ||
| 47 | fi | ||
| 48 | if [[ ! -f "$benchNames" ]]; then | ||
| 49 | echo "Invalid argument: $benchNames des not exist" | ||
| 50 | exit | ||
| 51 | fi | ||
| 52 | if [[ ! -v userRunID ]]; then | ||
| 53 | echo "Missing argument: RUN_ID is required" | ||
| 10 | exit | 54 | exit |
| 11 | fi | 55 | fi |
| 12 | 56 | ||
| 13 | if [ $# -gt 3 ]; then | 57 | # DIS argument checking |
| 14 | echo "Using alternate list of TACLe benchmarks from $4" | 58 | if [[ "$mode" == "dis" ]] && [[ ! -v wss_settings || ! -v template_input || -z $cache_settings ]]; then |
| 15 | tacleNames=$4 | 59 | echo "Missing argument: DIS needs -W FILE -T FILE and -C FILE" |
| 60 | exit | ||
| 61 | fi | ||
| 62 | if [[ "$mode" == "dis" ]] && [[ ! -f "$wss_settings" ]]; then | ||
| 63 | echo "Invalid argument: $wss_settings does not exist" | ||
| 64 | exit | ||
| 65 | fi | ||
| 66 | if [[ "$mode" == "dis" ]] && [[ ! -f "$template_input" ]]; then | ||
| 67 | echo "Invalid argument: $template_input does not exist" | ||
| 68 | exit | ||
| 69 | fi | ||
| 70 | if [[ "$mode" == "dis" ]] && [[ ! -f "$cache_settings" ]]; then | ||
| 71 | echo "Invalid argument: $cache_settings does not exist" | ||
| 72 | exit | ||
| 16 | fi | 73 | fi |
| 17 | 74 | ||
| 75 | # Check permissions and update state | ||
| 18 | if [ "$EUID" -ne 0 ] | 76 | if [ "$EUID" -ne 0 ] |
| 19 | then | 77 | then |
| 20 | echo "You need to be root to enable interrupt isolation and real-time execution!" | 78 | echo "You need to be root to enable interrupt isolation and real-time execution!" |
| 21 | exit | 79 | exit |
| 22 | fi | 80 | fi |
| 23 | 81 | ||
| 24 | echo "Making sure that binaries are up to date..." | 82 | echo "Done. Loading benchmark names and input..." |
| 83 | |||
| 84 | # Read the names of each benchmark and load input. | ||
| 85 | # This might look a bit scary, but all it does is | ||
| 86 | # separate the two fields (1 or more tabs in-between), | ||
| 87 | # save the benchmark name, and execute the input | ||
| 88 | # command (storing its output in-memory for later). | ||
| 89 | j=0 | ||
| 90 | IFS=$'\r\n' | ||
| 25 | while read i; do | 91 | while read i; do |
| 26 | make bin/$i | 92 | bench[$j]=$(echo $i | tr -s "\t" | cut -f1) |
| 27 | done < $tacleNames | 93 | input[$j]=$(eval $(echo $i | tr -s "\t" | cut -s -f2)) |
| 94 | j=$(( $j + 1 )) | ||
| 95 | done < $benchNames | ||
| 96 | echo "Making sure that binaries are up to date..." | ||
| 97 | |||
| 98 | for b in ${bench[@]}; do | ||
| 99 | make bin/$b | ||
| 100 | if [[ $? ]]; then | ||
| 101 | make $b | ||
| 102 | fi | ||
| 103 | if [[ ! -f $b && ! -f "./bin/$b" ]]; then | ||
| 104 | echo "Unable to find benchmark $b" | ||
| 105 | exit | ||
| 106 | fi | ||
| 107 | done | ||
| 28 | echo "Done. Disabling real-time throttling..." | 108 | echo "Done. Disabling real-time throttling..." |
| 29 | 109 | ||
| 30 | # Turn off rt throttling | 110 | # Turn off rt throttling |
| @@ -43,28 +123,20 @@ do | |||
| 43 | i=$(( $i + 1 )) | 123 | i=$(( $i + 1 )) |
| 44 | done | 124 | done |
| 45 | 125 | ||
| 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..." | 126 | echo "Done. Checking for wbinvd module..." |
| 54 | if [[ ! -f "/proc/wbinvd" ]]; then | 127 | if [[ ! -f "/proc/wbinvd" ]]; then |
| 55 | echo "ERROR: wbinvd module not loaded. Exiting..." | 128 | echo "ERROR: wbinvd module not loaded. Exiting..." |
| 56 | exit | 129 | exit |
| 57 | fi | 130 | fi |
| 58 | 131 | ||
| 59 | echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." | 132 | echo "Done. Setting core $core to 'performance'..." |
| 60 | echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor | 133 | echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor |
| 61 | echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo | ||
| 62 | 134 | ||
| 63 | # Enable L3 isolation | 135 | # Enable L3 isolation |
| 64 | echo "Done. Enabling L3 isolation..." | 136 | echo "Done. Enabling L3 isolation..." |
| 65 | mount -t resctrl resctrl /sys/fs/resctrl | 137 | mount -t resctrl resctrl /sys/fs/resctrl |
| 66 | mkdir -p /sys/fs/resctrl/benchmarks | 138 | mkdir -p /sys/fs/resctrl/benchmarks |
| 67 | echo $1 > /sys/fs/resctrl/benchmarks/cpus_list | 139 | echo $core > /sys/fs/resctrl/benchmarks/cpus_list |
| 68 | # Reset global bandwith control and remove L3 from global | 140 | # Reset global bandwith control and remove L3 from global |
| 69 | echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata | 141 | 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 | 142 | echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata |
| @@ -80,9 +152,9 @@ runID=$(date +"%b%d-%H") | |||
| 80 | # Confirm configuration with user | 152 | # Confirm configuration with user |
| 81 | echo "=== Global Config ===" | 153 | echo "=== Global Config ===" |
| 82 | cat /sys/fs/resctrl/schemata | 154 | cat /sys/fs/resctrl/schemata |
| 83 | echo "=== Core $1 Config ===" | 155 | echo "=== Core $core Config ===" |
| 84 | cat /sys/fs/resctrl/benchmarks/schemata | 156 | cat /sys/fs/resctrl/benchmarks/schemata |
| 85 | if [[ $5 == "--contend" ]]; then | 157 | if [[ -v contend ]]; then |
| 86 | if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then | 158 | if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then |
| 87 | echo "ERROR: thrasher binary not fonud. Exiting..." | 159 | echo "ERROR: thrasher binary not fonud. Exiting..." |
| 88 | exit | 160 | exit |
| @@ -99,15 +171,12 @@ else | |||
| 99 | echo "MC^2 not detected." | 171 | echo "MC^2 not detected." |
| 100 | runID=$runID-xi | 172 | runID=$runID-xi |
| 101 | fi | 173 | 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" | 174 | echo "Results will be saved as $runID-$userRunID.txt" |
| 106 | echo "Press enter to confirm environment, Ctrl-C to exit..." | 175 | echo "Press enter to confirm environment, Ctrl-C to exit..." |
| 107 | read | 176 | read |
| 108 | 177 | ||
| 109 | # Start contending tasks | 178 | # Start contending tasks |
| 110 | if [[ $5 == "--contend" ]]; then | 179 | if [[ -v contend ]]; then |
| 111 | echo "Done. Starting 6 contending tasks..." | 180 | echo "Done. Starting 6 contending tasks..." |
| 112 | # Run two contending tasks on each other CCX | 181 | # Run two contending tasks on each other CCX |
| 113 | taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & | 182 | taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & |
| @@ -120,27 +189,53 @@ fi | |||
| 120 | sleep 1 # Wait for contending tasks to start | 189 | sleep 1 # Wait for contending tasks to start |
| 121 | echo "Done. Beginning benchmarks..." | 190 | echo "Done. Beginning benchmarks..." |
| 122 | 191 | ||
| 123 | num_tests=$(wc -l < $tacleNames) | 192 | # Output coloring |
| 124 | for (( i = 0; i < $num_tests ; i++ )) | 193 | FAIL_COLOR="\033[0;31m" |
| 125 | do | ||
