summaryrefslogtreecommitdiffstats
path: root/all_pairs
diff options
context:
space:
mode:
Diffstat (limited to 'all_pairs')
-rw-r--r--all_pairs/Makefile10
-rwxr-xr-xall_pairs/run_all_pairs.sh168
-rwxr-xr-xall_pairs/run_all_pairs_L3_ONLY.sh170
-rw-r--r--all_pairs/source/anagram/anagram.c6
-rw-r--r--all_pairs/source/anagram/anagram_stdlib.c2
-rw-r--r--all_pairs/source/huff_enc/huff_enc.c2
-rw-r--r--all_pairs/source/rijndael_dec/rijndael_dec.c1
-rw-r--r--all_pairs/tacleNames.txt18
8 files changed, 23 insertions, 354 deletions
diff --git a/all_pairs/Makefile b/all_pairs/Makefile
index 0042372..592db70 100644
--- a/all_pairs/Makefile
+++ b/all_pairs/Makefile
@@ -1,7 +1,7 @@
1LIBLITMUS ?= /media/speedy/litmus/liblitmus 1LIBLITMUS ?= /playpen/mc2/liblitmus
2CC ?= gcc 2CC ?= gcc
3CFLAGS = -pthread -O2 -I.. -DPAIRED 3override CFLAGS += -pthread -O2 -I.. -DPAIRED
4LDFLAGS = -lrt 4LDFLAGS += -lrt
5COMMON = ../extra.h 5COMMON = ../extra.h
6 6
7# Handle cases where we're also profiling with the MMDC on the i.MX6Q 7# Handle cases where we're also profiling with the MMDC on the i.MX6Q
@@ -11,8 +11,8 @@ endif
11 11
12# Include all the LITMUS^RT headers if we're using it 12# Include all the LITMUS^RT headers if we're using it
13ifneq ($(shell grep "define LITMUS 1" ../extra.h),) 13ifneq ($(shell grep "define LITMUS 1" ../extra.h),)
14 CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include 14 override CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include
15 LDFLAGS += -L${LIBLITMUS} -llitmus 15 override LDFLAGS += -L${LIBLITMUS} -llitmus
16endif 16endif
17 17
18all: 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 18all: 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
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 @@
1#!/bin/bash
2
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4
7tacleNames=tacleNames.txt
8
9if [ $# -lt 4 ]; then
10 echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
11 exit
12fi
13
14if [ $# -gt 4 ]; then
15 echo "Using alternate list of TACLe benchmarks from $5"
16 tacleNames=$5
17fi
18
19if [ "$EUID" -ne 0 ]
20then
21 echo "You need to be root to enable interrupt isolation and real-time execution!"
22 exit
23fi
24
25echo "Making sure that binaries are up to date..."
26while read i; do
27 make bin/$i
28done < $tacleNames
29echo "Done. Disabling real-time throttling..."
30
31# Turn off rt throttling
32echo -1 > /proc/sys/kernel/sched_rt_runtime_us
33echo "Done. Redirecting all interrupts to core 0..."
34
35# Redirect all interrupts to core 0
36i=0
37for IRQ in /proc/irq/*
38do
39 # Skip default_smp_affinity
40 if [ -d $IRQ ]; then
41 irqList[$i]=$(cat $IRQ/smp_affinity_list)
42 echo 0 2> /dev/null > $IRQ/smp_affinity_list
43 fi
44 i=$(( $i + 1 ))
45done
46
47# Read the names of each benchmark
48j=0
49while read i; do
50 tacleProg[$j]=$i
51 j=$(( $j + 1 ))
52done < $tacleNames
53
54echo "Done. Checking for wbinvd module..."
55if [[ ! -f "/proc/wbinvd" ]]; then
56 echo "ERROR: wbinvd module not loaded. Exiting..."
57 exit
58fi
59
60echo "Done. Setting cores $firstCore and $secondCore to 'performance'..."
61echo "performance" > /sys/devices/system/cpu/cpu$firstCore/cpufreq/scaling_governor
62echo "performance" > /sys/devices/system/cpu/cpu$secondCore/cpufreq/scaling_governor
63
64# Enable L3 isolation
65echo "Done. Enabling L3 isolation..."
66mount -t resctrl resctrl /sys/fs/resctrl
67mkdir -p /sys/fs/resctrl/benchmarks
68echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
69echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list
70# Reset global bandwith control and remove L3 from global
71echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
72echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
73# Alloc L3 to benchmark
74echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
75echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
76echo "Done. Verifying configuration with user..."
77
78# Generate file name string
79# We append to this as we parse the environment settings
80runID=$(date +"%b%d-%H")
81
82# Confirm configuration with user
83echo "=== Global Config ==="
84cat /sys/fs/resctrl/schemata
85echo "=== Core $firstCore and $secondCore Config ==="
86cat /sys/fs/resctrl/benchmarks/schemata
87if [[ $6 == "--contend" ]]; then
88 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
89 echo "ERROR: thrasher binary not fonud. Exiting..."
90 exit
91 fi
92 echo "Will run 6 contending tasks"
93 runID=$runID-c
94else
95 runID=$runID-xc
96fi
97if uname -a | grep -q "mc2"; then
98 echo "MC^2 Autodetected. Cache coloring will be enabled."
99 runID=$runID-i
100else
101 echo "MC^2 not detected. Cache coloring will be DISABLED."
102 runID=$runID-xi
103fi
104if pwd | grep -qi dis; then
105 echo "Autodetected DIS. Will use script-level looping."
106fi
107echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt"
108echo "Press enter to confirm environment, Ctrl-C to exit..."
109read
110
111# Start contending tasks
112if [[ $6 == "--contend" ]]; then
113 echo "Done. Starting 6 contending tasks..."
114 # Run two contending tasks on each other CCX
115 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
116 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
117 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
118 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
119 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
120 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
121fi
122sleep 1 # Wait for contending tasks to start
123echo "Done. Beginning benchmarks..."
124
125num_tests=$(wc -l < $tacleNames)
126for (( i = 0; i < $num_tests ; i++ ))
127do
128 for (( j = $i; j < $num_tests ; j++ )) #loop through programs
129 do
130 # If using DIS, we have to iterate in the script as DIS won't do it for us
131 pwd | grep -qi dis
132 iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))")
133 for ((k=0;k<=iters;k++)); do
134 # Autodetect MC^2
135 if uname -a | grep -q "mc2"; then
136 chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!;
137 chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!;
138 else
139 chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!;
140 chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!;
141 fi
142 wait $PID1 $PID2
143 done
144 echo ${tacleProg[$i]} ${tacleProg[$j]}
145 done
146 echo COMPLETE: ${tacleProg[$i]}
147done
148
149# End contending tasks
150if [[ $6 == "--contend" ]]; then
151 killall thrasher
152fi
153
154# Remove semaphores from system
155# Leaving them won't hurt these tests, but would be messy and is bad practice
156# TODO: Do this directly in the benchmarks. They should clean up after themselves
157./bin/cleanupSemaphores
158
159# Put smp_affinty back the way it was
160i=0
161for IRQ in /proc/irq/*
162do
163 if [ -d $IRQ ]; then
164 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
165 fi
166 i=$(( $i + 1 ))
167done
168
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 @@
1#!/bin/bash
2
3firstCore=$1
4secondCore=$2
5maxJobs=$3
6userRunID=$4
7tacleNames=tacleNames.txt
8
9if [ $# -lt 4 ]; then
10 echo "Usage $0 <first core ID> <second core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
11 exit
12fi
13
14if [ $# -gt 4 ]; then
15 echo "Using alternate list of TACLe benchmarks from $5"
16 tacleNames=$5
17fi
18
19if [ "$EUID" -ne 0 ]
20then
21 echo "You need to be root to enable interrupt isolation and real-time execution!"
22 exit
23fi
24
25echo "Making sure that binaries are up to date..."
26while read i; do
27 make bin/$i
28done < $tacleNames
29echo "Done. Disabling real-time throttling..."
30
31# Turn off rt throttling
32echo -1 > /proc/sys/kernel/sched_rt_runtime_us
33echo "Done. Redirecting all interrupts to core 0..."
34
35# Redirect all interrupts to core 0
36i=0
37for IRQ in /proc/irq/*
38do
39 # Skip default_smp_affinity
40 if [ -d $IRQ ]; then
41 irqList[$i]=$(cat $IRQ/smp_affinity_list)
42 echo 0 2> /dev/null > $IRQ/smp_affinity_list
43 fi
44 i=$(( $i + 1 ))
45done
46
47# Read the names of each benchmark
48j=0
49while read i; do
50 tacleProg[$j]=$i
51 j=$(( $j + 1 ))
52done < $tacleNames
53
54echo "Done. Checking for wbinvd module..."
55if [[ ! -f "/proc/wbinvd" ]]; then
56 echo "ERROR: wbinvd module not loaded. Exiting..."
57 exit
58fi
59
60# Enable L3 isolation
61echo "Done. Enabling L3 isolation..."
62mount -t resctrl resctrl /sys/fs/resctrl
63mkdir -p /sys/fs/resctrl/benchmarks
64mkdir -p /sys/fs/resctrl/benchmarks2
65echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
66echo $secondCore > /sys/fs/resctrl/benchmarks2/cpus_list
67# Reset global bandwith control and remove L3 from global
68echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
69echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
70# Alloc half L3 to benchmark
71echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata
72echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
73# Alloc other half L3 to benchmark2
74echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata
75echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks2/schemata
76echo "Done. Verifying configuration with user..."
77
78# Generate file name string
79# We append to this as we parse the environment settings
80runID=$(date +"%b%d-%H")
81
82# Confirm configuration with user
83echo "=== Global Config ==="
84cat /sys/fs/resctrl/schemata
85echo "=== Core $firstCore Config ==="
86cat /sys/fs/resctrl/benchmarks/schemata
87echo "=== Core $secondCore Config ==="
88cat /sys/fs/resctrl/benchmarks2/schemata
89if [[ $6 == "--contend" ]]; then
90 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
91 echo "ERROR: thrasher binary not found. Exiting..."
92 exit
93 fi
94 echo "Will run 6 contending tasks"
95 runID=$runID-c
96else
97 runID=$runID-xc
98fi
99if uname -a | grep -q "mc2"; then
100 echo "MC^2 Autodetected. Not supported by this script!."
101 exit
102else
103 echo "MC^2 not detected. Cache coloring will be enabled in the L3 only.."
104 runID=$runID-i3
105fi
106if pwd | grep -qi dis; then
107 echo "Autodetected DIS. Will use script-level looping."
108fi
109echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt"
110echo "Press enter to confirm environment, Ctrl-C to exit..."
111read
112
113# Start contending tasks
114if [[ $6 == "--contend" ]]; then
115 echo "Done. Starting 6 contending tasks..."
116 # Run two contending tasks on each other CCX
117 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
118 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
119 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
120 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
121 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
122 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
123fi
124sleep 1 # Wait for contending tasks to start
125echo "Done. Beginning benchmarks..."
126
127num_tests=$(wc -l < $tacleNames)
128for (( i = 0; i < $num_tests ; i++ ))
129do
130 for (( j = $i; j < $num_tests ; j++ )) #loop through programs
131 do
132 # If using DIS, we have to iterate in the script as DIS won't do it for us
133 pwd | grep -qi dis
134 iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))")
135 for ((k=0;k<=iters;k++)); do
136 # Autodetect MC^2
137 if uname -a | grep -q "mc2"; then
138 chrt -r 97 numactl -m 0 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID"-A" 1 & PID1=$!;
139 chrt -r 97 numactl -m 1 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID"-B" 2 & PID2=$!;
140 else
141 chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $firstCore $secondCore ${tacleProg[$j]} $runID-$userRunID-A 1 & PID1=$!;
142 chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$j]} ${tacleProg[$j]} $maxJobs $secondCore $firstCore ${tacleProg[$i]} $runID-$userRunID-B 2 & PID2=$!;
143 fi
144 wait $PID1 $PID2
145 done
146 echo ${tacleProg[$i]} ${tacleProg[$j]}
147 done
148 echo COMPLETE: ${tacleProg[$i]}
149done
150
151# End contending tasks
152if [[ $6 == "--contend" ]]; then
153 killall thrasher
154fi
155
156# Remove semaphores from system
157# Leaving them won't hurt these tests, but would be messy and is bad practice
158# TODO: Do this directly in the benchmarks. They should clean up after themselves
159./bin/cleanupSemaphores
160
161# Put smp_affinty back the way it was
162i=0
163for IRQ in /proc/irq/*
164do
165 if [ -d $IRQ ]; then
166 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
167 fi
168 i=$(( $i + 1 ))
169done
170
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 )
305 _Pragma( "loopbound min 1 max 5" ) 305 _Pragma( "loopbound min 1 max 5" )
306 while ( anagram_dictionary[ i ][ strlen ] != 0 ) 306 while ( anagram_dictionary[ i ][ strlen ] != 0 )
307 strlen ++; 307 strlen ++;
308 len += strlen + 2; 308 len += strlen + 3;
309 } 309 }
310 310
311 pchBase = anagram_pchDictionary = ( char * )anagram_malloc( len ); 311 pchBase = anagram_pchDictionary = ( char * )anagram_malloc( len + 1 );
312 312
313 _Pragma( "loopbound min 2279 max 2279" ) 313 _Pragma( "loopbound min 2279 max 2279" )
314 for ( i = 0; i < anagram_DICTWORDS; i ++ ) { 314 for ( i = 0; i < anagram_DICTWORDS; i ++ ) {
@@ -346,7 +346,7 @@ void anagram_init( void )
346int anagram_return( void ) 346int anagram_return( void )
347{ 347{
348 int i; 348 int i;
349 char const *answer = "duke rip amy"; 349 char const *answer = "duke yip arm";
350 350
351 for ( i = 0; i < 12; i++ ) 351 for ( i = 0; i < 12; i++ )
352 if ( answer[ i ] != anagram_buffer[ i ] ) 352 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 )
126 126
127 127
128/* This must be redefined for each new benchmark */ 128/* This must be redefined for each new benchmark */
129#define ANAGRAM_HEAP_SIZE 18000 129#define ANAGRAM_HEAP_SIZE 20388
130 130
131static char anagram_simulated_heap[ANAGRAM_HEAP_SIZE]; 131static char anagram_simulated_heap[ANAGRAM_HEAP_SIZE];
132static unsigned int anagram_freeHeapPos; 132static 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 )
153{ 153{
154 huff_enc_input_pos = 0; 154 huff_enc_input_pos = 0;
155 huff_enc_output_pos = 0; 155 huff_enc_output_pos = 0;
156 huff_enc_byte_nb_to_write = 0;
157 huff_enc_val_to_write = 0;
156} 158}
157 159
158 160
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 )
68 rijndael_dec_fin.data = rijndael_dec_data; 68 rijndael_dec_fin.data = rijndael_dec_data;
69 rijndael_dec_fin.size = 32768; 69 rijndael_dec_fin.size = 32768;
70 rijndael_dec_fin.cur_pos = 0; 70 rijndael_dec_fin.cur_pos = 0;
71 rijndael_dec_checksum = 0;
71 72
72 unsigned i; 73 unsigned i;
73 volatile int x = 0; 74 volatile int x = 0;
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 @@
1petrinet 1petrinet
2ndes
3statemate 2statemate
4adpcm_dec 3ndes
4h264_dec
5huff_dec
5cjpeg_wrbmp 6cjpeg_wrbmp
7fmref
8audiobeam
9adpcm_dec
6adpcm_enc 10adpcm_enc
11g723_enc
12huff_enc
13gsm_dec
7cjpeg_transupp 14cjpeg_transupp
8dijkstra
9epic 15epic
10fmref 16anagram
11gsm_dec
12h264_dec
13huff_enc
14rijndael_enc 17rijndael_enc
15rijndael_dec 18rijndael_dec
16gsm_enc 19gsm_enc
17susan 20susan
21dijkstra
18ammunition 22ammunition
19mpeg2 23mpeg2