summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorleochanj <jbakita@cs.unc.edu>2020-10-23 00:13:06 -0400
committerleochanj <jbakita@cs.unc.edu>2020-10-23 00:13:06 -0400
commitd427b910baffcc330b0b24d87c9b3216f306d0fb (patch)
treeef312bc5757860a03673316be421c1624a5bb6b7
parentb839934c04b214c9bdab399628ee2b94a65bcd10 (diff)
parenta7c3210215bd1181ae93b23c313941dfb44519fb (diff)
merged
-rw-r--r--.gitignore19
-rw-r--r--.gitmodules6
-rw-r--r--SD-VBS/benchmarks/disparity/src/c/script_disparity.c18
-rw-r--r--SD-VBS/benchmarks/localization/src/c/script_localization.c20
-rw-r--r--SD-VBS/benchmarks/mser/src/c/script_mser.c15
-rw-r--r--SD-VBS/benchmarks/multi_ncut/src/c/script_multi_ncut.c10
-rw-r--r--SD-VBS/benchmarks/sift/src/c/script_sift.c9
-rw-r--r--SD-VBS/benchmarks/stitch/src/c/script_stitch.c11
-rw-r--r--SD-VBS/benchmarks/svm/src/c/script_svm.c23
-rw-r--r--SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c8
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/script_tracking.c17
-rw-r--r--SD-VBS/common/makefiles/Makefile.common14
l---------SD-VBS/disparity_qcif1
l---------SD-VBS/localization_qcif1
l---------SD-VBS/mser_qcif1
l---------SD-VBS/multi_ncut_qcif1
-rw-r--r--SD-VBS/sd-vbsNames.txt9
l---------SD-VBS/sift_qcif1
l---------SD-VBS/stitch_qcif1
l---------SD-VBS/svm_qcif1
l---------SD-VBS/texture_synthesis_qcif1
l---------SD-VBS/tracking_qcif1
-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
-rw-r--r--baseline/Makefile8
-rwxr-xr-xbaseline/run_baseline_L3_ONLY.sh152
-rw-r--r--baseline/source/anagram/anagram.c6
-rw-r--r--baseline/source/anagram/anagram_stdlib.c2
-rw-r--r--baseline/source/huff_enc/huff_enc.c2
-rw-r--r--baseline/source/rijndael_dec/rijndael_dec.c1
-rwxr-xr-xbaseline/summarize.py34
-rw-r--r--baseline/tacleNames.txt18
-rwxr-xr-xdis/Makefile8
-rwxr-xr-xdis/bin/field_2mb2
-rwxr-xr-xdis/bin/matrix_2mb2
-rwxr-xr-xdis/bin/neighborhood_2mb2
-rwxr-xr-xdis/bin/pointer_2mb2
-rwxr-xr-xdis/bin/transitive_2mb2
-rwxr-xr-xdis/bin/update_2mb2
-rw-r--r--dis/dis2MbInNames.txt6
-rw-r--r--dis/disPairs2MbInNames.txt6
-rwxr-xr-xdis/run_dis.sh92
-rwxr-xr-xdis/setup_mem_and_global.sh22
-rw-r--r--extra.h196
-rwxr-xr-xrun_all_dis.sh70
-rwxr-xr-xrun_all_sd-vbs.sh67
-rwxr-xr-xrun_all_tacle.sh62
-rwxr-xr-xrun_bench.sh384
-rwxr-xr-xrun_dis_cache_vs_wss.sh67
-rwxr-xr-xrun_everything.sh21
-rwxr-xr-xrun_tacle_rtss20.sh48
-rwxr-xr-xsmt_analysis/computeLCslowdown.py73
-rwxr-xr-xsmt_analysis/computeSMTslowdown.py155
-rwxr-xr-xsmt_analysis/libSMT.py151
m---------smt_analysis/plotille0
-rwxr-xr-xsmt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh175
-rwxr-xr-xsmt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh161
-rwxr-xr-xsummarize.py (renamed from dis/summarize.py)15
m---------wbinvd0
65 files changed, 1196 insertions, 1383 deletions
diff --git a/.gitignore b/.gitignore
index 057a48b..0e0db96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,9 @@
3*.txt.clean 3*.txt.clean
4# But not benchmark lists 4# But not benchmark lists
5!*Names.txt 5!*Names.txt
6# Special-case .txt handling for SD-VBS
7**/12345.txt
8!SD-VBS/benchmarks/**/*.txt
6 9
7# Ignore DIS benchmark binaries 10# Ignore DIS benchmark binaries
8**/field 11**/field
@@ -40,12 +43,7 @@
40**/statemate 43**/statemate
41**/susan 44**/susan
42 45
43# Ignore random walk benchmark 46# Ignore SD-VBS binaries
44**/random_walk
45
46# Ignore misc debug and build outputs
47**/.gdb_history
48
49**/mser 47**/mser
50**/multi_ncut 48**/multi_ncut
51**/stitch 49**/stitch
@@ -56,5 +54,10 @@
56**/sift 54**/sift
57**/localization 55**/localization
58**/disparity 56**/disparity
59**/12345.txt 57
60!SD-VBS/**/*.txt 58# Ignore random walk benchmark
59**/random_walk
60
61# Ignore misc temporary files
62**/.gdb_history
63*.swp
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..ebc7523
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
1[submodule "smt_analysis/plotille"]
2 path = smt_analysis/plotille
3 url = https://github.com/tammoippen/plotille.git
4[submodule "wbinvd"]
5 path = wbinvd
6 url = https://github.com/JoshuaJB/wbinvd.git
diff --git a/SD-VBS/benchmarks/disparity/src/c/script_disparity.c b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c
index 431c02c..7d45ada 100644
--- a/SD-VBS/benchmarks/disparity/src/c/script_disparity.c
+++ b/SD-VBS/benchmarks/disparity/src/c/script_disparity.c
@@ -28,9 +28,7 @@ int main(int argc, char* argv[])
28 int WIN_SZ=8, SHIFT=64; 28 int WIN_SZ=8, SHIFT=64;
29 FILE* fp; 29 FILE* fp;
30 30
31 printf("Image 1: ");
32 scanf("%s", im1); 31 scanf("%s", im1);
33 printf("Image 2: ");
34 scanf("%s", im2); 32 scanf("%s", im2);
35#ifdef CHECK 33#ifdef CHECK
36 char checkFile[100] = "./expected_C.txt"; 34 char checkFile[100] = "./expected_C.txt";
@@ -86,17 +84,15 @@ int main(int argc, char* argv[])
86 Iright_moved = iSetArray(paddedRows, paddedCols, 0); 84 Iright_moved = iSetArray(paddedRows, paddedCols, 0);
87 85
88 range = iMallocHandle(1, 2); 86 range = iMallocHandle(1, 2);
89 printf("starting..\n"); 87 for_each_job {
90 for_each_job{ 88 retDisparity = getDisparity(imleft, imright, WIN_SZ, SHIFT,
91 retDisparity = getDisparity(imleft, imright, WIN_SZ, SHIFT, 89 minSAD, retDisp, halfWin,
92 minSAD, retDisp, halfWin, 90 IrightPadded, IleftPadded, Iright_moved,
93 IrightPadded, IleftPadded, Iright_moved, 91 retSAD, SAD, integralImg,
94 retSAD, SAD, integralImg, 92 range);
95 range);
96 } 93 }
97 printf("ending\n");
98 94
99#ifdef CHECK 95#ifdef CHECK
100 /** Self checking - use expected.txt from data directory **/ 96 /** Self checking - use expected.txt from data directory **/
101 { 97 {
102 int tol, ret=0; 98 int tol, ret=0;
diff --git a/SD-VBS/benchmarks/localization/src/c/script_localization.c b/SD-VBS/benchmarks/localization/src/c/script_localization.c
index 3392320..ed37132 100644
--- a/SD-VBS/benchmarks/localization/src/c/script_localization.c
+++ b/SD-VBS/benchmarks/localization/src/c/script_localization.c
@@ -41,7 +41,6 @@ int main(int argc, char* argv[])
41 41
42 char im1[100]; 42 char im1[100];
43 43
44 printf("Input txt File: ");
45 scanf("%s", im1); 44 scanf("%s", im1);
46 45
47 fid = readFile(im1); 46 fid = readFile(im1);
@@ -83,11 +82,10 @@ int main(int argc, char* argv[])
83 F2D *randn; 82 F2D *randn;
84 83
85 randn = randWrapper(n,3); 84 randn = randWrapper(n,3);
86 printf("start\n"); 85 for_each_job {
87 for_each_job{ 86 fResetArray(pos,n, 3, 0);
88 fResetArray(pos,n, 3, 0); 87 fResetArray(vel,n, 3, 0);
89 fResetArray(vel,n, 3, 0); 88 fResetArray(ones,n,1,1);
90 fResetArray(ones,n,1,1);
91 89
92 { 90 {
93 int j; 91 int j;
@@ -95,7 +93,7 @@ int main(int argc, char* argv[])
95 for(j=0; j<3; j++) 93 for(j=0; j<3; j++)
96 subsref(vel, i, j) += subsref(randn,i,j) * STDDEV_ODOVel; 94 subsref(vel, i, j) += subsref(randn,i,j) * STDDEV_ODOVel;
97 95
98 } 96 }
99 97
100 98
101 99
@@ -486,17 +484,15 @@ int main(int argc, char* argv[])
486 subsref(resultMat,1,icount) = velOut; 484 subsref(resultMat,1,icount) = velOut;
487 subsref(resultMat,2,icount) = posOut; 485 subsref(resultMat,2,icount) = posOut;
488 } 486 }
489 487
490 fFreeHandle(sData); 488 fFreeHandle(sData);
491 489
492
493 if (asubsref(isEOF,0) == 1) 490 if (asubsref(isEOF,0) == 1)
494 break; 491 break;
495 } 492 }
496 } 493 }
497 printf("end..\n");
498 494
499#ifdef CHECK 495#ifdef CHECK
500 496
501 // Self checking - use expected.txt from data directory 497 // Self checking - use expected.txt from data directory
502 { 498 {
diff --git a/SD-VBS/benchmarks/mser/src/c/script_mser.c b/SD-VBS/benchmarks/mser/src/c/script_mser.c
index d4a98cd..3e98f86 100644
--- a/SD-VBS/benchmarks/mser/src/c/script_mser.c
+++ b/SD-VBS/benchmarks/mser/src/c/script_mser.c
@@ -33,7 +33,6 @@ int main(int argc, char* argv[])
33 33
34 int ndims, nel, gdl, nmer; 34 int ndims, nel, gdl, nmer;
35 35
36 printf("Input Image: ");
37 scanf("%s", im1); 36 scanf("%s", im1);
38 37
39 I = readImage(im1); 38 I = readImage(im1);
@@ -74,19 +73,17 @@ int main(int argc, char* argv[])
74 73
75 74
76 out = iMallocHandle(1, nmer); 75 out = iMallocHandle(1, nmer);
77 printf("start\n"); 76 for_each_job {
78 for_each_job{
79 idx = mser(It, 2, subs_pt, nsubs_pt, strides_pt, visited_pt, dims, 77 idx = mser(It, 2, subs_pt, nsubs_pt, strides_pt, visited_pt, dims,
80 joins_pt, 78 joins_pt,
81 regions_pt, 79 regions_pt,
82 pairs_pt, 80 pairs_pt,
83 forest_pt, 81 forest_pt,
84 acc_pt, ell_pt, 82 acc_pt, ell_pt,
85 out); 83 out);
86 } 84 }
87 printf("end..\n"); 85
88 86#ifdef CHECK
89#ifdef CHECK
90 /** Self checking - use expected.txt from data directory **/ 87 /** Self checking - use expected.txt from data directory **/
91 { 88 {
92 int tol, ret=0; 89 int tol, ret=0;
diff --git a/SD-VBS/benchmarks/multi_ncut/src/c/script_multi_ncut.c b/SD-VBS/benchmarks/multi_ncut/src/c/script_multi_ncut.c
index e4f7912..77c6b71 100644
--- a/SD-VBS/benchmarks/multi_ncut/src/c/script_multi_ncut.c
+++ b/SD-VBS/benchmarks/multi_ncut/src/c/script_multi_ncut.c
@@ -28,7 +28,6 @@ int main(int argc, char* argv[])
28 28
29 F2D *imageOut, *tempOut; 29 F2D *imageOut, *tempOut;
30 F2D *edgeWeights, *in; 30 F2D *edgeWeights, *in;
31 printf("Input image: ");
32 scanf("%s", im1); 31 scanf("%s", im1);
33 im = readImage(im1); 32 im = readImage(im1);
34 33
@@ -50,13 +49,12 @@ int main(int argc, char* argv[])
50 u->elts = (uni_elt*)malloc(sizeof(uni_elt)*num_vertices); 49 u->elts = (uni_elt*)malloc(sizeof(uni_elt)*num_vertices);
51 output = iMallocHandle(height, width); 50 output = iMallocHandle(height, width);
52 51
53 printf("start\n");
54 for_each_job{ 52 for_each_job{
55 seg = segment_image(im, sigma, k, min_size, num_ccs, segments, edges, imageOut, tempOut, kernel, edgeWeights, in, ind, u, output); 53 seg = segment_image(im, sigma, k, min_size, num_ccs, segments, edges, imageOut, tempOut, kernel, edgeWeights, in, ind, u, output);
56 out = seg; 54 out = seg;
57 } 55 }
58 printf("end..\n"); 56
59#ifdef CHECK 57#ifdef CHECK
60 /** Self checking - use expected.txt from data directory **/ 58 /** Self checking - use expected.txt from data directory **/
61 { 59 {
62 int ret=0; 60 int ret=0;
diff --git a/SD-VBS/benchmarks/sift/src/c/script_sift.c b/SD-VBS/benchmarks/sift/src/c/script_sift.c
index 0b2f106..ab39ae3 100644
--- a/SD-VBS/benchmarks/sift/src/c/script_sift.c
+++ b/SD-VBS/benchmarks/sift/src/c/script_sift.c
@@ -45,7 +45,6 @@ int main(int argc, char* argv[])
45 unsigned int* startTime, *endTime, *elapsed; 45 unsigned int* startTime, *endTime, *elapsed;
46 46
47 char imSrc[100]; 47 char imSrc[100];
48 printf("Input image: ");
49 scanf("%s", imSrc); 48 scanf("%s", imSrc);
50 im = readImage(imSrc); 49 im = readImage(imSrc);
51 image = fiDeepCopy(im); 50 image = fiDeepCopy(im);
@@ -53,16 +52,14 @@ int main(int argc, char* argv[])
53 cols = image->width; 52 cols = image->width;
54 53
55 54
56 printf("start\n");
57 for_each_job{ 55 for_each_job{
58 image = fiDeepCopy(im); 56 image = fiDeepCopy(im);
59 normalizeImage(image); 57 normalizeImage(image);
60 /** Extract sift features for the normalized image **/ 58 /** Extract sift features for the normalized image **/
61 frames = sift(image); 59 frames = sift(image);
62 } 60 }
63 printf("end..\n"); 61
64 62#ifdef CHECK
65#ifdef CHECK
66 { 63 {
67 int ret=0; 64 int ret=0;
68 float tol = 0.2; 65 float tol = 0.2;
diff --git a/SD-VBS/benchmarks/stitch/src/c/script_stitch.c b/SD-VBS/benchmarks/stitch/src/c/script_stitch.c
index 00c9a93..b7611f1 100644
--- a/SD-VBS/benchmarks/stitch/src/c/script_stitch.c
+++ b/SD-VBS/benchmarks/stitch/src/c/script_stitch.c
@@ -16,16 +16,13 @@ int main(int argc, char* argv[])
16 I2D *Icur; 16 I2D *Icur;
17 int i, j; 17 int i, j;
18 char im1[100], im2[100]; 18 char im1[100], im2[100];
19
20 19
21 printf("Input image: ");
22 scanf("%s", im1); 20 scanf("%s", im1);
23 Icur = readImage(im1); 21 Icur = readImage(im1);
24 rows = Icur->height; 22 rows = Icur->height;
25 cols = Icur->width; 23 cols = Icur->width;
26 24
27 printf("start\n"); 25 for_each_job {
28 for_each_job{
29 v = harris(Icur); 26 v = harris(Icur);
30 interestPnts = getANMS(v, 24); 27 interestPnts = getANMS(v, 24);
31 int1 = fMallocHandle(interestPnts->height, 1); 28 int1 = fMallocHandle(interestPnts->height, 1);
@@ -38,10 +35,8 @@ int main(int argc, char* argv[])
38 35
39 Fcur = extractFeatures(Icur, int1, int2); 36 Fcur = extractFeatures(Icur, int1, int2);
40 } 37 }
41 printf("end..\n");
42
43 38
44#ifdef CHECK 39#ifdef CHECK
45 /** Self checking - use expected.txt from data directory **/ 40 /** Self checking - use expected.txt from data directory **/
46 { 41 {
47 int ret=0; 42 int ret=0;
diff --git a/SD-VBS/benchmarks/svm/src/c/script_svm.c b/SD-VBS/benchmarks/svm/src/c/script_svm.c
index 62a264d..f1ce963 100644
--- a/SD-VBS/benchmarks/svm/src/c/script_svm.c
+++ b/SD-VBS/benchmarks/svm/src/c/script_svm.c
@@ -70,24 +70,23 @@ int main(int argc, char* argv[])
70 #endif 70 #endif
71 71
72 72
73 printf("trn file 1: "); 73 // trn file 1
74 scanf("%s", im1); 74 scanf("%s", im1);
75 trn1 = readFile(im1); 75 trn1 = readFile(im1);
76 76
77 printf("trn file 2: "); 77 // trn file 2
78 scanf("%s", im1); 78 scanf("%s", im1);
79 trn2 = readFile(im1); 79 trn2 = readFile(im1);
80 80
81 printf("tst file 1: "); 81 // tst file 1
82 scanf("%s", im1); 82 scanf("%s", im1);
83 tst1 = readFile(im1); 83 tst1 = readFile(im1);
84 84
85 printf("tst file 2: "); 85 // tst file 2
86 scanf("%s", im1); 86 scanf("%s", im1);
87 tst2 = readFile(im1); 87 tst2 = readFile(im1);
88 88
89 printf("start.\n"); 89 for_each_job {
90 for_each_job{
91 alpha = getAlphaFromTrainSet(N, trn1, trn2, iter); 90 alpha = getAlphaFromTrainSet(N, trn1, trn2, iter);
92 a_result = alpha->a_result; 91 a_result = alpha->a_result;
93 b_result = alpha->b_result; 92 b_result = alpha->b_result;
@@ -135,8 +134,8 @@ int main(int argc, char* argv[])
135 asubsref(result,n) = maxs; 134 asubsref(result,n) = maxs;
136 } 135 }
137 } 136 }
138 printf("end..\n"); 137
139#ifdef CHECK 138#ifdef CHECK
140 /** Self checking - use expected.txt from data directory **/ 139 /** Self checking - use expected.txt from data directory **/
141 { 140 {
142 int ret=0; 141 int ret=0;
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c b/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c
index 01ddefd..2ebb423 100644
--- a/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c
+++ b/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c
@@ -27,11 +27,10 @@ int main(int argc, char **argv)
27 image = fiDeepCopy(im); 27 image = fiDeepCopy(im);
28 init_params(data); 28 init_params(data);
29 29
30 printf("start.\n"); 30 for_each_job {
31 for_each_job{
32 create_texture(image, data); 31 create_texture(image, data);
33 } 32 }
34 printf("end..\n"); 33
35#ifdef CHECK 34#ifdef CHECK
36{ 35{
37 int ret=0; 36 int ret=0;
@@ -59,7 +58,6 @@ I2D* parse_flags(int argc, char ** argv)
59 I2D* image; 58 I2D* image;
60 char fileNm[256]; 59 char fileNm[256];
61 60
62 printf("Input image: ");
63 scanf("%s", fileNm); 61 scanf("%s", fileNm);
64 image = readImage(fileNm); 62 image = readImage(fileNm);
65 WIDTHin = image->width; 63 WIDTHin = image->width;
@@ -122,7 +120,7 @@ I2D* parse_flags(int argc, char ** argv)
122 localx = 5; 120 localx = 5;
123 localy = 5; 121 localy = 5;
124#endif 122#endif
125 printf("Input size\t\t- (%dx%d)\n", HEIGHTin, WIDTHin); 123// printf("Input size\t\t- (%dx%d)\n", HEIGHTin, WIDTHin);
126 124
127// xloopin = malloc(2*WIDTHin*sizeof(int)); 125// xloopin = malloc(2*WIDTHin*sizeof(int));
128// yloopin = malloc(2*HEIGHTin*sizeof(int)); 126// yloopin = malloc(2*HEIGHTin*sizeof(int));
diff --git a/SD-VBS/benchmarks/tracking/src/c/script_tracking.c b/SD-VBS/benchmarks/tracking/src/c/script_tracking.c
index bb48ace..c0af2d7 100644
--- a/SD-VBS/benchmarks/tracking/src/c/script_tracking.c
+++ b/SD-VBS/benchmarks/tracking/src/c/script_tracking.c
@@ -93,22 +93,18 @@ int main(int argc, char* argv[])
93 93
94 I2D* images[counter]; 94 I2D* images[counter];
95 /** Read input image **/ 95 /** Read input image **/
96 for(count=1; count<=counter; count++) 96 for(count=1; count<=counter; count++){
97 { 97 /** Read Image **/
98 /** Read image **/ 98 scanf("%s", im1);
99 printf("Input image %d: ", count);
100 scanf("%s", im1);
101 images[count - 1] = readImage(im1); 99 images[count - 1] = readImage(im1);
102 if(count == 1) Ic = readImage(im1); 100 if(count == 1) Ic = readImage(im1);
103 } 101 }
104 102
105 103
106 rows = Ic->height; 104 rows = Ic->height;
107 cols = Ic->width; 105 cols = Ic->width;
108 106
109 printf("start\n"); 107 for_each_job {
110 for_each_job{
111
112 /** IMAGE PRE-PROCESSING **/ 108 /** IMAGE PRE-PROCESSING **/
113 109
114 /** Blur the image to remove noise - weighted avergae filter **/ 110 /** Blur the image to remove noise - weighted avergae filter **/
@@ -230,8 +226,7 @@ int main(int argc, char* argv[])
230 fFreeHandle(newpoints); 226 fFreeHandle(newpoints);
231 } 227 }
232 } 228 }
233 printf("end..\n"); 229#ifdef CHECK
234#ifdef CHECK
235 /* Self checking */ 230 /* Self checking */
236 { 231 {
237 int ret=0; 232 int ret=0;
diff --git a/SD-VBS/common/makefiles/Makefile.common b/SD-VBS/common/makefiles/Makefile.common
index 144adb2..964ece6 100644
--- a/SD-VBS/common/makefiles/Makefile.common
+++ b/SD-VBS/common/makefiles/Makefile.common
@@ -18,7 +18,7 @@ endif
18endif 18endif
19 19
20CC=gcc 20CC=gcc
21override CFLAGS += -DGCC -D$(INPUT) -pthread -DCHECK 21override CFLAGS += -DGCC -D$(INPUT) -pthread -I../../../../..
22COMMON_DIR := $(TOP_DIR)/common/c 22COMMON_DIR := $(TOP_DIR)/common/c
23M_COMMON := $(TOP_DIR)/common/matlab 23M_COMMON := $(TOP_DIR)/common/matlab
24M_TOOLBOX=$(TOP_DIR)/common/toolbox 24M_TOOLBOX=$(TOP_DIR)/common/toolbox
@@ -28,7 +28,11 @@ PRELOAD_TIMES_DIR := $(TOP_DIR)/preload-times/$(BMARK)
28MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) 28MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK)
29BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK) 29BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK)
30TOOL_DIR := $(TOP_DIR)/tools 30TOOL_DIR := $(TOP_DIR)/tools
31LIBLITMUS := /home/litmus/liblitmus 31LIBLITMUS ?= /home/litmus/liblitmus
32ifneq ($(shell grep "define LITMUS 1" ../../../../../extra.h),)
33 override CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include
34 override LDFLAGS += -L${LIBLITMUS} -llitmus
35endif
32#The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =. 36#The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =.
33 37
34# Variables exported from the benchmark specific Makefiles: 38# Variables exported from the benchmark specific Makefiles:
@@ -55,8 +59,8 @@ COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c)
55# RULES 59# RULES
56 60
57EXE = 61EXE =
58INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include 62INCLUDES = -I$(COMMON_DIR) -I$(C_DIR)
59COMPILE_C = $(CC) $(CFLAGS) $(INCLUDES) -O2 63COMPILE_C = $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) -O2
60#COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES) 64#COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES)
61COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES) 65COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES)
62COMPILE_PG = $(COMPILE_G) -pg 66COMPILE_PG = $(COMPILE_G) -pg
@@ -107,7 +111,7 @@ compile-preload:
107compile: $(C_SRC) 111compile: $(C_SRC)
108 @echo 112 @echo
109 @echo -e "Benchmark\t\t- $(BMARK)" 113 @echo -e "Benchmark\t\t- $(BMARK)"
110 @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -L$(LIBLITMUS) -llitmus -lm -w -o $(BMARK)$(EXE) 114 @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -lm -w -o $(BMARK)$(EXE)
111 115
112compile-prof: $(C_SRC) 116compile-prof: $(C_SRC)
113 @echo 117 @echo
diff --git a/SD-VBS/disparity_qcif b/SD-VBS/disparity_qcif
new file mode 120000
index 0000000..9874fe6
--- /dev/null
+++ b/SD-VBS/disparity_qcif
@@ -0,0 +1 @@
benchmarks/disparity/data/qcif/disparity \ No newline at end of file
diff --git a/SD-VBS/localization_qcif b/SD-VBS/localization_qcif
new file mode 120000
index 0000000..d81d27e
--- /dev/null
+++ b/SD-VBS/localization_qcif
@@ -0,0 +1 @@
benchmarks/localization/data/qcif/localization \ No newline at end of file
diff --git a/SD-VBS/mser_qcif b/SD-VBS/mser_qcif
new file mode 120000
index 0000000..8121c92
--- /dev/null
+++ b/SD-VBS/mser_qcif
@@ -0,0 +1 @@
benchmarks/mser/data/qcif/mser \ No newline at end of file
diff --git a/SD-VBS/multi_ncut_qcif b/SD-VBS/multi_ncut_qcif
new file mode 120000
index 0000000..e3f755f
--- /dev/null
+++ b/SD-VBS/multi_ncut_qcif
@@ -0,0 +1 @@
benchmarks/multi_ncut/data/qcif/multi_ncut \ No newline at end of file
diff --git a/SD-VBS/sd-vbsNames.txt b/SD-VBS/sd-vbsNames.txt
new file mode 100644
index 0000000..23b168d
--- /dev/null
+++ b/SD-VBS/sd-vbsNames.txt
@@ -0,0 +1,9 @@
1disparity_qcif echo -e "./benchmarks/disparity/data/qcif/1.bmp\\n./benchmarks/disparity/data/qcif/2.bmp"
2localization_qcif echo "./benchmarks/localization/data/qcif/1.txt"
3mser_qcif echo "./benchmarks/mser/data/qcif/1.bmp"
4multi_ncut_qcif echo "./benchmarks/multi_ncut/data/qcif/1.bmp"
5sift_qcif echo "./benchmarks/sift/data/qcif/1.bmp"
6stitch_qcif echo "./benchmarks/stitch/data/qcif/1.bmp"
7svm_qcif echo -e "./benchmarks/svm/data/qcif/d16trn_1.txt\\n./benchmarks/svm/data/qcif/d16trn_2.txt\\n./benchmarks/svm/data/qcif/d16tst_1.txt\\n./benchmarks/svm/data/qcif/d16tst_2.txt"
8texture_synthesis_qcif echo "./benchmarks/texture_synthesis/data/qcif/1.bmp"
9tracking_qcif echo -e "./benchmarks/tracking/data/qcif/1.bmp\\n./benchmarks/tracking/data/qcif/2.bmp\\n./benchmarks/tracking/data/qcif/3.bmp\\n./benchmarks/tracking/data/qcif/4.bmp"
diff --git a/SD-VBS/sift_qcif b/SD-VBS/sift_qcif
new file mode 120000
index 0000000..724930b
--- /dev/null
+++ b/SD-VBS/sift_qcif
@@ -0,0 +1 @@
benchmarks/sift/data/qcif/sift \ No newline at end of file
diff --git a/SD-VBS/stitch_qcif b/SD-VBS/stitch_qcif
new file mode 120000
index 0000000..0b05a84
--- /dev/null
+++ b/SD-VBS/stitch_qcif
@@ -0,0 +1 @@
benchmarks/stitch/data/qcif/stitch \ No newline at end of file
diff --git a/SD-VBS/svm_qcif b/SD-VBS/svm_qcif
new file mode 120000
index 0000000..a8dc348
--- /dev/null
+++ b/SD-VBS/svm_qcif
@@ -0,0 +1 @@
benchmarks/svm/data/qcif/svm \ No newline at end of file
diff --git a/SD-VBS/texture_synthesis_qcif b/SD-VBS/texture_synthesis_qcif
new file mode 120000
index 0000000..e198a53
--- /dev/null
+++ b/SD-VBS/texture_synthesis_qcif
@@ -0,0 +1 @@
benchmarks/texture_synthesis/data/qcif/texture_synthesis \ No newline at end of file
diff --git a/SD-VBS/tracking_qcif b/SD-VBS/tracking_qcif
new file mode 120000
index 0000000..683191e
--- /dev/null
+++ b/SD-VBS/tracking_qcif
@@ -0,0 +1 @@
benchmarks/tracking/data/qcif/tracking \ No newline at end of file
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
diff --git a/baseline/Makefile b/baseline/Makefile
index 40b57f4..a929bc6 100644
--- a/baseline/Makefile
+++ b/baseline/Makefile
@@ -1,6 +1,6 @@
1LIBLITMUS ?= /media/speedy/litmus/liblitmus 1LIBLITMUS ?= /playpen/mc2/liblitmus
2CC ?= gcc 2CC ?= gcc
3CFLAGS = -pthread -O2 -I.. 3override CFLAGS = -pthread -O2 -I..
4LDFLAGS = -lrt 4LDFLAGS = -lrt
5COMMON = ../extra.h 5COMMON = ../extra.h
6 6
@@ -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/baseline/run_baseline_L3_ONLY.sh b/baseline/run_baseline_L3_ONLY.sh
deleted file mode 100755
index 4183653..0000000
--- a/baseline/run_baseline_L3_ONLY.sh
+++ /dev/null
@@ -1,152 +0,0 @@
1#!/bin/bash
2
3core=$1
4maxJobs=$2
5userRunID=$3
6tacleNames=tacleNames.txt
7
8if [ $# -lt 3 ]; then
9 echo "Usage $0 <core ID> <number of iterations> <run ID> [TACLe names file] [--contend]"
10 exit
11fi
12
13if [ $# -gt 3 ]; then
14 echo "Using alternate list of TACLe benchmarks from $4"
15 tacleNames=$4
16fi
17
18if [ "$EUID" -ne 0 ]
19then
20 echo "You need to be root to enable interrupt isolation and real-time execution!"
21 exit
22fi
23
24echo "Making sure that binaries are up to date..."
25while read i; do
26 make bin/$i
27done < $tacleNames
28echo "Done. Disabling real-time throttling..."
29
30# Turn off rt throttling
31echo -1 > /proc/sys/kernel/sched_rt_runtime_us
32echo "Done. Redirecting all interrupts to core 0..."
33
34# Redirect all interrupts to core 0
35i=0
36for IRQ in /proc/irq/*
37do
38 # Skip default_smp_affinity
39 if [ -d $IRQ ]; then
40 irqList[$i]=$(cat $IRQ/smp_affinity_list)
41 echo 0 2> /dev/null > $IRQ/smp_affinity_list
42 fi
43 i=$(( $i + 1 ))
44done
45
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..."
54if [[ ! -f "/proc/wbinvd" ]]; then
55 echo "ERROR: wbinvd module not loaded. Exiting..."
56 exit
57fi
58
59# Enable L3 isolation
60echo "Done. Enabling L3 isolation..."
61mount -t resctrl resctrl /sys/fs/resctrl
62mkdir -p /sys/fs/resctrl/benchmarks
63echo $1 > /sys/fs/resctrl/benchmarks/cpus_list
64# Reset global bandwith control and remove L3 from global
65echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
66echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
67# Alloc L3 to benchmark
68echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks/schemata
69echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
70echo "Done. Verifying configuration with user..."
71
72# Generate file name string
73# We append to this as we parse the environment settings
74runID=$(date +"%b%d-%H")
75
76# Confirm configuration with user
77echo "=== Global Config ==="
78cat /sys/fs/resctrl/schemata
79echo "=== Core $1 Config ==="
80cat /sys/fs/resctrl/benchmarks/cpus_list
81cat /sys/fs/resctrl/benchmarks/schemata
82if [[ $5 == "--contend" ]]; then
83 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
84 echo "ERROR: thrasher binary not fonud. Exiting..."
85 exit
86 fi
87 echo "Will run 6 contending tasks"
88 runID=$runID-c
89else
90 runID=$runID-xc
91fi
92if uname -a | grep -q "mc2"; then
93 echo "MC^2 Autodetected. NOT SUPPORTED. Exiting..."
94 exit
95else
96 echo "MC^2 not detected. 50% L3 allocation enabled."
97 runID=$runID-i3
98fi
99if pwd | grep -qi dis; then
100 echo "Autodetected DIS. Will use script-level looping."
101fi
102echo "Results will be saved as $runID-$userRunID.txt"
103echo "Press enter to confirm environment, Ctrl-C to exit..."
104read
105
106# Start contending tasks
107if [[ $5 == "--contend" ]]; then
108 echo "Done. Starting 6 contending tasks..."
109 # Run two contending tasks on each other CCX
110 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
111 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
112 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
113 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
114 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
115 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
116fi
117sleep 1 # Wait for contending tasks to start
118echo "Done. Beginning benchmarks..."
119
120num_tests=$(wc -l < $tacleNames)
121for (( i = 0; i < $num_tests ; i++ ))
122do
123 # If using DIS, we have to iterate in the script as DIS won't do it for us
124 pwd | grep -qi dis
125 iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))")
126 for ((k=0;k<=iters;k++)); do
127 # Check if we're using LITMUS^RT or not
128 if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then
129 ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1
130 else
131 # Interleave memory allocations between all nodes (only 1 node w/out MC^2)
132 chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1
133 fi
134 done
135 echo COMPLETE: ${tacleProg[$i]}
136done
137
138# End contending tasks
139if [[ $5 == "--contend" ]]; then
140 killall thrasher
141fi
142
143# Put smp_affinty back the way it was
144i=0
145for IRQ in /proc/irq/*
146do
147 if [ -d $IRQ ]; then
148 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
149 fi
150 i=$(( $i + 1 ))
151done
152
diff --git a/baseline/source/anagram/anagram.c b/baseline/source/anagram/anagram.c
index fc8b6a8..feb9784 100644
--- a/baseline/source/anagram/anagram.c
+++ b/baseline/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/baseline/source/anagram/anagram_stdlib.c b/baseline/source/anagram/anagram_stdlib.c
index c766a5e..5c9f3fc 100644
--- a/baseline/source/anagram/anagram_stdlib.c
+++ b/baseline/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/baseline/source/huff_enc/huff_enc.c b/baseline/source/huff_enc/huff_enc.c
index f2db552..6a0b901 100644
--- a/baseline/source/huff_enc/huff_enc.c
+++ b/baseline/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/baseline/source/rijndael_dec/rijndael_dec.c b/baseline/source/rijndael_dec/rijndael_dec.c
index c8f606b..5c0bea8 100644
--- a/baseline/source/rijndael_dec/rijndael_dec.c
+++ b/baseline/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/baseline/summarize.py b/baseline/summarize.py
deleted file mode 100755
index 82f82d9..0000000
--- a/baseline/summarize.py
+++ /dev/null
@@ -1,34 +0,0 @@
1#!/usr/bin/python3
2import sys
3
4f = sys.argv[1]
5res = {}
6mem_res = {}
7memw_res = {}
8samples = {}
9
10with open(f) as fp:
11 for line in fp:
12 s = line.split()
13 if s[0] not in res:
14 print(s[0])
15 res[s[0]] = int(s[5])
16 mem_res[s[0]] = int(s[8])
17 memw_res[s[0]] = int(s[9])
18 samples[s[0]] =int(s[4])
19 else:
20 res[s[0]] += int(s[5])
21 mem_res[s[0]] += int(s[8])
22 memw_res[s[0]] += int(s[9])
23
24print("Average times:")
25for r in res.keys():
26 print(res[r]/samples[r])
27
28print("Average memory read:")
29for r in mem_res.keys():
30 print(mem_res[r]/samples[r])
31
32print("Average memory write:")
33for r in memw_res.keys():
34 print(memw_res[r]/samples[r])
diff --git a/baseline/tacleNames.txt b/baseline/tacleNames.txt
index 8f4845a..2e02966 100644
--- a/baseline/tacleNames.txt
+++ b/baseline/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
diff --git a/dis/Makefile b/dis/Makefile
index df93116..d18761b 100755
--- a/dis/Makefile
+++ b/dis/Makefile
@@ -2,9 +2,9 @@
2# Build the DIS benchmarks with all-pairs or unpaired instrumentation 2# Build the DIS benchmarks with all-pairs or unpaired instrumentation
3# (I know that this Makefile is mildly evil and breaks so many rules 3# (I know that this Makefile is mildly evil and breaks so many rules
4# that a good Makefile should follow. Sorry - at least I have one.) 4# that a good Makefile should follow. Sorry - at least I have one.)
5LIBLITMUS ?= /media/speedy/litmus/liblitmus 5LIBLITMUS ?= /playpen/mc2/liblitmus
6CC ?= gcc 6CC ?= gcc
7CFLAGS += -pthread -O2 -I.. 7override CFLAGS += -pthread -O2 -I..
8LDFLAGS = -lrt -lm 8LDFLAGS = -lrt -lm
9COMMON = ../extra.h 9COMMON = ../extra.h
10 10
@@ -15,8 +15,8 @@ endif
15 15
16# Include all the LITMUS^RT headers if we're using it 16# Include all the LITMUS^RT headers if we're using it
17ifneq ($(shell grep "define LITMUS 1" ../extra.h),) 17ifneq ($(shell grep "define LITMUS 1" ../extra.h),)
18 CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include 18 override CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include
19 LDFLAGS += -L${LIBLITMUS} -llitmus 19 override LDFLAGS += -L${LIBLITMUS} -llitmus
20endif 20endif
21 21
22all: baseline 22all: baseline
diff --git a/dis/bin/field_2mb b/dis/bin/field_2mb
deleted file mode 100755
index 31f2a8d..0000000
--- a/dis/bin/field_2mb
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/bash
2taskset -c 0 ./gen_input.py field inputs/Field/in0 2097152 | ./field $@
diff --git a/dis/bin/matrix_2mb b/dis/bin/matrix_2mb
deleted file mode 100755
index 72710ab..0000000
--- a/dis/bin/matrix_2mb
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/bash
2taskset -c 0 ./gen_input.py matrix inputs/Matrix/in4 2097152 | ./matrix $@ > /dev/null
diff --git a/dis/bin/neighborhood_2mb b/dis/bin/neighborhood_2mb
deleted file mode 100755
index 226bd98..0000000
--- a/dis/bin/neighborhood_2mb
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/bash
2taskset -c 0 ./gen_input.py neighborhood inputs/Neighborhood/in0 2097152 | ./neighborhood $@ > /dev/null
diff --git a/dis/bin/pointer_2mb b/dis/bin/pointer_2mb
deleted file mode 100755
index 3ce8f2b..0000000
--- a/dis/bin/pointer_2mb
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/bash
2taskset -c 0 ./gen_input.py pointer inputs/Pointer/in0 2097152 | ./pointer $@
diff --git a/dis/bin/transitive_2mb b/dis/bin/transitive_2mb
deleted file mode 100755
index b8bcf5a..0000000
--- a/dis/bin/transitive_2mb
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/bash
2taskset -c 0 ./gen_input.py transitive inputs/Transitive/in0 2097152 | ./transitive $@
diff --git a/dis/bin/update_2mb b/dis/bin/update_2mb
deleted file mode 100755
index 3bc33f4..0000000
--- a/dis/bin/update_2mb
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/bash
2taskset -c 0 ./gen_input.py update inputs/Update/in0 2097152 | ./update $@
diff --git a/dis/dis2MbInNames.txt b/dis/dis2MbInNames.txt
new file mode 100644
index 0000000..00e6a22
--- /dev/null
+++ b/dis/dis2MbInNames.txt
@@ -0,0 +1,6 @@
1field ./gen_input.py field inputs/Field/in0 2097152
2matrix ./gen_input.py matrix inputs/Matrix/in0 2097152
3neighborhood ./gen_input.py neighborhood inputs/Neighborhood/in0 2097152
4pointer ./gen_input.py pointer inputs/Pointer/in0 2097152
5transitive ./gen_input.py transitive inputs/Transitive/in0 2097152
6update ./gen_input.py update inputs/Update/in0 2097152
diff --git a/dis/disPairs2MbInNames.txt b/dis/disPairs2MbInNames.txt
new file mode 100644
index 0000000..a45ead4
--- /dev/null
+++ b/dis/disPairs2MbInNames.txt
@@ -0,0 +1,6 @@
1field_all ./gen_input.py field inputs/Field/in0 2097152
2matrix_all ./gen_input.py matrix inputs/Matrix/in0 2097152
3neighborhood_all ./gen_input.py neighborhood inputs/Neighborhood/in0 2097152
4pointer_all ./gen_input.py pointer inputs/Pointer/in0 2097152
5transitive_all ./gen_input.py transitive inputs/Transitive/in0 2097152
6update_all ./gen_input.py update inputs/Update/in0 2097152
diff --git a/dis/run_dis.sh b/dis/run_dis.sh
deleted file mode 100755
index 78745ec..0000000
--- a/dis/run_dis.sh
+++ /dev/null
@@ -1,92 +0,0 @@
1#!/bin/bash
2
3core=$1
4maxJobs=$2
5runID=$3
6benchmark=${4,}
7template_input=inputs/$4/in0
8wss_settings=inputs/WSSS
9cache_settings=inputs/caches
10
11if [ $# -lt 4 ]; then
12 echo "Usage $0 <core ID> <number of iterations> <run ID> <benchmark> [template input] [DIS WSS file] [DIS cache file]"
13 exit
14fi
15
16if [ $# -gt 4 ]; then
17 echo "Using alternate input template from $5"
18 template_input=$5
19fi
20
21if [ $# -gt 5 ]; then
22 echo "Using alternate WSS settings from $6"
23 wss_settings=$6
24fi
25
26if [ $# -gt 6 ]; then
27 echo "Using alternate cache settings from $7"
28 cache_settings=$7
29fi
30
31echo "Making sure that binary is up to date..."
32make $benchmark
33echo "Done. Disabling real-time throttling..."
34
35# Turn off rt throttling
36echo -1 > /proc/sys/kernel/sched_rt_runtime_us
37echo "Done. Redirecting all interrupts to core 0..."
38
39# Redirect all interrupts to core 0
40i=0
41for IRQ in /proc/irq/*
42do
43 # Skip default_smp_affinity
44 if [ -d $IRQ ]; then
45 irqList[$i]=$(cat $IRQ/smp_affinity_list)
46 echo 0 2> /dev/null > $IRQ/smp_affinity_list
47 fi
48 i=$(( $i + 1 ))
49done
50
51echo "Done. Checking for wbinvd module..."
52if [[ ! -f "/proc/wbinvd" ]]; then
53 echo "ERROR: wbinvd module not loaded. Exiting..."
54 exit
55fi
56
57# Enable L3 isolation
58echo "Done. Enabling L3 isolation..."
59mount -t resctrl resctrl /sys/fs/resctrl
60mkdir -p /sys/fs/resctrl/benchmarks
61echo $1 > /sys/fs/resctrl/benchmarks/cpus_list
62# Reset global bandwith control and remove L3 from global
63echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
64echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
65# Alloc L3 to benchmark
66echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
67echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
68echo "Done. Beginning benchmarks..."
69
70# Execute the benchmark for each WSS and cache config
71while read j; do
72 echo $j > /sys/fs/resctrl/benchmarks/schemata
73 while read i; do
74 if grep -q "#define LITMUS 1" ../baseline/source/extra.h; then
75 echo "Using LITMUS-RT!"
76 ./gen_input.py $benchmark $template_input $i | numactl -m 0 ./$benchmark $benchmark-$i-$j $maxJobs $core $runID 1
77 else
78 ./gen_input.py $benchmark $template_input $i | chrt -r 97 numactl -m 0 taskset -c $core ./$benchmark $benchmark-$i-$j $maxJobs $core $runID 1
79 fi
80 done < $wss_settings
81done < $cache_settings
82
83# Put IRQs back as they were
84i=0
85for IRQ in /proc/irq/*
86do
87 if [ -d $IRQ ]; then
88 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
89 fi
90 i=$(( $i + 1 ))
91done
92
diff --git a/dis/setup_mem_and_global.sh b/dis/setup_mem_and_global.sh
deleted file mode 100755
index 6bddb2f..0000000
--- a/dis/setup_mem_and_global.sh
+++ /dev/null
@@ -1,22 +0,0 @@
1# Setup group
2mount -t resctrl resctrl /sys/fs/resctrl
3mkdir -p /sys/fs/resctrl/benchmarks
4echo 15 > /sys/fs/resctrl/benchmarks/cpus_list
5echo 31 > /sys/fs/resctrl/benchmarks/cpus_list
6# Remove mem from global domain and assign to local
7echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
8echo "L3:0=ffff;1=ffff;2=ffff;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
9if [[ $1 == "--bandwith" ]]; then
10 # Remove bandwidth from global domain
11 echo "MB:0=2;1=2;2=2;3=2" > /sys/fs/resctrl/schemata
12 echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
13else
14 # Disable bandwidth control
15 echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
16 echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
17fi
18echo "=== Global Config ==="
19cat /sys/fs/resctrl/schemata
20echo "=== Core 15 & 31 Config ==="
21cat /sys/fs/resctrl/benchmarks/schemata
22
diff --git a/extra.h b/extra.h
index 8c67b33..8c894f6 100644
--- a/extra.h
+++ b/extra.h
@@ -29,8 +29,13 @@ extern int sched_getcpu();
29#include <sys/syscall.h> 29#include <sys/syscall.h>
30#endif 30#endif
31 31
32<<<<<<< HEAD
32#define LITMUS 1 33#define LITMUS 1
33#define MC2 0 34#define MC2 0
35=======
36// This is a proxy for "case study mode" now
37#define LITMUS 0
38>>>>>>> rtas20-wip
34#define MMDC_PROF 0 39#define MMDC_PROF 0
35 40
36#if LITMUS 41#if LITMUS
@@ -41,18 +46,6 @@ extern int sched_getcpu();
41#include "/media/speedy/litmus/tools/mmdc/mmdc.h" 46#include "/media/speedy/litmus/tools/mmdc/mmdc.h"
42#endif 47#endif
43 48
44#if LITMUS
45#define SET_UP LOAD_PARAMS SETUP_LITMUS
46#else
47#define SET_UP LOAD_PARAMS
48#endif
49
50#if MMDC_PROF
51#define LOAD_PARAMS LOAD_PARAMS_ITRL SETUP_MMDC
52#else
53#define LOAD_PARAMS LOAD_PARAMS_ITRL
54#endif
55
56// Store state globally so that the job can be outside main() 49// Store state globally so that the job can be outside main()
57// Arrays use float as a comprimise between overflow and size 50// Arrays use float as a comprimise between overflow and size
58// Paired arrays use long longs as precision is more important for those times 51// Paired arrays use long longs as precision is more important for those times
@@ -82,50 +75,72 @@ char *_rt_other_core;
82char *_rt_barrier; 75char *_rt_barrier;
83sem_t *_rt_first_sem, *_rt_second_sem; 76sem_t *_rt_first_sem, *_rt_second_sem;
84int _rt_lock_id; 77int _rt_lock_id;
78#define _ID_SZ 128
79char _rt_sem1_name[_ID_SZ] = "/_libextra_first_sem-";
80char _rt_sem2_name[_ID_SZ] = "/_libextra_second_sem-";
81char _rt_shm_name[_ID_SZ] = "/_libextra_barrier-";
82#endif /* PAIRED */
83
84#if LITMUS
85long unsigned int _rt_period;
85#endif 86#endif
86 87
87static void _rt_load_params_itrl(int argc, char **argv) { 88static void _rt_load_params_itrl(int argc, char **argv) {
88#ifdef PAIRED 89#ifdef PAIRED
89 if (argc != 8) { 90 if (argc != (8 + LITMUS*2) && argc != (9 + LITMUS*2)) {
90 fprintf(stderr, "Usage: %s <name> <loops> <my core> <other core> <other name> <runID> <lockID>", argv[0]); 91 fprintf(stderr, "Usage: %s <name> <loops> <my core> <other core> <other name> <runID> <save results?>", argv[0]);
91 fprintf(stderr, " <name> string for logging. Name of this task.\n");
92 fprintf(stderr, " <loops> integer number of iterations. -1 for infinite.\n");
93 fprintf(stderr, " <my core> UNUSED. Core is now auto-detected.\n");
94 fprintf(stderr, " <other core> integer for logging. Core of paired task.\n");
95 fprintf(stderr, " <other name> string for logging. Name of paired task.\n");
96 fprintf(stderr, " <runID> string to append with .txt to yield output file name.\n");
97 fprintf(stderr, " <lockID> 1 to indicate this is pair member 1, otherwise pair member 2.\n");
98 exit(1);
99 }
100#else 92#else
101 if (argc != 6) { 93 if (argc != (6 + LITMUS*2)) {
102 fprintf(stderr, "Usage: %s <name> <loops> <my core> <runID> <save results?>\n", argv[0]); 94 fprintf(stderr, "Usage: %s <name> <loops> <my core> <runID> <save results?>\n", argv[0]);
95#endif /* PAIRED */
103 fprintf(stderr, " <name> string for logging. Name of this task.\n"); 96 fprintf(stderr, " <name> string for logging. Name of this task.\n");
104 fprintf(stderr, " <loops> integer number of iterations. -1 for infinite.\n"); 97 fprintf(stderr, " <loops> integer number of iterations. -1 for infinite.\n");
105 fprintf(stderr, " <my core> UNUSED. Core is now auto-detected.\n"); 98 fprintf(stderr, " <my core> integer core number. Only used for LITMUS-RT.\n");
99#ifdef PAIRED
100 fprintf(stderr, " <other core> integer for logging. Core of paired task.\n");
101 fprintf(stderr, " <other name> string for logging. Name of paired task.\n");
102#endif /* PAIRED */
106 fprintf(stderr, " <runID> string to append with .txt to yield output file name.\n"); 103 fprintf(stderr, " <runID> string to append with .txt to yield output file name.\n");
107 fprintf(stderr, " <save results?> 1 to save results, 0 to discard.\n"); 104 fprintf(stderr, " <save results?> 1 to save results, 0 to discard.\n");
105#ifdef PAIRED
106 fprintf(stderr, " <pairID> (optional).\n");
107#endif
108#if LITMUS
109 fprintf(stderr, " <task period> in ms\n");
110 fprintf(stderr, " <task criticality level> 0 for Level-A, 1 for Level-B, 2 for Level-C\n");
111#endif /* LITMUS */
108 exit(1); 112 exit(1);
109 } 113 }
110#endif
111 _rt_our_prog_name = argv[1]; 114 _rt_our_prog_name = argv[1];
112 _rt_max_jobs = atol(argv[2]); 115 _rt_max_jobs = atol(argv[2]);
116#if !LITMUS
113 _rt_core = sched_getcpu(); 117 _rt_core = sched_getcpu();
118#else
119 _rt_core = atoi(argv[3]);
120#endif
114#ifdef PAIRED 121#ifdef PAIRED
115 _rt_other_core = argv[4]; 122 _rt_other_core = argv[4];
116 _rt_other_prog_name = argv[5]; 123 _rt_other_prog_name = argv[5];
117 _rt_run_id = argv[6]; 124 _rt_run_id = argv[6];
118 _rt_lock_id = atoi(argv[7]); 125 _rt_will_output = atoi(argv[7]);
119 // The paired version doesn't support disabling output (legacy compatibility) 126 char *pairId;
120 _rt_will_output = 1; 127 int end;
128 if (argc > 8) {
129 pairId = argv[8];
130 end = 8;
131 } else {
132 pairId = "none";
133 end = 9;
134 }
121#else 135#else
122 _rt_other_core = "none"; 136 _rt_other_core = "none";
123 _rt_other_prog_name = "none"; 137 _rt_other_prog_name = "none";
124 _rt_run_id = argv[4]; 138 _rt_run_id = argv[4];
125 _rt_will_output = atoi(argv[5]); 139 _rt_will_output = atoi(argv[5]);
140 int end = 6;
126#endif /* PAIRED */ 141#endif /* PAIRED */
127 if (_rt_max_jobs < 0 && _rt_will_output != 0) { 142 if (_rt_max_jobs < 0 && _rt_will_output != 0) {
128 fprintf(stderr, "Infinite loops only supported when _rt_will_output is disabled!\n"); 143 fprintf(stderr, "Infinite loops only supported when output is disabled!\n");
129 exit(1); 144 exit(1);
130 } 145 }
131 if (strlen(_rt_run_id) + 5 > _RT_FILENAME_LEN) { 146 if (strlen(_rt_run_id) + 5 > _RT_FILENAME_LEN) {
@@ -133,32 +148,54 @@ static void _rt_load_params_itrl(int argc, char **argv) {
133 exit(1); 148 exit(1);
134 } 149 }
135#ifdef PAIRED 150#ifdef PAIRED
151 // __rt_sem2_name happens to be the longest
152 if (strlen(pairId) + strlen(_rt_sem2_name) > _ID_SZ) {
153 fprintf(stderr, "PairID is too long! Maximum length is %ld characters.\n", _ID_SZ - strlen(_rt_sem2_name));
154 exit(1);
155 }
136 _rt_start_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long)); 156 _rt_start_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long));
137 _rt_end_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long)); 157 _rt_end_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long));
138 if (!_rt_end_time || !_rt_start_time) { 158 if (!_rt_end_time || !_rt_start_time) {
139 perror("Unable to allocate buffers for execution times"); 159 perror("Unable to allocate buffers for execution times");
140 exit(1); 160 exit(1);
141 } 161 }
142 _rt_first_sem = sem_open("/_libextra_first_sem", O_CREAT, 644, 0); 162 // Use PairID to create unique semaphore and shared memory paths
143 _rt_second_sem = sem_open("/_libextra_second_sem", O_CREAT, 644, 0); 163 strcat(_rt_sem1_name, pairId);
164 strcat(_rt_sem2_name, pairId);
165 strcat(_rt_shm_name, pairId);
166 _rt_first_sem = sem_open(_rt_sem1_name, O_CREAT, 644, 0);
167 _rt_second_sem = sem_open(_rt_sem2_name, O_CREAT, 644, 0);
144 if (_rt_first_sem == SEM_FAILED || _rt_second_sem == SEM_FAILED) { 168 if (_rt_first_sem == SEM_FAILED || _rt_second_sem == SEM_FAILED) {
145 perror("Error while creating semaphores"); 169 perror("Error while creating semaphores");
146 exit(1); 170 exit(1);
147 } 171 }
148 int barrier_file = shm_open("/_libextra_barrier", O_CREAT | O_RDWR, 644); 172 // Create shared memory for barrier synchronization and infer lock ID
173 int barrier_file = shm_open(_rt_shm_name, O_CREAT | O_RDWR | O_EXCL, 644);
174 if (barrier_file == -1) {
175 // File already existed - we're the 2nd program and thus lock ID 2
176 _rt_lock_id = 2;
177 barrier_file = shm_open(_rt_shm_name, O_CREAT | O_RDWR, 644);
178 } else {
179 _rt_lock_id = 1;
180 }
149 if (barrier_file == -1) { 181 if (barrier_file == -1) {
150 perror("Error while creating shared memory for barrier synchronization"); 182 perror("Error while creating shared memory for barrier synchronization");
151 exit(1); 183 exit(1);
152 } 184 }
153 if (ftruncate(barrier_file, 1) == -1) { 185 if (ftruncate(barrier_file, 2) == -1) {
154 perror("Error while setting size of shared memory for barrier synchronization"); 186 perror("Error while setting size of shared memory for barrier synchronization");
155 exit(1); 187 exit(1);
156 } 188 }
157 _rt_barrier = mmap(NULL, 1, PROT_WRITE, MAP_SHARED, barrier_file, 0); 189 _rt_barrier = mmap(NULL, 2, PROT_WRITE, MAP_SHARED, barrier_file, 0);
158 if (_rt_barrier == MAP_FAILED) { 190 if (_rt_barrier == MAP_FAILED) {
159 perror("Error while mapping shared memory for barrier synchronization"); 191 perror("Error while mapping shared memory for barrier synchronization");
160 exit(1); 192 exit(1);
161 } 193 }
194 // If we're the 2nd user of this barrier, mark it as in-use
195 if (_rt_lock_id == 2 && !__sync_bool_compare_and_swap(_rt_barrier+1, 0, 1)) {
196 fprintf(stderr, "Pair ID already in use!\n");
197 exit(1);
198 }
162 *_rt_barrier = 0; 199 *_rt_barrier = 0;
163#else 200#else
164 _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float)); 201 _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));
@@ -169,8 +206,46 @@ static void _rt_load_params_itrl(int argc, char **argv) {
169#endif /* PAIRED */ 206#endif /* PAIRED */
170 _rt_jobs_complete = 0; 207 _rt_jobs_complete = 0;
171 mlockall(MCL_CURRENT || MCL_FUTURE); 208 mlockall(MCL_CURRENT || MCL_FUTURE);
209#if LITMUS
210 _rt_period = strtoul(argv[end], NULL, 10);
211 unsigned int crit = atoi(argv[end+1]);
212 unsigned int wait = 1;
213 if (be_migrate_to_domain(_rt_core) < 0) {
214 perror("Unable to migrate to specified CPU");
215 exit(1);
216 }
217 struct rt_task rt_param;
218 init_rt_task_param(&rt_param);
219 rt_param.exec_cost = 0; // We disable budget enforcement, so this doesn't matter
220 rt_param.period = ms2ns(_rt_period);
221 rt_param.relative_deadline = 0;
222 rt_param.phase = 0;
223 rt_param.priority = LITMUS_LOWEST_PRIORITY;
224 rt_param.cls = crit;
225 rt_param.release_policy = TASK_PERIODIC;
226 rt_param.budget_policy = NO_ENFORCEMENT;
227 rt_param.cpu = _rt_core;
228 if (set_rt_task_param(gettid(), &rt_param) < 0) {
229 perror("Unable to set real-time parameters");
230 exit(1);
231 }
232 if (init_litmus() != 0) {
233 perror("init_litmus failed");
234 exit(1);
235 }
236 if (task_mode(LITMUS_RT_TASK) != 0) {
237 perror("Unable to become real-time task");
238 exit(1);
239 }
240 if (wait && wait_for_ts_release() != 0) {
241 perror("Unable to wait for taskset release");
242 exit(1);
243 }
244#endif /* LITMUS */
245#if MMDC_PROF
246 SETUP_MMDC
247#endif
172} 248}
173#define LOAD_PARAMS_ITRL _rt_load_params_itrl(argc, argv);
174 249
175#define SETUP_MMDC \ 250#define SETUP_MMDC \
176 _rt_mmdc_read = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\ 251 _rt_mmdc_read = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\
@@ -194,6 +269,7 @@ static void _rt_load_params_itrl(int argc, char **argv) {
194 mmdc->madpcr1 = axi_arm1;\ 269 mmdc->madpcr1 = axi_arm1;\
195 msync(&(mmdc->madpcr1),4,MS_SYNC); 270 msync(&(mmdc->madpcr1),4,MS_SYNC);
196 271
272<<<<<<< HEAD
197#define SETUP_LITMUS \ 273#define SETUP_LITMUS \
198 unsigned int wait = 0; \ 274 unsigned int wait = 0; \
199 if (be_migrate_to_domain(_rt_core) < 0) { \ 275 if (be_migrate_to_domain(_rt_core) < 0) { \
@@ -242,6 +318,8 @@ static void _rt_load_params_itrl(int argc, char **argv) {
242 exit(1); \ 318 exit(1); \
243 } \ 319 } \
244 320
321=======
322>>>>>>> rtas20-wip
245#if __arm__ 323#if __arm__
246// On ARM, manually flush the cache 324// On ARM, manually flush the cache
247#define FLUSH_CACHES \ 325#define FLUSH_CACHES \
@@ -305,28 +383,28 @@ static void _rt_load_params_itrl(int argc, char **argv) {
305 383
306// Buffer timing result from a single job 384// Buffer timing result from a single job
307static void _rt_save_job_result() { 385static void _rt_save_job_result() {
386 if (!_rt_will_output)
387 return;
308 if (_rt_jobs_complete >= _rt_max_jobs) { 388 if (_rt_jobs_complete >= _rt_max_jobs) {
309 fprintf(stderr, "Max jobs setting too small! Trying to record job #%ld when we only have space for %ld jobs. Exiting...\n", _rt_jobs_complete, _rt_max_jobs); 389 fprintf(stderr, "Max jobs setting too small! Trying to record job #%ld when we only have space for %ld jobs. Exiting...\n", _rt_jobs_complete, _rt_max_jobs);
310 exit(1); 390 exit(1);
311 } 391 }
312 if (_rt_jobs_complete > -1 && _rt_will_output) {
313#ifdef PAIRED 392#ifdef PAIRED
314 _rt_start_time[_rt_jobs_complete] = _rt_start.tv_sec; 393 _rt_start_time[_rt_jobs_complete] = _rt_start.tv_sec;
315 _rt_start_time[_rt_jobs_complete] *= _BILLION; 394 _rt_start_time[_rt_jobs_complete] *= _BILLION;
316 _rt_start_time[_rt_jobs_complete] += _rt_start.tv_nsec; 395 _rt_start_time[_rt_jobs_complete] += _rt_start.tv_nsec;
317 _rt_end_time[_rt_jobs_complete] = _rt_end.tv_sec; 396 _rt_end_time[_rt_jobs_complete] = _rt_end.tv_sec;
318 _rt_end_time[_rt_jobs_complete] *= _BILLION; 397 _rt_end_time[_rt_jobs_complete] *= _BILLION;
319 _rt_end_time[_rt_jobs_complete] += _rt_end.tv_nsec; 398 _rt_end_time[_rt_jobs_complete] += _rt_end.tv_nsec;
320#else 399#else
321 _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec; 400 _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec;
322 _rt_exec_time[_rt_jobs_complete] *= _BILLION; 401 _rt_exec_time[_rt_jobs_complete] *= _BILLION;
323 _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec; 402 _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec;
324#endif /* PAIRED */ 403#endif /* PAIRED */
325#if MMDC_PROF 404#if MMDC_PROF
326 _rt_mmdc_read[_rt_jobs_complete] = mmdc_res.read_bytes; 405 _rt_mmdc_read[_rt_jobs_complete] = mmdc_res.read_bytes;
327 _rt_mmdc_write[_rt_jobs_complete] = mmdc_res.write_bytes; 406 _rt_mmdc_write[_rt_jobs_complete] = mmdc_res.write_bytes;
328#endif 407#endif /* MMDC_PROF */
329 }
330} 408}
331 409
332// Save all buffered timing results to disk 410// Save all buffered timing results to disk
@@ -365,13 +443,16 @@ static void _rt_write_to_file() {
365 fclose(fp); 443 fclose(fp);
366out: 444out:
367#if LITMUS 445#if LITMUS
368 CLEANUP_LITMUS 446 if (task_mode(BACKGROUND_TASK) != 0) {
447 perror("Unable to become a real-time task");
448 exit(1);
449 }
369#endif /* LITMUS */ 450#endif /* LITMUS */
370#ifdef PAIRED 451#ifdef PAIRED
371 munmap(_rt_barrier, 1); 452 munmap(_rt_barrier, 2);
372 shm_unlink("/_libextra_barrier"); 453 sem_unlink(_rt_sem1_name);
373 sem_unlink("/_libextra_first_sem"); 454 sem_unlink(_rt_sem2_name);
374 sem_unlink("/_libextra_second_sem"); 455 shm_unlink(_rt_shm_name);
375 free(_rt_start_time); 456 free(_rt_start_time);
376 free(_rt_end_time); 457 free(_rt_end_time);
377#else 458#else
@@ -396,7 +477,9 @@ static void _rt_start_loop() {
396 FIRST_UNLOCK 477 FIRST_UNLOCK
397 FIRST_LOCK 478 FIRST_LOCK
398#endif /* PAIRED */ 479#endif /* PAIRED */
480#if !LITMUS
399 FLUSH_CACHES 481 FLUSH_CACHES
482#endif
400#ifdef PAIRED 483#ifdef PAIRED
401 BARRIER_SYNC 484 BARRIER_SYNC
402#endif /* PAIRED */ 485#endif /* PAIRED */
@@ -444,7 +527,7 @@ static void _rt_stop_loop() {
444 * result. We use this to call our void function from inside a comparison. 527 * result. We use this to call our void function from inside a comparison.
445 */ 528 */
446#define for_each_job \ 529#define for_each_job \
447 for (; _rt_jobs_complete < _rt_max_jobs && (_rt_start_loop(),1); \ 530 for (; (_rt_max_jobs == -1 || _rt_jobs_complete < _rt_max_jobs) && (_rt_start_loop(),1); \
448 _rt_stop_loop()) 531 _rt_stop_loop())
449 532
450/****** Legacy API ****** 533/****** Legacy API ******
@@ -466,6 +549,7 @@ static void _rt_stop_loop() {
466 * able to read them. 549 * able to read them.
467 */ 550 */
468static int jobsComplete = 0; 551static int jobsComplete = 0;
552#define SET_UP _rt_load_params_itrl(argc, argv);
469#define START_LOOP _rt_start_loop(); 553#define START_LOOP _rt_start_loop();
470#define STOP_LOOP _rt_stop_loop(); 554#define STOP_LOOP _rt_stop_loop();
471#define WRITE_TO_FILE _rt_write_to_file(); 555#define WRITE_TO_FILE _rt_write_to_file();
diff --git a/run_all_dis.sh b/run_all_dis.sh
deleted file mode 100755
index 5a6b6e1..0000000
--- a/run_all_dis.sh
+++ /dev/null
@@ -1,70 +0,0 @@
1#!/bin/bash
2# Run baselines for all the DIS tasks
3if [ "$EUID" -ne 0 ]
4then
5 echo "You need to be root to enable cache way and interrupt isolation!"
6 exit
7fi
8
9if uname -a | grep -q "mc2"; then
10 echo "MC^2 detected! Cache isolation will be enabled"
11 iso="i"
12else
13 echo "MC^2 not detected."
14 iso="xi"
15fi
16
17datestring=$(date +"%b%d-%H")
18if ! grep -q irqaffinity /proc/cmdline; then
19 /playpen/move_interrupts_off_core15.sh
20else
21 echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor
22fi
23WSSS=WSSS_maxstride2mb
24caches=caches_all
25# Consider re-enabling this only if you're interested in exploring bandwidth effects
26#./setup_mem_and_global.sh
27if [[ $1 == "--contend" ]]; then
28 echo "Will run 6 contending tasks"
29 echo "Files will be named $datestring-<benchmark name>-c-"$iso".txt"
30 echo "Please verify the above settings. Press enter to continue..."
31 read
32 # Run two contending tasks on each other CCX
33 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
34 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
35 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
36 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
37 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
38 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
39 ./run_dis.sh 15 10 $datestring-field-c-$iso Field inputs/Field/in0 inputs/$WSSS inputs/$caches
40 ./postproc.sh $datestring-field-c-$iso
41 ./run_dis.sh 15 10 $datestring-matrix-c-$iso Matrix inputs/Matrix/in0 inputs/$WSSS inputs/$caches
42 ./postproc.sh $datestring-matrix-c-$iso
43 ./run_dis.sh 15 10 $datestring-neighborhood-c-$iso Neighborhood inputs/Neighborhood/in0 inputs/$WSSS inputs/$caches
44 ./postproc.sh $datestring-neighborhood-c-$iso
45 ./run_dis.sh 15 10 $datestring-pointer-c-$iso Pointer inputs/Pointer/in0 inputs/$WSSS inputs/$caches
46 ./postproc.sh $datestring-pointer-c-$iso
47 ./run_dis.sh 15 10 $datestring-transitive-c-$iso Transitive inputs/Transitive/in0 inputs/$WSSS inputs/$caches
48 ./postproc.sh $datestring-transitive-c-$iso
49 ./run_dis.sh 15 10 $datestring-update-c-$iso Update inputs/Update/in0 inputs/$WSSS inputs/$caches
50 ./postproc.sh $datestring-update-c-$iso
51 killall thrasher
52else
53 echo "Will run no contending tasks (use --contend for contending tasks)"
54 echo "Files will be named $datestring-<benchmark name>-xc-"$iso".txt"
55 echo "Please verify the above settings. Press enter to continue..."
56 read
57 killall thrasher
58 ./run_dis.sh 15 10 $datestring-field-xc-$iso Field inputs/Field/in0 inputs/$WSSS inputs/$caches
59 ./postproc.sh $datestring-field-xc-$iso
60 ./run_dis.sh 15 10 $datestring-matrix-xc-$iso Matrix inputs/Matrix/in0 inputs/$WSSS inputs/$caches
61 ./postproc.sh $datestring-matrix-xc-$iso
62 ./run_dis.sh 15 10 $datestring-neighborhood-xc-$iso Neighborhood inputs/Neighborhood/in0 inputs/$WSSS inputs/$caches
63 ./postproc.sh $datestring-neighborhood-xc-$iso
64 ./run_dis.sh 15 10 $datestring-pointer-xc-$iso Pointer inputs/Pointer/in0 inputs/$WSSS inputs/$caches
65 ./postproc.sh $datestring-pointer-xc-$iso
66 ./run_dis.sh 15 10 $datestring-transitive-xc-$iso Transitive inputs/Transitive/in0 inputs/$WSSS inputs/$caches
67 ./postproc.sh $datestring-transitive-xc-$iso
68 ./run_dis.sh 15 10 $datestring-update-xc-$iso Update inputs/Update/in0 inputs/$WSSS inputs/$caches
69 ./postproc.sh $datestring-update-xc-$iso
70fi
diff --git a/run_all_sd-vbs.sh b/run_all_sd-vbs.sh
new file mode 100755
index 0000000..1f5948d
--- /dev/null
+++ b/run_all_sd-vbs.sh
@@ -0,0 +1,67 @@
1#!/bin/bash
2# Copyright 2020 Joshua Bakita
3# Runs SD-VBS in every configuration needed
4# for the paper and schedulability studies
5
6maxJobs=$1
7runID=$2
8
9if [ $# -lt 2 ]; then
10 echo "Usage $0 <number of iterations> <run ID>"
11 exit
12fi
13if [[ "$EUID" != 0 ]]; then
14 echo "You need to be root to enable spatial isolation!"
15 exit
16fi
17date
18
19# Run the pairs baseline and some comparisons to examine the effect of less cache
20echo "Building benchmarks in unpaired configuration..."
21cd SD-VBS/benchmarks
22make compile -j30 > /dev/null # Suppress noisy output
23cd ..
24echo "Done. Running experiments..."
25# Full L3, full L2 - xi is the baseline for the pairs
26baseXI=SD-VBS/$(date +"%b%d-%H")-c-xi-$runID.txt
27echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b sd-vbsNames.txt -B -I xi $runID
28# Half L3, full L2 - i3 sees effect of half L3
29baseI3=SD-VBS/$(date +"%b%d-%H")-c-i3-$runID.txt
30echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b sd-vbsNames.txt -B -I i3 $runID
31# Half L3, half L2 - additional effect of half L2
32baseI=SD-VBS/$(date +"%b%d-%H")-c-i-$runID.txt
33echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b sd-vbsNames.txt -B -I i $runID
34date
35
36# Run the Level-C pairs
37pairC=SD-VBS/$(date +"%b%d-%H")-c-xi-async-$runID.txt
38echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b sd-vbsNames.txt -B -I xi -A $runID
39date
40
41# Run the Level-A/-B pairs
42echo "Building benchmarks in paired configuration..."
43cd benchmarks
44make CFLAGS=-DPAIRED compile -j30 > /dev/null # Suppress noisy output
45cd ..
46echo "Done. Continuing experiments..."
47# No cache isolation
48pairXI=SD-VBS/$(date +"%b%d-%H")-c-xi-$runID"-A.txt and -B.txt"
49echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b sd-vbsNames.txt -B -I xi $runID
50# Shared L2, split L3
51pairI3=SD-VBS/$(date +"%b%d-%H")-c-i3-$runID"-A.txt and -B.txt"
52echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b sd-vbsNames.txt -B -I i3 $runID
53# Split L2, split L3
54pairI=SD-VBS/$(date +"%b%d-%H")-c-i-$runID"-A.txt and -B.txt"
55echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b sd-vbsNames.txt -B -I i $runID
56date
57
58echo "==== DONE ===="
59echo "Results are in:"
60echo "- $baseXI"
61echo "- $baseI3"
62echo "- $baseI"
63echo "- $pairXI"
64echo "- $pairI3"
65echo "- $pairI"
66echo "- $pairC"
67
diff --git a/run_all_tacle.sh b/run_all_tacle.sh
new file mode 100755
index 0000000..51a9c24
--- /dev/null
+++ b/run_all_tacle.sh
@@ -0,0 +1,62 @@
1#!/bin/bash
2# Copyright 2020 Joshua Bakita
3# Runs TACLeBench in every configuration needed
4# for the paper and schedulability studies
5
6maxJobs=$1
7runID=$2
8
9if [ $# -lt 2 ]; then
10 echo "Usage $0 <number of iterations> <run ID>"
11 exit
12fi
13if [[ "$EUID" != 0 ]]; then
14 echo "You need to be root to enable spatial isolation!"
15 exit
16fi
17date
18
19# Run the pairs baseline and some comparisons to examine the effect of less cache
20cd baseline
21make all -j32
22# Full L3, full L2 - xi is the baseline for the pairs
23baseXI=baseline/$(date +"%b%d-%H")-c-xi-$runID.txt
24echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I xi $runID
25# Half L3, full L2 - i3 sees effect of half L3
26baseI3=baseline/$(date +"%b%d-%H")-c-i3-$runID.txt
27echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I i3 $runID
28# Half L3, half L2 - additional effect of half L2
29baseI=baseline/$(date +"%b%d-%H")-c-i-$runID.txt
30echo "" | ../run_bench.sh -m base -p 15 -l $maxJobs -b tacleNames.txt -B -I i $runID
31date
32
33# Run the Level-A/-B pairs
34cd ../all_pairs
35make all -j32
36# No cache isolation
37pairXI=all_pairs/$(date +"%b%d-%H")-c-xi-$runID"-A.txt and -B.txt"
38echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi $runID
39# Shared L2, split L3
40pairI3=all_pairs/$(date +"%b%d-%H")-c-i3-$runID"-A.txt and -B.txt"
41echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i3 $runID
42# Split L2, split L3
43pairI=all_pairs/$(date +"%b%d-%H")-c-i-$runID"-A.txt and -B.txt"
44echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I i $runID
45date
46
47# Run the Level-C pairs
48cd ../baseline
49pairC=baseline/$(date +"%b%d-%H")-c-xi-async-$runID.txt
50echo "" | ../run_bench.sh -m pair -p 15 -P 31 -l $maxJobs -b tacleNames.txt -B -I xi -A $runID
51date
52
53echo "==== DONE ===="
54echo "Results are in:"
55echo "- $baseXI"
56echo "- $baseI3"
57echo "- $baseI"
58echo "- $pairXI"
59echo "- $pairI3"
60echo "- $pairI"
61echo "- $pairC"
62
diff --git a/run_bench.sh b/run_bench.sh
index c5b67b6..ddc6bcc 100755
--- a/run_bench.sh
+++ b/run_bench.sh
@@ -1,30 +1,162 @@
1#!/bin/bash 1#!/bin/bash
2# Copyright 2020 Joshua Bakita
3# A unified script for timing:
4# - SMT pairs with synchronous launches (hard real-time methodolgy)
5# - SMT pairs with asynchronous launches (soft real-time methodolgy)
6# - Unpaired tasks
7# - The cache alloc vs WSS setting exploration for DIS
8# These can all be done with:
9# - No cache management
10# - L3 cache splitting
11# - L2+L3 cache splitting (if OS supported)
2 12
3core=$1 13if grep -q "#define LITMUS 1" ../extra.h ./extra.h 2> /dev/null; then
4maxJobs=$2 14 LITMUS=1
5userRunID=$3 15fi
6tacleNames=tacleNames.txt 16
17if [ $# -lt 5 ]; then
18 echo "Usage $0 -m MODE -p CPU -l LOOPS -b FILE [-B] [-I] RUN_ID"
19 echo " -m base|dis|pair Which benchmarking mode to use"
20 echo " -p CPU Which CPU to run each benchmark on"
21 echo " -l LOOPS How many loops of each benchmark to do"
22 echo " -b FILE List of benchmarks to execute. Optional tab-"
23 echo " delimited 2nd column specifies an input"
24 echo " generation command (fed to bench via stdin)"
25 echo " -B Enable background contenders on other CCXes"
26 echo " -I xi|i3|i Isolation mode: none (xi) (default), way-based"
27 echo " L3-only (i3), or color-based L2+L3 (i)"
28 echo "Mode base requires no additional options."
29 echo "Mode dis does not support the 2nd col. of -b and needs:"
30 echo " -W FILE List of working set sizes to pass gen_input.py"
31 echo " -T FILE Input template to pass to gen_input.py"
32 echo " -C FILE List of cache configurations to test"
33 echo "Mode pair options:"
34 echo " -P CPU CPU to run the 2nd benchmark on"
35 echo " -A Async. (Don't synchronize the pair at job"
36 echo " boundries.) Typically used SMT in soft realtime"
37fi
38
39# Name options similarly to rtspin
40while getopts “m:p:l:b:BI:W:T:C:P:A” opt; do
41 case $opt in
42# Required
43 m) mode=$OPTARG ;;
44 p) core=$OPTARG ;;
45 l) maxJobs=$OPTARG ;;
46 b) benchNames=$OPTARG ;;
47# Optional
48 B) contend=1 ;;
49 I) iso_mode=$OPTARG ;;
50# DIS
51 W) wss_settings=$OPTARG ;;
52 T) template_input=$OPTARG ;;
53 C) cache_settings=$OPTARG ;;
54# Pair
55 P) core_two=$OPTARG ;;
56 A) async=1 ;;
57 esac
58done
59# Reset to read operands
60shift $((OPTIND -1))
61userRunID=$1
62
63# Required argument checking
64if [[ "$mode" != "base" && "$mode" != "dis" && $mode != pair ]]; then
65 echo "Invalid argument: MODE must be either 'base' or 'dis'"
66 exit
67fi
68if [[ ! -v core ]] || [[ ! -v maxJobs ]] || [[ ! -v benchNames ]]; then
69 echo "Missing argument: -p, -l, and -b are required"
70 exit
71fi
72if [[ ! -f "$benchNames" ]]; then
73 echo "Invalid argument: $benchNames des not exist"
74 exit
75fi
76if [[ ! -v userRunID ]]; then
77 echo "Missing argument: RUN_ID is required"
78 exit
79fi
80
81# DIS argument checking
82if [[ "$mode" == "dis" ]] && [[ ! -v wss_settings || ! -v template_input || -z $cache_settings ]]; then
83 echo "Missing argument: DIS needs -W FILE -T FILE and -C FILE"
84 exit
85fi
86if [[ "$mode" == "dis" ]] && [[ ! -f "$wss_settings" ]]; then
87 echo "Invalid argument: $wss_settings does not exist"
88 exit
89fi
90if [[ "$mode" == "dis" ]] && [[ ! -f "$template_input" ]]; then
91 echo "Invalid argument: $template_input does not exist"
92 exit
93fi
94if [[ "$mode" == "dis" ]] && [[ ! -f "$cache_settings" ]]; then
95 echo "Invalid argument: $cache_settings does not exist"
96 exit
97fi
7 98
8if [ $# -lt 3 ]; then 99# Pair argument checking
9 echo "Usage $0 <core ID> <number of iterations> <run ID> [TACLe names file] [--contend]" 100if [[ "$mode" == "pair" && ! -v core_two ]]; then
101 echo "Missing argument: mode=pair reqires -P"
102 exit
103fi
104if [[ "$mode" != "pair" ]] && [[ -v async || -v core_two ]]; then
105 echo "Invalid argument: -A and -P require mode=pair"
10 exit 106 exit
11fi 107fi
12 108
13if [ $# -gt 3 ]; then 109# Additional checks
14 echo "Using alternate list of TACLe benchmarks from $4" 110if [[ $userRunID == "" ]]; then
15 tacleNames=$4 111 echo "Missing argument: a run ID is required"
112 exit
113fi
114if [[ -v contend && ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
115 echo "ERROR: cannot find thrasher binary for -B. Exiting..."
116 exit
117fi
118if [[ $iso_mode == "i" && ! $(uname -a | grep "mc2") ]]; then
119 echo "Isolation mode 'i' requires the MC^2 kernel. Exiting..."
120 exit
16fi 121fi
17 122
18if [ "$EUID" -ne 0 ] 123# Check permissions and update state
19then 124if [[ "$EUID" != 0 ]]; then
20 echo "You need to be root to enable interrupt isolation and real-time execution!" 125 echo "You need to be root to enable interrupt isolation and real-time execution!"
21 exit 126 exit
22fi 127fi
23 128
24echo "Making sure that binaries are up to date..." 129echo "Loading benchmark names and input..."
130
131# Read the names of each benchmark and load input.
132# This might look a bit scary, but all it does is
133# separate the two fields (1 or more tabs in-between),
134# save the benchmark name, and execute the input
135# command (storing its output in-memory for later).
136j=0
137IFS=$'\r\n'
25while read i; do 138while read i; do
26 make bin/$i 139 bench[$j]=$(echo $i | tr -s "\t" | cut -f1)
27done < $tacleNames 140 input[$j]=$(eval $(echo $i | tr -s "\t" | cut -s -f2))
141 j=$(( $j + 1 ))
142done < $benchNames
143echo "Making sure that binaries are up to date..."
144
145for b in ${bench[@]}; do
146 # Build "bin/bench" if bin directory
147 if [[ -d bin ]]; then
148 make bin/$b
149 fi
150 # If that failed, try a different name
151 if [[ "$?" != 0 || ! -d bin ]]; then
152 make $b
153 fi
154 # If bench is still not in bin or curr dir, fail
155 if [[ ! -f "./$b" && ! -f "./bin/$b" ]]; then
156 echo "Unable to find benchmark $b"
157 exit
158 fi
159done
28echo "Done. Disabling real-time throttling..." 160echo "Done. Disabling real-time throttling..."
29 161
30# Turn off rt throttling 162# Turn off rt throttling
@@ -43,12 +175,34 @@ do
43 i=$(( $i + 1 )) 175 i=$(( $i + 1 ))
44done 176done
45 177
46# Read the names of each benchmark 178echo "Done. Creating cleanup handler..."
47j=0 179function cleanup {
48while read i; do 180 # End contending tasks
49 tacleProg[$j]=$i 181 if [[ -v contend ]]; then
50 j=$(( $j + 1 )) 182 killall thrasher
51done < $tacleNames 183 fi
184
185 # Restore cache access to everyone
186 echo "L3:0=ffff;1=ffff;2=ffff;3=ffff" > /sys/fs/resctrl/schemata
187 if [[ -e /sys/fs/resctrl/benchmarks ]]; then
188 echo "" > /sys/fs/resctrl/benchmarks/cpus_list
189 fi
190 if [[ -e /sys/fs/resctrl/benchmarks2 ]]; then
191 echo "" > /sys/fs/resctrl/benchmarks2/cpus_list
192 fi
193
194 # Put smp_affinty back the way it was
195 i=0
196 for IRQ in /proc/irq/*
197 do
198 if [ -d $IRQ ]; then
199 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
200 fi
201 i=$(( $i + 1 ))
202 done
203}
204# This sets the cleanup function to be called when we exit for any reason
205trap cleanup EXIT
52 206
53echo "Done. Checking for wbinvd module..." 207echo "Done. Checking for wbinvd module..."
54if [[ ! -f "/proc/wbinvd" ]]; then 208if [[ ! -f "/proc/wbinvd" ]]; then
@@ -56,21 +210,51 @@ if [[ ! -f "/proc/wbinvd" ]]; then
56 exit 210 exit
57fi 211fi
58 212
59echo "Done. Setting cores $firstCore and $secondCore to 'performance'..." 213echo "Done. Setting cores to 'performance'..."
60echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor 214echo "performance" > /sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor
61echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governo 215if [[ -v core_two ]]; then
216 echo "performance" > /sys/devices/system/cpu/cpu$core_two/cpufreq/scaling_governor
217fi
62 218
63# Enable L3 isolation 219# Enable L3 isolation
64echo "Done. Enabling L3 isolation..." 220echo "Done. Setting up L3 isolation..."
65mount -t resctrl resctrl /sys/fs/resctrl 221mount -t resctrl resctrl /sys/fs/resctrl
66mkdir -p /sys/fs/resctrl/benchmarks
67echo $1 > /sys/fs/resctrl/benchmarks/cpus_list
68# Reset global bandwith control and remove L3 from global 222# Reset global bandwith control and remove L3 from global
69echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata 223echo "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 224echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
71# Alloc L3 to benchmark 225# Alloc L3 to benchmark
72echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata 226# (this logic is safe when $core_two is empty)
73echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata 227if [[ $iso_mode == "i" ]]; then
228 # With "i" we rely on numactl to do isolation
229 # Full L3 access from both cores
230 mkdir -p /sys/fs/resctrl/benchmarks
231 # Must write both at the same time. Appends unsupported!
232 echo $core,$core_two > /sys/fs/resctrl/benchmarks/cpus_list
233 echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
234 # But each core is bound to its own numa mem node
235 numa_arg0="--membind=0"
236 numa_arg1="--membind=1"
237elif [[ $iso_mode == "i3" ]]; then
238 # With "i3" we rely on resctrl to do isolation
239 mkdir -p /sys/fs/resctrl/benchmarks
240 mkdir -p /sys/fs/resctrl/benchmarks2
241 echo $core > /sys/fs/resctrl/benchmarks/cpus_list
242 echo $core_two > /sys/fs/resctrl/benchmarks2/cpus_list
243 echo "L3:0=0000;1=0000;2=0000;3=ff00" > /sys/fs/resctrl/benchmarks/schemata
244 echo "L3:0=0000;1=0000;2=0000;3=00ff" > /sys/fs/resctrl/benchmarks2/schemata
245 # Disable numa-based isolation
246 numa_arg0="--interleave=all"
247 numa_arg1="--interleave=all"
248else
249 iso_mode="xi"
250 # No isolation via numactl or resctrl
251 mkdir -p /sys/fs/resctrl/benchmarks
252 echo $core,$core_two > /sys/fs/resctrl/benchmarks/cpus_list
253 echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
254 # Disable numa-based isolation
255 numa_arg0="--interleave=all"
256 numa_arg1="--interleave=all"
257fi
74echo "Done. Verifying configuration with user..." 258echo "Done. Verifying configuration with user..."
75 259
76# Generate file name string 260# Generate file name string
@@ -80,34 +264,47 @@ runID=$(date +"%b%d-%H")
80# Confirm configuration with user 264# Confirm configuration with user
81echo "=== Global Config ===" 265echo "=== Global Config ==="
82cat /sys/fs/resctrl/schemata 266cat /sys/fs/resctrl/schemata
83echo "=== Core $1 Config ===" 267echo "=== NUMA Config ==="
268echo " '$numa_arg0' and '$numa_arg1'"
269echo "=== Core $(cat /sys/fs/resctrl/benchmarks/cpus_list) Config ==="
84cat /sys/fs/resctrl/benchmarks/schemata 270cat /sys/fs/resctrl/benchmarks/schemata
85if [[ $5 == "--contend" ]]; then 271if [[ -v core_two && $(cat /sys/fs/resctrl/benchmarks2/cpus_list) ]]; then
86 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then 272 echo "=== Core $(cat /sys/fs/resctrl/benchmarks2/cpus_list) Config ==="
87 echo "ERROR: thrasher binary not fonud. Exiting..." 273 cat /sys/fs/resctrl/benchmarks2/schemata
88 exit 274fi
89 fi 275
276if [[ -v contend ]]; then
90 echo "Will run 6 contending tasks" 277 echo "Will run 6 contending tasks"
91 runID=$runID-c 278 runID=$runID-c
92else 279else
93 runID=$runID-xc 280 runID=$runID-xc
94fi 281fi
95if uname -a | grep -q "mc2"; then 282
96 echo "MC^2 Autodetected. Cache coloring and interleaving will be enabled." 283runID=$runID-$iso_mode
97 runID=$runID-i 284
285if [[ -v async ]]; then
286 echo "Will use asynchronous job pairing"
287 runID=$runID-async
288fi
289
290if [[ $mode == "pair" && ! -v async ]]; then
291 echo "Results will be saved as $runID-$userRunID-A.txt and $runID-$userRunID-B.txt"
98else 292else
99 echo "MC^2 not detected." 293 echo "Results will be saved as $runID-$userRunID.txt"
100 runID=$runID-xi
101fi 294fi
102if pwd | grep -qi dis; then 295
103 echo "Autodetected DIS. Will use script-level looping." 296if [[ $core == 0 || "$core_two" == 0 ]]; then
297 echo "!!!!! DANGER !!!!!"
298 echo "! Running real-time tasks on core 0 will conflict with interrupt"
299 echo "! handling and likely freeze your system! Only continue if you know"
300 echo "! exactly what you're doing!!"
301 echo "!!!!!!!!!!!!!!!!!!"
104fi 302fi
105echo "Results will be saved as $runID-$userRunID.txt"
106echo "Press enter to confirm environment, Ctrl-C to exit..." 303echo "Press enter to confirm environment, Ctrl-C to exit..."
107read 304read
108 305
109# Start contending tasks 306# Start contending tasks
110if [[ $5 == "--contend" ]]; then 307if [[ -v contend ]]; then
111 echo "Done. Starting 6 contending tasks..." 308 echo "Done. Starting 6 contending tasks..."
112 # Run two contending tasks on each other CCX 309 # Run two contending tasks on each other CCX
113 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher & 310 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
@@ -120,37 +317,82 @@ fi
120sleep 1 # Wait for contending tasks to start 317sleep 1 # Wait for contending tasks to start
121echo "Done. Beginning benchmarks..." 318echo "Done. Beginning benchmarks..."
122 319
123num_tests=$(wc -l < $tacleNames) 320# Output coloring
124for (( i = 0; i < $num_tests ; i++ )) 321FAIL_COLOR="\033[0;31m"
125do 322GOOD_COLOR="\033[0;32m"
126 # If using DIS, we have to iterate in the script as DIS won't do it for us 323RESET_COLOR="\033[0m"
127 pwd | grep -qi dis 324
128 iters=$(python3 -c "print(int(not "$?")*("$maxJobs"-1))") 325# For each benchmark
129 for ((k=0;k<=iters;k++)); do 326for (( i = 0; i < ${#bench[@]} ; i++ )); do
327 # Search for the benchmark in this directory, than /bin
328 if [[ -f ${bench[$i]} ]]; then
329 prefix="."
330 else
331 prefix="./bin"
332 fi
333 if [[ "$mode" == "base" ]]; then
334 # Just run the benchmark if TACLeBench
130 # Check if we're using LITMUS^RT or not 335 # Check if we're using LITMUS^RT or not
131 if [[ -f source/extra.h ]] && grep -q "#define LITMUS 1" source/extra.h; then 336 if [[ -v $LITMUS ]]; then
132 ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 337 echo "${input[$i]}" | numactl $numa_arg0 $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $runID-$userRunID 1
133 else 338 else
134 # Interleave memory allocations between all nodes (only 1 node w/out MC^2) 339 # Remember: Unpaired tasks always get access to all colors (so we --interleave all)
135 chrt -r 97 numactl --interleave=all taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID 1 340 echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $runID-$userRunID 1
136#chrt -r 97 numactl -m 0 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID-$userRunID-NOINTERLEAVE 1
137 fi 341 fi
138 done 342 elif [[ "$mode" == "dis" ]]; then
139 echo COMPLETE: ${tacleProg[$i]} 343 # Loop through each WSS and cache config if DIS
140done 344 while read j; do # For cache setting
141 345 echo $j > /sys/fs/resctrl/benchmarks/schemata
142# End contending tasks 346 while read ii; do # For WSS setting
143if [[ $5 == "--contend" ]]; then 347 if [[ -v $LITMUS ]]; then
144 killall thrasher 348 ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | numactl $numa_arg0 $prefix/${bench[$i]} $bench[$i]}-$ii-$j $maxJobs $core $runID 1
145fi 349 else
146 350 ./gen_input.py ${bench[$i]} inputs/${bench[$i]^}/$template_input $ii | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]}-$ii-$j $maxJobs $core $runID 1
147# Put smp_affinty back the way it was 351 fi
148i=0 352 done < $wss_settings
149for IRQ in /proc/irq/* 353 done < $cache_settings
150do 354 elif [[ "$mode" == "pair" ]]; then
151 if [ -d $IRQ ]; then 355 # Only async truly needs to do all-pairs
152 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list 356 if [[ ! -v async ]]; then
357 start=$i
358 else
359 start=0
360 fi
361 for (( j = $start; j < ${#bench[@]} ; j++ )); do
362 if [[ ! -v async ]]; then
363 # Synchronize between pairs - original hard real-time SMT approach
364 if [[ -v $LITMUS ]]; then
365 echo "${input[$i]}" | numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $core_two ${bench[$j]} $runID-$userRunID-A 1 & PID1=$!;
366 echo "${input[$j]}" | numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$j]} ${bench[$j]} $maxJobs $core_two $core ${bench[$i]} $runID-$userRunID-B 2 & PID2=$!;
367 else
368 echo "${input[$i]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$i]} ${bench[$i]} $maxJobs $core $core_two ${bench[$j]} $runID-$userRunID-A 1 & PID1=$!;
369 echo "${input[$j]}" | chrt -r 97 numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$j]} ${bench[$j]} $maxJobs $core_two $core ${bench[$i]} $runID-$userRunID-B 2 & PID2=$!;
370 fi
371 # We launched them asynchronously, so we have to wait
372 wait $PID1 $PID2
373 else
374 # No synchronization between pairs - original soft real-time SMT approach
375 if [[ -v $LITMUS ]]; then
376 echo "${input[$j]}" | numactl $numa_arg0 taskset -c $core $prefix/${bench[$j]} ${bench[$j]} -1 $core NULL 0 & PID1=$!;
377 echo "${input[$i]}" | numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$i]} ${bench[$i]}"+"${bench[$j]} $maxJobs $core_two $runID-$userRunID 1 & PID2=$!;
378 else
379 echo "${input[$j]}" | chrt -r 97 numactl $numa_arg0 taskset -c $core $prefix/${bench[$j]} ${bench[$j]} -1 $core NULL 0 & PID1=$!;
380 echo "${input[$i]}" | chrt -r 97 numactl $numa_arg1 taskset -c $core_two $prefix/${bench[$i]} ${bench[$i]}"+"${bench[$j]} $maxJobs $core_two $runID-$userRunID 1 & PID2=$!;
381 fi
382 wait $PID2
383 kill $PID1
384 fi
385 if [[ $? != 0 ]]; then
386 echo -e ${FAIL_COLOR}FAILED${RESET_COLOR}: ${bench[$i]} ${bench[$j]}
387 else
388 echo -e ${GOOD_COLOR}COMPLETE${RESET_COLOR}: ${bench[$i]} ${bench[$j]}
389 fi
390 done
391 fi
392 if [[ $? != 0 ]]; then
393 echo -e ${FAIL_COLOR}FAILED${RESET_COLOR}: ${bench[$i]}
394 else
395 echo -e ${GOOD_COLOR}COMPLETE${RESET_COLOR}: ${bench[$i]}
153 fi 396 fi
154 i=$(( $i + 1 ))
155done 397done
156 398
diff --git a/run_dis_cache_vs_wss.sh b/run_dis_cache_vs_wss.sh
new file mode 100755
index 0000000..2a7991e
--- /dev/null
+++ b/run_dis_cache_vs_wss.sh
@@ -0,0 +1,67 @@
1#!/bin/bash
2# Run baselines for all the DIS tasks
3if [ "$EUID" -ne 0 ]
4then
5 echo "You need to be root to enable cache way and interrupt isolation!"
6 exit
7fi
8
9if uname -a | grep -q "mc2"; then
10 echo "MC^2 detected! Cache isolation will be enabled"
11 iso="i"
12else
13 echo "MC^2 not detected."
14 iso="xi"
15fi
16
17cd dis
18
19WSSS=WSSS_maxstride2mb
20caches=caches_all
21if [[ $1 == "--contend" ]]; then
22 echo "Will run 6 contending tasks"
23 echo "Files will be named $datestring-<benchmark name>-10-c-"$iso".txt"
24 echo "Please verify the above settings. Press enter to continue..."
25 read
26 echo "field" > /tmp/disNames.txt
27 ../run_bench.sh -p 15 -B -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 field-10
28 ./postproc.sh $datestring-field-10-c-$iso
29 echo "matrix" > /tmp/disNames.txt
30 ../run_bench.sh -p 15 -B -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 matrix-10
31 ./postproc.sh $datestring-matrix-10-c-$iso
32 echo "neighborhood" > /tmp/disNames.txt
33 ../run_bench.sh -p 15 -B -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 neighborhood-10
34 ./postproc.sh $datestring-neighborhood-10-c-$iso
35 echo "pointer" > /tmp/disNames.txt
36 ../run_bench.sh -p 15 -B -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 pointer-10
37 ./postproc.sh $datestring-pointer-10-c-$iso
38 echo "transitive" > /tmp/disNames.txt
39 ../run_bench.sh -p 15 -B -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 transitive-10
40 ./postproc.sh $datestring-transitive-10-c-$iso
41 echo "update" > /tmp/disNames.txt
42 ../run_bench.sh -p 15 -B -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 update-10
43 ./postproc.sh $datestring-update-10-c-$iso
44else
45 echo "Will run no contending tasks (use --contend for contending tasks)"
46 echo "Files will be named $datestring-<benchmark name>-10-xc-"$iso".txt"
47 echo "Please verify the above settings. Press enter to continue..."
48 read
49 echo "field" > /tmp/disNames.txt
50 ../run_bench.sh -p 15 -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 field-10
51 ./postproc.sh $datestring-field-10-xc-$iso
52 echo "matrix" > /tmp/disNames.txt
53 ../run_bench.sh -p 15 -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 matrix-10
54 ./postproc.sh $datestring-matrix-10-xc-$iso
55 echo "neighborhood" > /tmp/disNames.txt
56 ../run_bench.sh -p 15 -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 neighborhood-10
57 ./postproc.sh $datestring-neighborhood-10-xc-$iso
58 echo "pointer" > /tmp/disNames.txt
59 ../run_bench.sh -p 15 -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 pointer-10
60 ./postproc.sh $datestring-pointer-10-xc-$iso
61 echo "transitive" > /tmp/disNames.txt
62 ../run_bench.sh -p 15 -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 transitive-10
63 ./postproc.sh $datestring-transitive-10-xc-$iso
64 echo "update" > /tmp/disNames.txt
65 ../run_bench.sh -p 15 -l 10 -b /tmp/disNames.txt -W WSSS -C caches -T in0 update-10
66 ./postproc.sh $datestring-update-10-xc-$iso
67fi
diff --git a/run_everything.sh b/run_everything.sh
deleted file mode 100755
index 8d46ad7..0000000
--- a/run_everything.sh
+++ /dev/null
@@ -1,21 +0,0 @@
1#!/bin/bash
2
3maxJobs=$1
4runID=$2
5
6if [ $# -lt 2 ]; then
7 echo "Usage $0 <number of iterations> <run ID>"
8 exit
9fi
10
11date
12cd baseline
13make all
14../interference-benchmark/deactivateCoresSMT.bash
15./run_baseline.sh 15 $maxJobs $runID
16date
17cd ../all_pairs
18../../interference-benchmark/activateCores.bash
19make all
20./run_all_pairs.sh 15 31 $maxJobs $runID
21date
diff --git a/run_tacle_rtss20.sh b/run_tacle_rtss20.sh
deleted file mode 100755
index 6770c55..0000000
--- a/run_tacle_rtss20.sh
+++ /dev/null
@@ -1,48 +0,0 @@
1#!/bin/bash
2# Copyright 2020 Joshua Bakita
3# This script runs the baselines and Level-A/B and Level-C all_pairs for TACLe w/out MC^2
4
5if uname -a | grep -q mc2; then
6 echo "You need to run this without MC^2!"
7 exit
8fi
9
10if [ "$EUID" -ne 0 ]; then
11 echo "You need to be root to enable interrupt isolation and real-time execution!"
12 exit
13fi
14
15echo "This will run the contended and uncontended TACLe baseline, all-pairs, and Level-C micro-benchamarks in non-interactive mode."
16echo "Please press enter to confirm (Ctrl-C to abort)..."
17read
18
19echo "performance" > /sys/devices/system/cpu/cpu15/cpufreq/scaling_governor
20echo "performance" > /sys/devices/system/cpu/cpu31/cpufreq/scaling_governor
21
22cd baseline
23baseNo=baseline/$(date +"%b%d-%H")-xc-xi-1k.txt
24echo "" | ./run_baseline.sh 15 1001 1k ../all_pairs/tacleNames.txt
25baseYes=baseline/$(date +"%b%d-%H")-c-xi-1k.txt
26echo "" | ./run_baseline.sh 15 1001 1k ../all_pairs/tacleNames.txt --contend
27
28cd ../all_pairs
29pairsNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k
30echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt
31pairsYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k
32echo "" | ./run_all_pairs.sh 15 31 1001 1k ./tacleNames.txt --contend
33
34cd ../baseline
35echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt
36cNo=all_pairs/$(date +"%b%d-%H")-xc-xi-1k-LC-TACLe.txt
37echo "" | ../smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh 15 31 1001 1k ./tacleNames.txt --contend
38cYes=all_pairs/$(date +"%b%d-%H")-c-xi-1k-LC-TACLe.txt
39
40echo "==== DONE ==="
41echo "Results are in:"
42echo "- "$baseNo
43echo "- "$baseYes
44echo "- "$pairsNo" (A/B)"
45echo "- "$pairsYes" (A/B)"
46echo "- "$cNo
47echo "- "$cYes
48
diff --git a/smt_analysis/computeLCslowdown.py b/smt_analysis/computeLCslowdown.py
new file mode 100755
index 0000000..bcd22da
--- /dev/null
+++ b/smt_analysis/computeLCslowdown.py
@@ -0,0 +1,73 @@
1#!/usr/bin/python3
2import numpy as np
3import sys
4import plotille.plotille as plt
5from libSMT import *
6TIMING_ERROR = 1000 #ns
7ASYNC_FORMAT = False
8
9def print_usage():
10 print("This program takes in the all-pairs and baseline SMT data and computes the worst-case slowdown against any other task when SMT is enabled.", file=sys.stderr)
11 print("Level-A/B usage: {} <file -A> <file -B> <baseline file>".format(sys.argv[0]), file=sys.stderr)
12 print("Level-C usage: {} <continuous pairs> <baseline file>".format(sys.argv[0]), file=sys.stderr)
13
14# Check that we got the right number of parameters
15if len(sys.argv) < 3:
16 print_usage()
17 exit()
18
19if len(sys.argv) > 3:
20 print("Reading file using synchronous pair format...")
21 print("Are you sure you want to do this? For the RTAS'21 paper, L-A/-B pairs should use the other script.")
22 input("Press enter to continue, Ctrl+C to exit...")
23else:
24 print("Reading file using asynchronous pair format...")
25 ASYNC_FORMAT = True
26
27assert_valid_input_files(sys.argv[1:-1], print_usage)
28
29# Pull in the data
30if not ASYNC_FORMAT:
31 baseline_times, baseline_sample_cnt, baseline_max_times = load_baseline(sys.argv[3])
32 paired_times, paired_offsets, name_to_idx, idx_to_name = load_paired(sys.argv[1], sys.argv[2], len(list(baseline_times.keys())))
33 for key in baseline_times:
34 print(key,max(baseline_times[key]))
35else:
36 baseline_times, baseline_sample_cnt, baseline_max_times = load_baseline(sys.argv[2])
37 paired_times, name_to_idx, idx_to_name = load_fake_paired(sys.argv[1])
38
39# We work iff the baseline was run for the same set of benchmarks as the pairs were
40assert_base_and_pair_keys_match(baseline_times, name_to_idx)
41
42# Only consider benchmarks that are at least an order of magnitude longer than the timing error
43reliableNames = []
44for i in range(0, len(name_to_idx)):
45 benchmark = idx_to_name[i]
46 if min(baseline_times[benchmark]) > TIMING_ERROR * 10:
47 reliableNames.append(benchmark)
48
49# Compute worst-case SMT slowdown for each benchmark
50print("Bench Mi")
51# Print rows
52sample_f = np.mean # Change this to np.mean to use mean values in Mi generation
53M_vals = []
54for b1 in reliableNames:
55 print("{:<14.14}:".format(b1), end=" ")
56 max_mi = 0
57 # Scan through everyone we ran against and find our maximum slowdown
58 for b2 in reliableNames:
59 time_with_smt = sample_f(paired_times[name_to_idx[b1]][name_to_idx[b2]])
60 time_wout_smt = sample_f(baseline_times[b1])
61 M = time_with_smt / time_wout_smt
62 max_mi = max(max_mi, M)
63 print("{:>10.3}".format(max_mi), end=" ")
64 M_vals.append(max_mi)
65 print("")
66# Print some statistics about the distribution
67print("Average: {:>5.3} with standard deviation {:>5.3} using `{}`".format(np.mean(M_vals), np.std(M_vals), sample_f.__name__))
68Ms = np.asarray(M_vals, dtype=np.float32)
69print(np.sum(Ms <= 1), "of", len(M_vals), "M_i values are at most one -", 100*np.sum(Ms <= 1)/len(M_vals), "percent")
70print(np.sum(Ms > 2), "of", len(M_vals), "M_i values are greater than two -", 100*np.sum(Ms > 2)/len(M_vals), "percent")
71M_vals_to_plot = Ms
72
73print(plt.hist(M_vals_to_plot, bins=10))
diff --git a/smt_analysis/computeSMTslowdown.py b/smt_analysis/computeSMTslowdown.py
new file mode 100755
index 0000000..805def1
--- /dev/null
+++ b/smt_analysis/computeSMTslowdown.py
@@ -0,0 +1,155 @@
1#!/usr/bin/python3
2from typing import List, Any
3import numpy as np
4from scipy import stats
5import sys
6import plotille.plotille as plt
7TIMING_ERROR = 1000 #ns
8LEVEL_C_ANALYSIS = False
9from libSMT import *
10
11def print_usage():
12 print("This program takes in the all-pairs and baseline SMT data and computes how much each program is slowed when SMT in enabled.", file=sys.stderr)
13 print("Level-A/B usage: {} <file -A> <file -B> <baseline file> --cij".format(sys.argv[0]), file=sys.stderr)
14 print("Level-C usage: {} <continuous pairs> <baseline file>".format(sys.argv[0]), file=sys.stderr)
15
16# Check that we got the right number of parameters
17if len(sys.argv) < 3:
18 print_usage()
19 exit()
20
21if len(sys.argv) > 3:
22 print("Analyzing results using Level-A/B methodology...")
23else:
24 print("Analyzing results using Level-C methodology...")
25 LEVEL_C_ANALYSIS = True
26
27assert_valid_input_files(sys.argv[1:-1], print_usage);
28
29# Print Cij values rather than Mij
30TIMES_ONLY = len(sys.argv) > 4 and "--cij" in sys.argv[4]
31OK_PAIRS_ONLY = len(sys.argv) > 4 and "--cij-ok" in sys.argv[4]
32
33# Pull in the data
34if not LEVEL_C_ANALYSIS:
35 baseline_times, baseline_sample_cnt, baseline_max_times = load_baseline(sys.argv[3])
36 paired_times, paired_offsets, name_to_idx, idx_to_name = load_paired(sys.argv[1], sys.argv[2], len(list(baseline_times.keys())))
37 for key in baseline_times:
38 print(key,max(baseline_times[key]))
39else:
40 # Paired times use an abuse of the baseline file format
41 baseline_times, baseline_sample_cnt, baseline_max_times = load_baseline(sys.argv[2])
42 paired_times, name_to_idx, idx_to_name = load_fake_paired(sys.argv[1])
43
44# We work iff the baseline was run for the same set of benchmarks as the pairs were
45assert_base_and_pair_keys_match(baseline_times, name_to_idx)
46
47# Only consider benchmarks that are at least an order of magnitude longer than the timing error
48reliableNames = []
49for i in range(0, len(name_to_idx)):
50 benchmark = idx_to_name[i]
51 if min(baseline_times[benchmark]) > TIMING_ERROR * 10:
52 reliableNames.append(benchmark)
53
54# Compute SMT slowdown for each benchmark
55# Output format: table, each row is one benchmark and each column is one benchmark
56# each cell is base1 + base2*m = pair solved for m, aka (pair - base1) / base2
57# Print table header
58print("Bench ", end=" ")
59for name in reliableNames:
60 if not TIMES_ONLY: print("{:<10.10}".format(name), end=" ")
61 if TIMES_ONLY: print("{:<12.12}".format(name), end=" ")
62print()
63# Print rows
64sample_f = max # Change this to np.mean to use mean values in Mij generation
65M_vals = []
66for b1 in reliableNames:
67 if not TIMES_ONLY: print("{:<14.14}:".format(b1), end=" ")
68 if TIMES_ONLY: print("{:<14.14}:".format(b1), end=" ")
69 for b2 in reliableNames:
70 if not LEVEL_C_ANALYSIS:
71 Ci = max(sample_f(baseline_times[b1]), sample_f(baseline_times[b2]))
72 Cj = min(sample_f(baseline_times[b1]), sample_f(baseline_times[b2]))
73 Cij = sample_f(paired_times[name_to_idx[b1]][name_to_idx[b2]])
74 if False:
75 M = np.std(paired_times[name_to_idx[b1]][name_to_idx[b2]]) / np.mean(paired_times[name_to_idx[b1]][name_to_idx[b2]])
76 else:
77 M = (Cij - Ci) / Cj
78 if Cij and Cj * 10 > Ci: # We don't pair tasks with more than a 10x difference in length
79 M_vals.append(M)
80 if not TIMES_ONLY: print("{:>10.3}".format(M), end=" ")
81 else:
82 if not TIMES_ONLY: print("{:>10}".format("N/A"), end=" ")
83
84 if TIMES_ONLY and (not OK_PAIRS_ONLY or Cj * 10 > Ci):
85 print("{:>12}".format(Cij), end=" ")
86 elif OK_PAIRS_ONLY and Cj * 10 <= Ci:
87 print("{:>12}".format("0"), end=" ")
88
89 else:
90 time_with_smt = sample_f(paired_times[name_to_idx[b1]][name_to_idx[b2]])
91 time_wout_smt = sample_f(baseline_times[b1])
92 M = time_with_smt / time_wout_smt
93 M_vals.append(M)
94 print("{:>10.3}".format(M), end=" ")
95 print("")
96# Print some statistics about the distribution
97print("Average: {:>5.3} with standard deviation {:>5.3} using `{}`".format(np.mean(M_vals), np.std(M_vals), sample_f.__name__))
98Ms = np.asarray(M_vals, dtype=np.float32)
99if not LEVEL_C_ANALYSIS:
100 print(np.sum(Ms <= 0), "of", len(M_vals), "M_i:j values are at most zero -", 100*np.sum(Ms <= 0)/len(M_vals), "percent")
101 print(np.sum(Ms > 1), "of", len(M_vals), "M_i:j values are greater than one -", 100*np.sum(Ms > 1)/len(M_vals), "percent")
102 M_vals_to_plot = Ms[np.logical_and(Ms > 0, Ms <= 1)]
103else:
104 print(np.sum(Ms <= 1), "of", len(M_vals), "M_i:j values are at most one -", 100*np.sum(Ms <= 1)/len(M_vals), "percent")
105 print(np.sum(Ms > 2), "of", len(M_vals), "M_i:j values are greater than two -", 100*np.sum(Ms > 2)/len(M_vals), "percent")
106 M_vals_to_plot = Ms
107
108print("Using Sim's analysis, average: {:>5.3} with standard deviation {:>5.3} using `{}`".format(np.mean(list(M_vals_to_plot)), np.std(list(M_vals_to_plot)), sample_f.__name__))
109print(plt.hist(M_vals_to_plot, bins=10))
110
111##### BELOW TEXT IS OLD OFFSET CODE (patched) #####
112## This still works, but is hacky and deprecated ##
113## PearsonR doesn't work though ##
114if not LEVEL_C_ANALYSIS and False:
115 benchmarkNames = idx_to_name
116 benchmarkCount = len(benchmarkNames)
117 numJobs = len(paired_times[0][0])
118
119 reliableNames=["ndes", "cjpeg_wrbmp", "adpcm_enc", "cjpeg_transupp", "epic", "gsm_dec", "h264_dec", "huff_enc", "rijndael_enc", "rijndael_dec", "gsm_enc", "ammunition", "mpeg2"]
120
121 #stats.pearsonr(time[b1][b2], oList),
122
123 with open("weakRelPairs_offset.csv", mode="w+") as f3:
124 print("Benchmark1", "Benchmark2", "minOffset", "maxOffset", "meanOffset", "meddOffset", "stdOffset", "minLength", "maxLength", sep=",", file=f3)
125 for b1 in range (0, benchmarkCount):
126 for b2 in range (0, benchmarkCount):
127 if benchmarkNames[b1] in reliableNames and benchmarkNames[b2] in reliableNames:
128 #exclude last job due to inccurate timing
129 oList = paired_offsets[b1][b2][:numJobs-1]
130 jList = paired_times[b1][b2][:numJobs-1]
131# plt.scatter(oList, jList)
132# plt.title(benchmarkNames[b1] + ", " + benchmarkNames[b2])
133# plt.show()
134# print(benchmarkNames[b1], benchmarkNames[b2], min(oList), max(oList), np.mean(oList), np.median(oList), np.std(oList), stats.pearsonr(jList, oList), stats.spearmanr(jList, oList), sep=",", file=f3)
135 print(benchmarkNames[b1], benchmarkNames[b2], min(oList), max(oList), np.mean(oList), np.median(oList), np.std(oList), min(jList), max(jList), sep=",", file=f3)
136"""
137#with open("reliableGraphs.csv", mode="x") as f3:
138 for b1 in range(0, benchmarkCount):
139 for b2 in range(0, benchmarkCount):
140 if benchmarkNames[b1] in reliableNames and benchmarkNames[b2] in reliableNames:
141 oList = offset[b1][b2][:numJobs - 1]
142 jList=time[b1][b2][:numJobs-1]
143 # offset, time scatterplot
144 plt.scatter(oList, jList)
145 plt.title(benchmarkNames[b1] + " " + benchmarkNames[b2] + " Offsets v. Time")
146 plt.show()
147 #time histogram
148 #plt.hist(jList, bins=10)
149 #plt.title(benchmarkNames[b1] + benchmarkNames[b2] + "Completion Times")
150 #plt.show()
151 #offset histogram
152 #plt.hist(oList, bins=10)
153 #plt.title(benchmarkNames[b1] + benchmarkNames[b2] + "Offsets")
154 #plt.show()
155"""
diff --git a/smt_analysis/libSMT.py b/smt_analysis/libSMT.py
new file mode 100755
index 0000000..cca2fce
--- /dev/null
+++ b/smt_analysis/libSMT.py
@@ -0,0 +1,151 @@
1import numpy as np
2import sys
3import os
4
5def assert_valid_input_files(names, on_fail):
6 # Check that all input files are valid
7 for f in names:
8 if not os.path.exists(f) or os.path.getsize(f) == 0:
9 print("ERROR: File '{}' does not exist or is empty".format(f), file=sys.stderr);
10 on_fail()
11 exit()
12
13# This parses the result data from unthreaded timing experiments
14# @param f File name to load
15# @returns res Map of benchmark name to sample count
16# @returns samples Map of benchmark name to list of execution time samples
17# @returns max_res May of benchmark to maximum execution time among all samples for that benchmark
18def load_baseline(f):
19 # constants for columns of baseline data files
20 TOTAL_NS = 5
21 BENCH_NAME = 0
22 SAMPLES = 4
23
24 # Load baseline data. This logic is based off the summarize programs
25 res = {} # Map of benchmark to list of all execution time samples
26 samples = {} # Map of benchmark name to sample count
27 max_res = {} # Map of benchmark name to maximum execution time
28
29 with open(f) as fp:
30 for line in fp:
31 s = line.split()
32 if s[BENCH_NAME] not in res:
33 res[s[BENCH_NAME]] = list([int(s[TOTAL_NS])])
34 samples[s[BENCH_NAME]] = int(s[SAMPLES])
35 max_res[s[BENCH_NAME]] = int(s[TOTAL_NS])
36 else:
37 res[s[BENCH_NAME]].append(int(s[TOTAL_NS]))
38 max_res[s[BENCH_NAME]] = max(int(s[TOTAL_NS]), max_res[s[BENCH_NAME]])
39 return res, samples, max_res
40
41# This parses the result data from paired, threaded timing experiements
42# @param file1 The -A file name
43# @param file2 The -B file name
44# @returns time 2D array of benchmark IDs to list of total container execution times
45# @returns offset 2D array of benchmark IDs to list of differences between the start
46# of the first and the start of the second benchmark
47# @returns name_to_idx Map of benchmark names to benchmark IDs
48# @returns idx_to_name List which when indexed with benchmark ID will yield the benchmark name
49def load_paired(file1, file2, benchmarkCount):
50 # constants for columns of paired data files
51 FIRST_PROG = 0
52 SECOND_PROG = 1
53 FIRST_CORE = 2
54 SECOND_CORE = 3
55 TRIALS = 4
56 START_S = 5 # Start seconds
57 START_N = 6 # Start nanoseconds
58 END_S = 7 # End seconds
59 END_N = 8 # End nanoseconds
60 RUN_ID = 9
61 JOB_NUM = 10
62
63 with open(file1) as f1:
64 numJobs = int(f1.readline().split()[TRIALS])
65 assert numJobs > 0
66 assert benchmarkCount > 0
67
68 # Total times of each container
69 time=[[[0 for x in range(numJobs)]for y in range(benchmarkCount)]for z in range(benchmarkCount)]
70 # Difference in time between when the first and the second task start in the container
71 offset=[[[0 for x in range(numJobs)]for y in range(benchmarkCount)]for z in range(benchmarkCount)]
72
73 # Some aggregate counters that we update as we go along
74 avg_off = 0
75 avg_off_samp = 0
76
77 # Load paired data
78 bench1 = 0 # Index to what's the current first benchmark being examined
79 bench2 = 0 # Index to what's the current second benchmark being examined
80
81 name_to_idx = {}
82 idx_to_name = [0 for x in range(benchmarkCount)]
83
84 job_idx = 0
85 with open(file1) as f1, open(file2) as f2:
86 for line1, line2 in zip(f1, f2):
87 lineArr1 = line1.split()
88 lineArr2 = line2.split()
89 start1 = int(lineArr1[START_S]) * 10**9 + int(lineArr1[START_N])
90 start2 = int(lineArr2[START_S]) * 10**9 + int(lineArr2[START_N])
91 minStart = min(start1, start2)
92 end1 = int(lineArr1[END_S]) * 10**9 + int(lineArr1[END_N])
93 end2 = int(lineArr2[END_S]) * 10**9 + int(lineArr2[END_N])
94 maxEnd = max(end1, end2)
95 # Time actually co-scheduled is minEnd - maxStart, but Sims uses a different model
96# time[bench1][bench2][int(lineArr1[JOB_NUM])] = maxEnd - minStart
97 time[bench1][bench2][job_idx] = maxEnd - minStart
98 if lineArr1[SECOND_PROG] == "h264_dec" and lineArr2[JOB_NUM] == 0:
99 print(maxEnd - minStart)
100 # Compute offset: if first job starts at t=0, when does second start?
101# offset[bench1][bench2][int(lineArr1[JOB_NUM])] = abs(start2-start1)
102 offset[bench1][bench2][job_idx] = abs(start2-start1)
103 # Compute some running statistics
104 avg_off += abs(start2-start1)
105 avg_off_samp += 1
106 # Increment to the next benchmark, this is weird because of the zip()
107 # This is doubly weird because our results are an upper trianguler matrix
108 if job_idx == numJobs - 1: #int(lineArr1[JOB_NUM]) == numJobs - 1:
109 if bench2 < benchmarkCount-1:
110 bench2 = bench2 + 1
111 job_idx = 0
112 else:
113 name_to_idx[lineArr1[FIRST_PROG]] = bench1
114 idx_to_name[bench1] = lineArr1[FIRST_PROG]
115 bench1 = bench1 + 1
116 bench2 = bench1 # bench1 will never again appear as bench2
117 job_idx = 0
118 else:
119 job_idx += 1
120 print("Average offset is: " + str(avg_off/avg_off_samp) + "ns")
121 return time, offset, name_to_idx, idx_to_name
122
123# Paired times use an abuse of the baseline file format
124def load_fake_paired(fake_paired_filename):
125 paired_times_raw, _, _ = load_baseline(fake_paired_filename)
126 benchmarkCount = int(np.sqrt(len(list(paired_times_raw.keys()))))
127 numJobs = len(next(iter(paired_times_raw.values())))
128 paired_times=[[[0 for x in range(numJobs)]for y in range(benchmarkCount)]for z in range(benchmarkCount)]
129 idx_to_name=[]
130 name_to_idx={}
131 bench1 = -1
132 #Generate the indexing approach
133 for pair in sorted(paired_times_raw.keys()):
134 [bench1name, bench2name] = pair.split('+') # Benchmark name is pair concatenated together with a '+' delimiter
135 if bench1 == -1 or bench1name != idx_to_name[-1]:
136 idx_to_name.append(bench1name)
137 name_to_idx[bench1name] = len(idx_to_name) - 1
138 bench1 += 1
139 # Populate the array
140 for bench1 in range(len(idx_to_name)):
141 for bench2 in range(len(idx_to_name)):
142 paired_times[bench1][bench2] = paired_times_raw[idx_to_name[bench1]+"+"+idx_to_name[bench2]]
143 return paired_times, name_to_idx, idx_to_name
144
145def assert_base_and_pair_keys_match(baseline_times, name_to_idx):
146 if sorted(baseline_times.keys()) != sorted(name_to_idx.keys()):
147 print("ERROR: The baseline and paired experiments were over a different set of benchmarks!", file=sys.stderr)
148 print("Baseline keys:", baseline_times.keys(), file=sys.stderr)
149 print("Paired keys:", name_to_idx.keys(), file=sys.stderr)
150 exit();
151
diff --git a/smt_analysis/plotille b/smt_analysis/plotille
new file mode 160000
Subproject 41f50df2f5b499425465f506a9aae5acf1a39c0
diff --git a/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh b/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh
deleted file mode 100755
index 2ac3fc1..0000000
--- a/smt_analysis_rtss20/run_all_pairs_Level-C_DIS.sh
+++ /dev/null
@@ -1,175 +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
64echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
65echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list
66# Reset global bandwith control and remove L3 from global
67echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
68echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
69# Alloc L3 to benchmark
70echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
71echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
72echo "Done. Verifying configuration with user..."
73
74# Generate file name string
75# We append to this as we parse the environment settings
76runID=$(date +"%b%d-%H")
77
78# Confirm configuration with user
79echo "=== Global Config ==="
80cat /sys/fs/resctrl/schemata
81echo "=== Core $firstCore and $secondCore Config ==="
82cat /sys/fs/resctrl/benchmarks/schemata
83if [[ $6 == "--contend" ]]; then
84 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
85 echo "ERROR: thrasher binary not fonud. Exiting..."
86 exit
87 fi
88 echo "Will run 6 contending tasks"
89 runID=$runID-c
90else
91 runID=$runID-xc
92fi
93if uname -a | grep -q "mc2"; then
94 echo "MC^2 Autodetected. Cache coloring will be DISABLED."
95 runID=$runID-i
96else
97 echo "MC^2 not detected. Cache coloring will be DISABLED."
98 runID=$runID-xi
99fi
100echo "Results will be saved as $runID-$userRunID-LC-DIS.txt"
101echo "Press enter to confirm environment, Ctrl-C to exit..."
102read
103
104# Start contending tasks
105if [[ $6 == "--contend" ]]; then
106 echo "Done. Starting 6 contending tasks..."
107 # Run two contending tasks on each other CCX
108 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
109 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
110 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
111 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
112 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
113 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
114fi
115sleep 1 # Wait for contending tasks to start
116echo "Done. Beginning benchmarks..."
117
118num_tests=$(wc -l < $tacleNames)
119for (( i = 0; i < $num_tests ; i++ ))
120do
121 # For level-C analysis, we must run all vs all
122 for (( j = 0; j < $num_tests ; j++ )) #loop through programs
123 do
124 # Autodetect MC^2
125 # Get DIS to loop continuously in the background by infinite restarts
126 if uname -a | grep -q "mc2"; then
127 bash -c "while true; do chrt -r 97 numactl --interleave=all taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 &> /dev/null; done" & PID1=$!;
128 else
129 bash -c "while true; do chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 &> /dev/null; done" & PID1=$!;
130 fi
131 # Each sample runs in its own process
132 for ((k=0;k<=maxJobs;k++)); do
133 if uname -a | grep -q "mc2"; then
134 chrt -r 97 numactl --interleave=all taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!;
135 else
136 chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-DIS 1 & PID2=$!;
137 fi
138 done
139 # The paired task runs continuously in this configuration, so we have
140 # to kill it once the task that we're measuring finishes.
141 wait $PID2
142 kill $PID1
143 # Killing bash will not kill its children by default - work aronud that here
144 killall transitive &> /dev/null
145 killall matrix &> /dev/null
146 killall pointer &> /dev/null
147 killall field &> /dev/null
148 killall neighborhood &> /dev/null
149 killall update &> /dev/null
150 killall gen_input.py &> /dev/null
151 echo ${tacleProg[$i]} ${tacleProg[$j]}
152 done
153 echo COMPLETE: ${tacleProg[$i]}
154done
155
156# End contending tasks
157if [[ $6 == "--contend" ]]; then
158 killall thrasher
159fi
160
161# Remove semaphores from system
162# Leaving them won't hurt these tests, but would be messy and is bad practice
163# TODO: Do this directly in the benchmarks. They should clean up after themselves
164./bin/cleanupSemaphores
165
166# Put smp_affinty back the way it was
167i=0
168for IRQ in /proc/irq/*
169do
170 if [ -d $IRQ ]; then
171 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
172 fi
173 i=$(( $i + 1 ))
174done
175
diff --git a/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh b/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh
deleted file mode 100755
index 923dba0..0000000
--- a/smt_analysis_rtss20/run_all_pairs_Level-C_TACLe.sh
+++ /dev/null
@@ -1,161 +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
64echo $firstCore > /sys/fs/resctrl/benchmarks/cpus_list
65echo $secondCore > /sys/fs/resctrl/benchmarks/cpus_list
66# Reset global bandwith control and remove L3 from global
67echo "L3:0=ffff;1=ffff;2=ffff;3=0000" > /sys/fs/resctrl/schemata
68echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/schemata
69# Alloc L3 to benchmark
70echo "L3:0=0000;1=0000;2=0000;3=ffff" > /sys/fs/resctrl/benchmarks/schemata
71echo "MB:0=2048;1=2048;2=2048;3=2048" > /sys/fs/resctrl/benchmarks/schemata
72echo "Done. Verifying configuration with user..."
73
74# Generate file name string
75# We append to this as we parse the environment settings
76runID=$(date +"%b%d-%H")
77
78# Confirm configuration with user
79echo "=== Global Config ==="
80cat /sys/fs/resctrl/schemata
81echo "=== Core $firstCore and $secondCore Config ==="
82cat /sys/fs/resctrl/benchmarks/schemata
83if [[ $6 == "--contend" ]]; then
84 if [[ ! -f "/playpen/mc2/imx6q-thrasher/thrasher" ]]; then
85 echo "ERROR: thrasher binary not fonud. Exiting..."
86 exit
87 fi
88 echo "Will run 6 contending tasks"
89 runID=$runID-c
90else
91 runID=$runID-xc
92fi
93if uname -a | grep -q "mc2"; then
94 echo "MC^2 Autodetected. Cache coloring will be DISABLED."
95 runID=$runID-i
96else
97 echo "MC^2 not detected. Cache coloring will be DISABLED."
98 runID=$runID-xi
99fi
100echo "Results will be saved as $runID-$userRunID-LC-TACLe.txt"
101echo "Press enter to confirm environment, Ctrl-C to exit..."
102read
103
104# Start contending tasks
105if [[ $6 == "--contend" ]]; then
106 echo "Done. Starting 6 contending tasks..."
107 # Run two contending tasks on each other CCX
108 taskset -c 1 /playpen/mc2/imx6q-thrasher/thrasher &
109 taskset -c 2 /playpen/mc2/imx6q-thrasher/thrasher &
110 taskset -c 5 /playpen/mc2/imx6q-thrasher/thrasher &
111 taskset -c 6 /playpen/mc2/imx6q-thrasher/thrasher &
112 taskset -c 9 /playpen/mc2/imx6q-thrasher/thrasher &
113 taskset -c 10 /playpen/mc2/imx6q-thrasher/thrasher &
114fi
115sleep 1 # Wait for contending tasks to start
116echo "Done. Beginning benchmarks..."
117
118num_tests=$(wc -l < $tacleNames)
119for (( i = 0; i < $num_tests ; i++ ))
120do
121 # For level-C analysis, we must run all vs all
122 for (( j = 0; j < $num_tests ; j++ )) #loop through programs
123 do
124 # Autodetect MC^2
125 if uname -a | grep -q "mc2"; then
126 # -1 loops means loop forever
127 chrt -r 97 numactl --interleave=all taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 & PID1=$!;
128 chrt -r 97 numactl --interleave=all taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-TACLe 1 & PID2=$!;
129 else
130 chrt -r 97 taskset -c $firstCore ./bin/${tacleProg[$i]} NULL -1 $firstCore NULL 0 & PID1=$!;
131 chrt -r 97 taskset -c $secondCore ./bin/${tacleProg[$i]} ${tacleProg[$i]}"+"${tacleProg[$j]} $maxJobs $secondCore $runID-$userRunID-LC-TACLe 1 & PID2=$!;
132 fi
133 # The paired task runs continuously in this configuration, so we have
134 # to kill it once the task that we're measuring finishes.
135 wait $PID2
136 kill $PID1
137 echo ${tacleProg[$i]} ${tacleProg[$j]}
138 done
139 echo COMPLETE: ${tacleProg[$i]}
140done
141
142# End contending tasks
143if [[ $6 == "--contend" ]]; then
144 killall thrasher
145fi
146
147# Remove semaphores from system
148# Leaving them won't hurt these tests, but would be messy and is bad practice
149# TODO: Do this directly in the benchmarks. They should clean up after themselves
150./bin/cleanupSemaphores
151
152# Put smp_affinty back the way it was
153i=0
154for IRQ in /proc/irq/*
155do
156 if [ -d $IRQ ]; then
157 echo ${irqList[$i]} 2> /dev/null > $IRQ/smp_affinity_list
158 fi
159 i=$(( $i + 1 ))
160done
161
diff --git a/dis/summarize.py b/summarize.py
index 31dcccc..2183c41 100755
--- a/dis/summarize.py
+++ b/summarize.py
@@ -50,19 +50,28 @@ def percentile(N, percent, key=lambda x:x):
50 d1 = key(N[int(c)]) * (k-f) 50 d1 = key(N[int(c)]) * (k-f)
51 return d0+d1 51 return d0+d1
52## end of http://code.activestate.com/recipes/511478/ }}} 52## end of http://code.activestate.com/recipes/511478/ }}}
53def memstring(memr, memw, samples):
54 if memr or memw:
55 return "\t{:>12.f}\t{:>12.f}".format(memr/samples, memw/samples)
56 else:
57 return ""
53avg_max = 0 58avg_max = 0
54avg_99th = 0 59avg_99th = 0
55avg_avg = 0 60avg_avg = 0
56print("Name\t\tAverage\t\tMax\t\t99th %\t\tAvg Mem Read\tAvg Mem Write\t") 61# Only include memory info in the header if relevant
62if mem_res[s[0]] == 0:
63 print("Name\t\tAverage\t\tMax\t\t99th %")
64else:
65 print("Name\t\tAverage\t\tMax\t\t99th %\t\tAvg Mem Read\tAvg Mem Write\t")
57for r in sorted(res.keys()): 66for r in sorted(res.keys()):
58# print(r + "\t\t" + str(res[r]/samples[r]) + "\t\t" + str(max_res[r])) 67# print(r + "\t\t" + str(res[r]/samples[r]) + "\t\t" + str(max_res[r]))
59 avg_avg += sum(res[r])/len(res[r]) 68 avg_avg += sum(res[r])/len(res[r])
60 avg_max += max(res[r]) 69 avg_max += max(res[r])
61 avg_99th += percentile(sorted(res[r]), 0.99) 70 avg_99th += percentile(sorted(res[r]), 0.99)
62 if len(sys.argv) > 2 and sys.argv[2] == "--inf-precision": 71 if len(sys.argv) > 2 and sys.argv[2] == "--inf-precision":
63 print("{:12}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}".format(r, sum(res[r])/len(res[r]), max(res[r]), percentile(sorted(res[r]), 0.99), mem_res[r]/samples[r], memw_res[r]/samples[r])) 72 print("{:12}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}".format(r, sum(res[r])/len(res[r]), max(res[r]), percentile(sorted(res[r]), 0.99)) + memstring(mem_res[r], memw_res[r], samples[r]))
64 else: 73 else:
65 print("{:12.12}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}".format(r, sum(res[r])/len(res[r]), max(res[r]), percentile(sorted(res[r]), 0.99), mem_res[r]/samples[r], memw_res[r]/samples[r])) 74 print("{:12.12}\t{:>12.0f}\t{:>12.0f}\t{:>12.0f}".format(r, sum(res[r])/len(res[r]), max(res[r]), percentile(sorted(res[r]), 0.99)) + memstring(mem_res[r], memw_res[r], samples[r]))
66 75
67print("Average average:", avg_avg/len(res.keys())) 76print("Average average:", avg_avg/len(res.keys()))
68print("Average max:", avg_max/len(res.keys())) 77print("Average max:", avg_max/len(res.keys()))
diff --git a/wbinvd b/wbinvd
new file mode 160000
Subproject 912e9a22c23da6f5b1af13e410ee74d9b27146a