From 03412b9f841f140b9b7410a1890298e3ac2835db Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Tue, 20 Oct 2020 13:35:52 -0400 Subject: 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 --- all_pairs/source/epic/epic.c | 25 +++-- all_pairs/source/rijndael_enc/rijndael_enc.c | 24 +++-- baseline/run_baseline.sh | 156 --------------------------- baseline/source/epic/epic.c | 25 +++-- baseline/source/rijndael_enc/rijndael_enc.c | 24 +++-- dis/Field/field.c | 14 +-- dis/Matrix/ver2/matrix.c | 6 +- dis/Neighborhood/neighborhood.c | 33 +++--- dis/Pointer/pointer.c | 9 +- dis/Transitive/transitive.c | 10 +- dis/Update/update.c | 4 +- run_bench.sh | 156 +++++++++++++++++++++++++++ 12 files changed, 259 insertions(+), 227 deletions(-) delete mode 100755 baseline/run_baseline.sh create mode 100755 run_bench.sh diff --git a/all_pairs/source/epic/epic.c b/all_pairs/source/epic/epic.c index a1e344c..ed08040 100644 --- a/all_pairs/source/epic/epic.c +++ b/all_pairs/source/epic/epic.c @@ -598,7 +598,7 @@ void epic_main( void ); Declaration of global variables */ -float epic_filtertemp[FILTER_SIZE]; +float epic_filtertemp[FILTER_SIZE*2]; // *2 to work around memory corruption issue float epic_hi_imagetemp[X_SIZE * Y_SIZE / 2]; float epic_lo_imagetemp[X_SIZE * Y_SIZE / 2]; @@ -1129,13 +1129,18 @@ int epic_return(){ int main( int argc, char **argv ) { - SET_UP - for (jobsComplete=0; jobsComplete [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 3 ]; then - echo "Using alternate list of TACLe benchmarks from $4" - tacleNames=$4 -fi - -if [ "$EUID" -ne 0 ] -then - echo "You need to be root to enable interrupt isolation and real-time execution!" - exit -fi - -echo "Making sure that binaries are up to date..." -while read i; do - make bin/$i -done < $tacleNames -echo "Done. Disabling real-time throttling..." - -# Turn off rt throttling -echo -1 > /proc/sys/kernel/sched_rt_runtime_us -echo "Done. Redirecting all interrupts to core 0..." - -# Redirect all interrupts to core 0 -i=0 -for IRQ in /proc/irq/* -do - # Skip default_smp_affinity - if [ -d $IRQ ]; then - irqList[$i]=$(cat $IRQ/smp_affinity_list) - echo 0 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - -# Read the names of each benchmark -j=0 -while read i; do - tacleProg[$j]=$i - j=$(( $j + 1 )) -done < $tacleNames - -echo "Done. Checking for wbinvd module..." -if [[ ! -f "/proc/wbinvd" ]]; then - echo "ERROR: wbinvd module not loaded. Exiting..." - exit -fi - -echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." -echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor -echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -echo $1 > /sys/fs/resctrl/benchmarks/cpus_list -# Reset global bandwith control and remove L3 from global -echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata -# Alloc L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata -echo "Done. Verifying configuration with user..." - -# Generate file name string -# We append to this as we parse the environment settings -runID=$(date +"%b%d-%H") - -# Confirm configuration with user -echo "=== Global Config ===" -cat /sys/fs/resctrl/schemata -echo "=== Core $1 Config ===" -cat /sys/fs/resctrl/benchmarks/schemata -if [[ $5 == "--contend" ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not fonud. Exiting..." - exit - fi - echo "Will run 6 contending tasks" - runID=$runID-c -else - runID=$runID-xc -fi -if uname -a | grep -q "mc2"; then - echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled." - runID=$runID-i -else - echo "MC^2 not detected." - runID=$runID-xi -fi -if pwd | grep -qi dis; then - echo "Autodetected DIS. Will use script-level looping." -fi -echo "Results will be saved as $runID-$userRunID.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $5 == "--contend" ]]; then - echo "Done. Starting 6 contending tasks..." - # Run two contending tasks on each other CCX - taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & - taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & -fi -sleep 1 # Wait for contending tasks to start -echo "Done. Beginning benchmarks..." - -num_tests=$(wc -l < $tacleNames) -for (( i = 0; i < $num_tests ; i++ )) -do - # If using DIS, we have to iterate in the script as DIS won't do it for us - pwd | grep -qi dis - iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") - for ((k=0;k<=iters;k++)); do - # Check if we're using LITMUS^RT or not - if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then - ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 - else - # Interleave memory allocations between all nodes (only 1 node w/out MC^2) - chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 -#chrt -r 97 numactl -m 0 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID-NOINTERLEAVE 1 - fi - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $5 == "--contend" ]]; then - killall thrasher -fi - -# Put smp_affinty back the way it was -i=0 -for IRQ in /proc/irq/* -do - if [ -d $IRQ ]; then - echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list - fi - i=$(( $i + 1 )) -done - diff --git a/baseline/source/epic/epic.c b/baseline/source/epic/epic.c index a1e344c..ed08040 100644 --- a/baseline/source/epic/epic.c +++ b/baseline/source/epic/epic.c @@ -598,7 +598,7 @@ void epic_main( void ); Declaration of global variables */ -float epic_filtertemp[FILTER_SIZE]; +float epic_filtertemp[FILTER_SIZE*2]; // *2 to work around memory corruption issue float epic_hi_imagetemp[X_SIZE * Y_SIZE / 2]; float epic_lo_imagetemp[X_SIZE * Y_SIZE / 2]; @@ -1129,13 +1129,18 @@ int epic_return(){ int main( int argc, char **argv ) { - SET_UP - for (jobsComplete=0; jobsComplete [TACLe names file] [--contend]" + exit +fi + +if [ $# -gt 3 ]; then + echo "Using alternate list of TACLe benchmarks from $4" + tacleNames=$4 +fi + +if [ "$EUID" -ne 0 ] +then + echo "You need to be root to enable interrupt isolation and real-time execution!" + exit +fi + +echo "Making sure that binaries are up to date..." +while read i; do + make bin/$i +done < $tacleNames +echo "Done. Disabling real-time throttling..." + +# Turn off rt throttling +echo -1 > /proc/sys/kernel/sched_rt_runtime_us +echo "Done. Redirecting all interrupts to core 0..." + +# Redirect all interrupts to core 0 +i=0 +for IRQ in /proc/irq/* +do + # Skip default_smp_affinity + if [ -d $IRQ ]; then + irqList[$i]=$(cat $IRQ/smp_affinity_list) + echo 0 2> /dev/null > $IRQ/smp_affinity_list + fi + i=$(( $i + 1 )) +done + +# Read the names of each benchmark +j=0 +while read i; do + tacleProg[$j]=$i + j=$(( $j + 1 )) +done < $tacleNames + +echo "Done. Checking for wbinvd module..." +if [[ ! -f "/proc/wbinvd" ]]; then + echo "ERROR: wbinvd module not loaded. Exiting..." + exit +fi + +echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." +echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor +echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo + +# Enable L3 isolation +echo "Done. Enabling L3 isolation..." +mount -t resctrl resctrl /sys/fs/resctrl +mkdir -p /sys/fs/resctrl/benchmarks +echo $1 > /sys/fs/resctrl/benchmarks/cpus_list +# Reset global bandwith control and remove L3 from global +echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata +echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata +# Alloc L3 to benchmark +echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata +echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata +echo "Done. Verifying configuration with user..." + +# Generate file name string +# We append to this as we parse the environment settings +runID=$(date +"%b%d-%H") + +# Confirm configuration with user +echo "=== Global Config ===" +cat /sys/fs/resctrl/schemata +echo "=== Core $1 Config ===" +cat /sys/fs/resctrl/benchmarks/schemata +if [[ $5 == "--contend" ]]; then + if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then + echo "ERROR: thrasher binary not fonud. Exiting..." + exit + fi + echo "Will run 6 contending tasks" + runID=$runID-c +else + runID=$runID-xc +fi +if uname -a | grep -q "mc2"; then + echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled." + runID=$runID-i +else + echo "MC^2 not detected." + runID=$runID-xi +fi +if pwd | grep -qi dis; then + echo "Autodetected DIS. Will use script-level looping." +fi +echo "Results will be saved as $runID-$userRunID.txt" +echo "Press enter to confirm environment, Ctrl-C to exit..." +read + +# Start contending tasks +if [[ $5 == "--contend" ]]; then + echo "Done. Starting 6 contending tasks..." + # Run two contending tasks on each other CCX + taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & + taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher & + taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher & + taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher & + taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher & + taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher & +fi +sleep 1 # Wait for contending tasks to start +echo "Done. Beginning benchmarks..." + +num_tests=$(wc -l < $tacleNames) +for (( i = 0; i < $num_tests ; i++ )) +do + # If using DIS, we have to iterate in the script as DIS won't do it for us + pwd | grep -qi dis + iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") + for ((k=0;k<=iters;k++)); do + # Check if we're using LITMUS^RT or not + if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then + ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 + else + # Interleave memory allocations between all nodes (only 1 node w/out MC^2) + chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 +#chrt -r 97 numactl -m 0 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID-NOINTERLEAVE 1 + fi + done + echo COMPLETE: ${tacleProg[$i]} +done + +# End contending tasks +if [[ $5 == "--contend" ]]; then + killall thrasher +fi + +# Put smp_affinty back the way it was +i=0 +for IRQ in /proc/irq/* +do + if [ -d $IRQ ]; then + echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list + fi + i=$(( $i + 1 )) +done + -- cgit v1.2.2