From 3b0aa125061b362b23ecf66afe8319e3a268c874 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 00:08:12 -0400 Subject: Add pair benchmarking and isolation specification into run_bench.sh This allows `run_bench.sh` to replace all previous general paired benchmarking scripts. See `run_everything.sh` for an example of how to use the new script. This also fixes two critical bugs present in the old scripts: 1. The cpus_list was incorrectly set for resctrl when running synchronous pair timing with L2+L3 isolation (i). Each write to that file replaces the previous contents, and it was previously written once for each core. This prevented the entire 1st core from using any L3 cache. 2. The competing task list was indexed improperly in the asynchronous pair timing script. This caused the competing task to always be identical to the task being profiled. These issues combine to imply that in the rejected RTSS'20 paper: - All Level-C SMT timing data is suspect - Level-A and -B SMT timing data with L2+L3 isolation (i) is wildly optimistic --- all_pairs/run_all_pairs.sh | 168 ------------------------------------ all_pairs/run_all_pairs_L3_ONLY.sh | 170 ------------------------------------- all_pairs/tacleNames.txt | 18 ++-- 3 files changed, 11 insertions(+), 345 deletions(-) delete mode 100755 all_pairs/run_all_pairs.sh delete mode 100755 all_pairs/run_all_pairs_L3_ONLY.sh (limited to 'all_pairs') diff --git a/all_pairs/run_all_pairs.sh b/all_pairs/run_all_pairs.sh deleted file mode 100755 index 2260216..0000000 --- a/all_pairs/run_all_pairs.sh +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/bash - -firstCore=$1 -secondCore=$2 -maxJobs=$3 -userRunID=$4 -tacleNames=tacleNames.txt - -if [ $# -lt 4 ]; then - echo "Usage $0 [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 4 ]; then - echo "Using alternate list of TACLe benchmarks from $5" - tacleNames=$5 -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/cpu$firstCore/cpufreq/scaling_governor -echo "performance" > /sys/devices/system/cpu/cpu$secondCore/cpufreq/scaling_governor - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list -echo $secondCore > /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 $firstCore and $secondCore Config ===" -cat /sys/fs/resctrl/benchmarks/schemata -if [[ $6 == "--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 will be enabled." - runID=$runID-i -else - echo "MC^2 not detected. Cache coloring will be DISABLED." - 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-A.txt and $runID-$userRunID-B.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $6 == "--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 - for (( j = $i; j < $num_tests ; j++ )) #loop through programs - 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 - # Autodetect MC^2 - if uname -a | grep -q "mc2"; then - chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!; - chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!; - else - chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!; - chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!; - fi - wait $PID1 $PID2 - done - echo ${tacleProg[$i]} ${tacleProg[$j]} - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $6 == "--contend" ]]; then - killall thrasher -fi - -# Remove semaphores from system -# Leaving them won't hurt these tests, but would be messy and is bad practice -# TODO: Do this directly in the benchmarks. They should clean up after themselves -./bin/cleanupSemaphores - -# 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/all_pairs/run_all_pairs_L3_ONLY.sh b/all_pairs/run_all_pairs_L3_ONLY.sh deleted file mode 100755 index 8ed5eeb..0000000 --- a/all_pairs/run_all_pairs_L3_ONLY.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash - -firstCore=$1 -secondCore=$2 -maxJobs=$3 -userRunID=$4 -tacleNames=tacleNames.txt - -if [ $# -lt 4 ]; then - echo "Usage $0 [TACLe names file] [--contend]" - exit -fi - -if [ $# -gt 4 ]; then - echo "Using alternate list of TACLe benchmarks from $5" - tacleNames=$5 -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 - -# Enable L3 isolation -echo "Done. Enabling L3 isolation..." -mount -t resctrl resctrl /sys/fs/resctrl -mkdir -p /sys/fs/resctrl/benchmarks -mkdir -p /sys/fs/resctrl/benchmarks2 -echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list -echo $secondCore > /sys/fs/resctrl/benchmarks2/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 half L3 to benchmark -echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata -# Alloc other half L3 to benchmark2 -echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata -echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks2/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 $firstCore Config ===" -cat /sys/fs/resctrl/benchmarks/schemata -echo "=== Core $secondCore Config ===" -cat /sys/fs/resctrl/benchmarks2/schemata -if [[ $6 == "--contend" ]]; then - if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then - echo "ERROR: thrasher binary not found. 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. Not supported by this script!." - exit -else - echo "MC^2 not detected. Cache coloring will be enabled in the L3 only.." - runID=$runID-i3 -fi -if pwd | grep -qi dis; then - echo "Autodetected DIS. Will use script-level looping." -fi -echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt" -echo "Press enter to confirm environment, Ctrl-C to exit..." -read - -# Start contending tasks -if [[ $6 == "--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 - for (( j = $i; j < $num_tests ; j++ )) #loop through programs - 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 - # Autodetect MC^2 - if uname -a | grep -q "mc2"; then - chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!; - chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!; - else - chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!; - chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!; - fi - wait $PID1 $PID2 - done - echo ${tacleProg[$i]} ${tacleProg[$j]} - done - echo COMPLETE: ${tacleProg[$i]} -done - -# End contending tasks -if [[ $6 == "--contend" ]]; then - killall thrasher -fi - -# Remove semaphores from system -# Leaving them won't hurt these tests, but would be messy and is bad practice -# TODO: Do this directly in the benchmarks. They should clean up after themselves -./bin/cleanupSemaphores - -# 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/all_pairs/tacleNames.txt b/all_pairs/tacleNames.txt index 8f4845a..2e02966 100644 --- a/all_pairs/tacleNames.txt +++ b/all_pairs/tacleNames.txt @@ -1,19 +1,23 @@ petrinet -ndes statemate -adpcm_dec +ndes +h264_dec +huff_dec cjpeg_wrbmp +fmref +audiobeam +adpcm_dec adpcm_enc +g723_enc +huff_enc +gsm_dec cjpeg_transupp -dijkstra epic -fmref -gsm_dec -h264_dec -huff_enc +anagram rijndael_enc rijndael_dec gsm_enc susan +dijkstra ammunition mpeg2 -- cgit v1.2.2 From 4f634d4cd3254dfc68b65e63be32708105032101 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 00:24:34 -0400 Subject: Fix Makefiles so that a custom CFLAGS doesn't break the build --- all_pairs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'all_pairs') diff --git a/all_pairs/Makefile b/all_pairs/Makefile index 0042372..f0b284e 100644 --- a/all_pairs/Makefile +++ b/all_pairs/Makefile @@ -1,7 +1,7 @@ LIBLITMUS ?= /media/speedy/litmus/liblitmus CC ?= gcc -CFLAGS = -pthread -O2 -I.. -DPAIRED -LDFLAGS = -lrt +override CFLAGS += -pthread -O2 -I.. -DPAIRED +LDFLAGS += -lrt COMMON = ../extra.h # Handle cases where we're also profiling with the MMDC on the i.MX6Q -- cgit v1.2.2 From 1849016a4c0fd3d62b0acb66e7fd0f8c92b4c6fb Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 00:37:06 -0400 Subject: Fix 4 more bugs in TACLeBench - anagram: Fix two off-by-ones, the heap size, and the result - rijndael_dec: Reset result checksum at job start - huff_enc: Reset mutable global variables at job start --- all_pairs/source/anagram/anagram.c | 6 +++--- all_pairs/source/anagram/anagram_stdlib.c | 2 +- all_pairs/source/huff_enc/huff_enc.c | 2 ++ all_pairs/source/rijndael_dec/rijndael_dec.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'all_pairs') diff --git a/all_pairs/source/anagram/anagram.c b/all_pairs/source/anagram/anagram.c index fc8b6a8..feb9784 100644 --- a/all_pairs/source/anagram/anagram.c +++ b/all_pairs/source/anagram/anagram.c @@ -305,10 +305,10 @@ void anagram_ReadDict( void ) _Pragma( "loopbound min 1 max 5" ) while ( anagram_dictionary[ i ][ strlen ] != 0 ) strlen ++; - len += strlen + 2; + len += strlen + 3; } - pchBase = anagram_pchDictionary = ( char * )anagram_malloc( len ); + pchBase = anagram_pchDictionary = ( char * )anagram_malloc( len + 1 ); _Pragma( "loopbound min 2279 max 2279" ) for ( i = 0; i < anagram_DICTWORDS; i ++ ) { @@ -346,7 +346,7 @@ void anagram_init( void ) int anagram_return( void ) { int i; - char const *answer = "duke rip amy"; + char const *answer = "duke yip arm"; for ( i = 0; i < 12; i++ ) if ( answer[ i ] != anagram_buffer[ i ] ) diff --git a/all_pairs/source/anagram/anagram_stdlib.c b/all_pairs/source/anagram/anagram_stdlib.c index c766a5e..5c9f3fc 100644 --- a/all_pairs/source/anagram/anagram_stdlib.c +++ b/all_pairs/source/anagram/anagram_stdlib.c @@ -126,7 +126,7 @@ void anagram_qsort( void *va, unsigned long n, unsigned long es ) /* This must be redefined for each new benchmark */ -#define ANAGRAM_HEAP_SIZE 18000 +#define ANAGRAM_HEAP_SIZE 20388 static char anagram_simulated_heap[ANAGRAM_HEAP_SIZE]; static unsigned int anagram_freeHeapPos; diff --git a/all_pairs/source/huff_enc/huff_enc.c b/all_pairs/source/huff_enc/huff_enc.c index f2db552..6a0b901 100644 --- a/all_pairs/source/huff_enc/huff_enc.c +++ b/all_pairs/source/huff_enc/huff_enc.c @@ -153,6 +153,8 @@ void huff_enc_init( void ) { huff_enc_input_pos = 0; huff_enc_output_pos = 0; + huff_enc_byte_nb_to_write = 0; + huff_enc_val_to_write = 0; } diff --git a/all_pairs/source/rijndael_dec/rijndael_dec.c b/all_pairs/source/rijndael_dec/rijndael_dec.c index c8f606b..5c0bea8 100644 --- a/all_pairs/source/rijndael_dec/rijndael_dec.c +++ b/all_pairs/source/rijndael_dec/rijndael_dec.c @@ -68,6 +68,7 @@ void rijndael_dec_init( void ) rijndael_dec_fin.data = rijndael_dec_data; rijndael_dec_fin.size = 32768; rijndael_dec_fin.cur_pos = 0; + rijndael_dec_checksum = 0; unsigned i; volatile int x = 0; -- cgit v1.2.2 From a7c3210215bd1181ae93b23c313941dfb44519fb Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Thu, 22 Oct 2020 22:46:39 -0400 Subject: Transform LITMUS-RT support in libextra to imply case-study mode Adds and parameters to benchmarks and disables cache flushing when compiled with LITMUS. Also fixes build with LITMUS enabled on yamaha.cs.unc.edu. Also allows output to be disabled, automatically infers _rt_lock_id, and allows for a specific pair ID for paired tasks. (The pair ID is added to all the semaphore and shared memory names, allowing multiple pairs to run in the system at a time.) --- all_pairs/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'all_pairs') diff --git a/all_pairs/Makefile b/all_pairs/Makefile index f0b284e..592db70 100644 --- a/all_pairs/Makefile +++ b/all_pairs/Makefile @@ -1,4 +1,4 @@ -LIBLITMUS ?= /media/speedy/litmus/liblitmus +LIBLITMUS ?= /playpen/mc2/liblitmus CC ?= gcc override CFLAGS += -pthread -O2 -I.. -DPAIRED LDFLAGS += -lrt @@ -11,8 +11,8 @@ endif # Include all the LITMUS^RT headers if we're using it ifneq ($(shell grep "define LITMUS 1" ../extra.h),) - CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include - LDFLAGS += -L${LIBLITMUS} -llitmus + override CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include + override LDFLAGS += -L${LIBLITMUS} -llitmus endif all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec -- cgit v1.2.2 From e0217a963c6c0e0667d41d075038685956bcfacf Mon Sep 17 00:00:00 2001 From: leochanj Date: Fri, 23 Oct 2020 02:11:48 -0400 Subject: wip --- all_pairs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'all_pairs') diff --git a/all_pairs/Makefile b/all_pairs/Makefile index 592db70..5eef323 100644 --- a/all_pairs/Makefile +++ b/all_pairs/Makefile @@ -1,4 +1,4 @@ -LIBLITMUS ?= /playpen/mc2/liblitmus +LIBLITMUS ?= /home/litmus/liblitmus CC ?= gcc override CFLAGS += -pthread -O2 -I.. -DPAIRED LDFLAGS += -lrt -- cgit v1.2.2