summaryrefslogtreecommitdiffstats
path: root/run_bench.sh
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2020-10-20 18:20:39 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-20 18:23:06 -0400
commitec0512af6bbb8ba05eb13fc1aac7754283dd13aa (patch)
tree17b31bba227776734555f9dde3ad17aa39aa54f4 /run_bench.sh
parentdd606a16e840880e7617b140f6083af8ea83b6b7 (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-xrun_bench.sh181
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
3core=$1 3if [ $# -lt 5 ]; then
4maxJobs=$2 4 echo "Usage $0 -m MODE -p CPU -l LOOPS -b FILE [-c] RUN_ID"
5userRunID=$3 5 echo " -m base|dis Which benchmarking mode to use"
6tacleNames=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
18fi
7 19
8if [ $# -lt 3 ]; then 20# Name options similarly to rtspin
9 echo "Usage $0 <core ID> <number of iterations> <run ID> [TACLe names file] [--contend]" 21while 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
34done
35# Reset to read operands
36shift $((OPTIND -1))
37userRunID=$1
38
39# Required argument checking
40if [[ "$mode" != "base" ]] && [[ "$mode" != "dis" ]]; then
41 echo "Invalid argument: MODE must be either 'base' or 'dis'"
42 exit
43fi
44if [[ ! -v core ]] || [[ ! -v maxJobs ]] || [[ ! -v benchNames ]]; then
45 echo "Missing argument: -p, -l, and -b are required"
46 exit
47fi
48if [[ ! -f "$benchNames" ]]; then
49 echo "Invalid argument: $benchNames des not exist"
50 exit
51fi
52if [[ ! -v userRunID ]]; then
53 echo "Missing argument: RUN_ID is required"
10 exit 54 exit
11fi 55fi
12 56
13if [ $# -gt 3 ]; then 57# DIS argument checking
14 echo "Using alternate list of TACLe benchmarks from $4" 58if [[ "$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
61fi
62if [[ "$mode" == "dis" ]] && [[ ! -f "$wss_settings" ]]; then
63 echo "Invalid argument: $wss_settings does not exist"
64 exit
65fi
66if [[ "$mode" == "dis" ]] && [[ ! -f "$template_input" ]]; then
67 echo "Invalid argument: $template_input does not exist"
68 exit
69fi
70if [[ "$mode" == "dis" ]] && [[ ! -f "$cache_settings" ]]; then
71 echo "Invalid argument: $cache_settings does not exist"
72 exit
16fi 73fi
17 74
75# Check permissions and update state
18if [ "$EUID" -ne 0 ] 76if [ "$EUID" -ne 0 ]
19then 77then
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
22fi 80fi
23 81
24echo "Making sure that binaries are up to date..." 82echo "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).
89j=0
90IFS=$'\r\n'
25while read i; do 91while read i; do
26 make bin/$i 92 bench[$j]=$(echo $i | tr -s "\t" | cut -f1)
27done < $tacleNames 93 input[$j]=$(eval $(echo $i | tr -s "\t" | cut -s -f2))
94 j=$(( $j + 1 ))
95done < $benchNames
96echo "Making sure that binaries are up to date..."
97
98for 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
107done
28echo "Done. Disabling real-time throttling..." 108echo "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 ))
44done 124done
45 125
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..." 126echo "Done. Checking for wbinvd module..."
54if [[ ! -f "/proc/wbinvd" ]]; then 127if [[ ! -f "/proc/wbinvd" ]]; then
55 echo "ERROR: wbinvd module not loaded. Exiting..." 128 echo "ERROR: wbinvd module not loaded. Exiting..."
56 exit 129 exit
57fi 130fi
58 131
59echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." 132echo "Done. Setting core $core to 'performance'..."
60echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor 133echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor
61echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo
62 134
63# Enable L3 isolation 135# Enable L3 isolation
64echo "Done. Enabling L3 isolation..." 136echo "Done. Enabling L3 isolation..."
65mount -t resctrl resctrl /sys/fs/resctrl 137mount -t resctrl resctrl /sys/fs/resctrl
66mkdir -p /sys/fs/resctrl/benchmarks 138mkdir -p /sys/fs/resctrl/benchmarks
67echo $1 > /sys/fs/resctrl/benchmarks/cpus_list 139echo $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
69echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata 141echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
70echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata 142echo "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
81echo "=== Global Config ===" 153echo "=== Global Config ==="
82cat /sys/fs/resctrl/schemata 154cat /sys/fs/resctrl/schemata
83echo "=== Core $1 Config ===" 155echo "=== Core $core Config ==="
84cat /sys/fs/resctrl/benchmarks/schemata 156cat /sys/fs/resctrl/benchmarks/schemata
85if [[ $5 == "--contend" ]]; then 157if [[ -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
101fi 173fi
102if pwd | grep -qi dis; then
103 echo "Autodetected DIS. Will use script-level looping."
104fi
105echo "Results will be saved as $runID-$userRunID.txt" 174echo "Results will be saved as $runID-$userRunID.txt"
106echo "Press enter to confirm environment, Ctrl-C to exit..." 175echo "Press enter to confirm environment, Ctrl-C to exit..."
107read 176read
108 177
109# Start contending tasks 178# Start contending tasks
110if [[ $5 == "--contend" ]]; then 179if [[ -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
120sleep 1 # Wait for contending tasks to start 189sleep 1 # Wait for contending tasks to start
121echo "Done. Beginning benchmarks..." 190echo "Done. Beginning benchmarks..."
122 191
123num_tests=$(wc -l < $tacleNames) 192# Output coloring
124for (( i = 0; i < $num_tests ; i++ )) 193FAIL_COLOR="\033[0;31m"
125do