summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2020-05-29 12:44:28 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2020-05-29 12:44:28 -0400
commit8dfefc152f16f9fd9e8aa0910fd4d23d6543d87e (patch)
tree4e5c596dadf1df4fb77c9a10b3e483939c6aa018
parent43ce989b5077913f18a5b083501498f5e1a6d349 (diff)
Add DIS benchmarks and scripts as they were used for Joshua's PRP
Note that Neighborhood has been modified to use less space
-rw-r--r--dis/original/Field/field.c8
-rw-r--r--dis/original/Neighborhood/neighborhood.c9
-rw-r--r--dis/original/Neighborhood/utili.h2
-rw-r--r--dis/original/Pointer/pointer.c8
-rw-r--r--dis/original/Transitive/transitive.c7
-rw-r--r--dis/original/Update/update.c7
-rwxr-xr-xdis/original/runDIS1.sh2
-rwxr-xr-xdis/original/runDIS2.sh2
-rwxr-xr-xdis/original/runDIS4.sh5
-rwxr-xr-xdis/original/summarize.py71
10 files changed, 111 insertions, 10 deletions
diff --git a/dis/original/Field/field.c b/dis/original/Field/field.c
index 7d26d37..a561f72 100644
--- a/dis/original/Field/field.c
+++ b/dis/original/Field/field.c
@@ -18,6 +18,7 @@
18#include <assert.h> 18#include <assert.h>
19#include <stdlib.h> 19#include <stdlib.h>
20#include "DISstressmarkRNG.h" 20#include "DISstressmarkRNG.h"
21#include "extra.h"
21 22
22 23
23#define MIN_FIELD_SIZE 16 24#define MIN_FIELD_SIZE 16
@@ -38,8 +39,8 @@
38 * main() 39 * main()
39 */ 40 */
40 41
41int main(){ 42int main(int argc, char** argv){
42 43 SET_UP
43 unsigned char *field; 44 unsigned char *field;
44 unsigned int f; 45 unsigned int f;
45 int seed; 46 int seed;
@@ -93,6 +94,7 @@ int main(){
93 startTime = time(NULL); 94 startTime = time(NULL);
94 95
95 for (l =0; l<n; l++){ 96 for (l =0; l<n; l++){
97 START_LOOP
96 unsigned int index; 98 unsigned int index;
97 99
98 token[l].subfields = 0; 100 token[l].subfields = 0;
@@ -130,6 +132,7 @@ int main(){
130 } 132 }
131 index++; 133 index++;
132 } 134 }
135 STOP_LOOP
133 } 136 }
134 137
135 startTime = time(NULL) - startTime; 138 startTime = time(NULL) - startTime;
@@ -144,5 +147,6 @@ int main(){
144 } 147 }
145 fprintf(stdout, "total time = %d seconds.\n", (int)startTime); 148 fprintf(stdout, "total time = %d seconds.\n", (int)startTime);
146 free(field); 149 free(field);
150 WRITE_TO_FILE
147 return(0); 151 return(0);
148 } 152 }
diff --git a/dis/original/Neighborhood/neighborhood.c b/dis/original/Neighborhood/neighborhood.c
index e3d4f69..2d50336 100644
--- a/dis/original/Neighborhood/neighborhood.c
+++ b/dis/original/Neighborhood/neighborhood.c
@@ -19,11 +19,12 @@
19#include<assert.h> 19#include<assert.h>
20#include "DISstressmarkRNG.h" 20#include "DISstressmarkRNG.h"
21#include "utili.h" 21#include "utili.h"
22#include "extra.h"
22 23
23/* 24/*
24 * main() 25 * main()
25 */ 26 */
26int main() 27int main(int argc, char** argv)
27{ 28{
28 long int seed; 29 long int seed;
29 int dimension; 30 int dimension;
@@ -39,6 +40,7 @@ int main()
39 40
40 time_t beginTime; 41 time_t beginTime;
41 time_t endTime; 42 time_t endTime;
43 SET_UP
42 44
43 fscanf(stdin, "%ld %d %d %d %d %d %d %d", 45 fscanf(stdin, "%ld %d %d %d %d %d %d %d",
44 &seed, &bitDepth, &dimension, &numberLines, 46 &seed, &bitDepth, &dimension, &numberLines,
@@ -61,11 +63,12 @@ int main()
61 assert (image != NULL); 63 assert (image != NULL);
62 64
63 beginTime = time(NULL); 65 beginTime = time(NULL);
64 66 START_LOOP
65 neighborhoodCalculation(image, dimension, 67 neighborhoodCalculation(image, dimension,
66 distanceShort, distanceLong, &values, maxPixel); 68 distanceShort, distanceLong, &values, maxPixel);
67 69 STOP_LOOP
68 endTime = time(NULL); 70 endTime = time(NULL);
71 WRITE_TO_FILE
69 72
70 printf(" end time is %d\n", endTime); 73 printf(" end time is %d\n", endTime);
71 74
diff --git a/dis/original/Neighborhood/utili.h b/dis/original/Neighborhood/utili.h
index 2a8e2a0..87a481c 100644
--- a/dis/original/Neighborhood/utili.h
+++ b/dis/original/Neighborhood/utili.h
@@ -54,7 +54,7 @@ typedef struct {
54 Angeles distLong; 54 Angeles distLong;
55}Neighborhood; 55}Neighborhood;
56 56
57typedef short int Pixel; /* short int;*/ 57typedef char Pixel; /* short int;*/
58 58
59 59
60void drawLineSegment(Pixel *image, 60void drawLineSegment(Pixel *image,
diff --git a/dis/original/Pointer/pointer.c b/dis/original/Pointer/pointer.c
index 0c4966f..a0aa62e 100644
--- a/dis/original/Pointer/pointer.c
+++ b/dis/original/Pointer/pointer.c
@@ -17,6 +17,7 @@
17#include <assert.h> 17#include <assert.h>
18#include <stdlib.h> 18#include <stdlib.h>
19#include "DISstressmarkRNG.h" 19#include "DISstressmarkRNG.h"
20#include "extra.h"
20 21
21#define MIN_FIELD_SIZE 16 22#define MIN_FIELD_SIZE 16
22#define MAX_FIELD_SIZE 16777216 23#define MAX_FIELD_SIZE 16777216
@@ -34,7 +35,7 @@
34/* 35/*
35 * main() 36 * main()
36 */ 37 */
37int main(){ 38int main(int argc, char** argv){
38 39
39 unsigned int *field; 40 unsigned int *field;
40 unsigned int f; 41 unsigned int f;
@@ -53,6 +54,7 @@ int main(){
53 }*thread; 54 }*thread;
54 55
55 unsigned int l; 56 unsigned int l;
57 SET_UP
56 58
57 fscanf(stdin, "%lu %u %lu %ld %u", 59 fscanf(stdin, "%lu %u %lu %ld %u",
58 &f, &l, &maxhops, &seed, &n); 60 &f, &l, &maxhops, &seed, &n);
@@ -84,12 +86,12 @@ int main(){
84 for (l=0; l<f; l++){ 86 for (l=0; l<f; l++){
85 field[l] = randInt(0, f-w); 87 field[l] = randInt(0, f-w);
86} 88}
87
88startTime = time(NULL); 89startTime = time(NULL);
89clock(); 90clock();
90 91
91for (l=0; l<n; l++) 92for (l=0; l<n; l++)
92{ 93{
94 START_LOOP
93 unsigned int index; 95 unsigned int index;
94 unsigned int minStop, maxStop; 96 unsigned int minStop, maxStop;
95 unsigned int hops; 97 unsigned int hops;
@@ -140,6 +142,7 @@ for (l=0; l<n; l++)
140 hops++; 142 hops++;
141 }/* end loop ll */ 143 }/* end loop ll */
142 thread[l].hops = hops; 144 thread[l].hops = hops;
145 STOP_LOOP
143} /* end while */ 146} /* end while */
144 147
145 startTime = time(NULL) - startTime; 148 startTime = time(NULL) - startTime;
@@ -151,5 +154,6 @@ for (l=0; l<n; l++)
151 fprintf(stderr, "total time = %u seconds.\n", (unsigned int)startTime); 154 fprintf(stderr, "total time = %u seconds.\n", (unsigned int)startTime);
152 free (field); 155 free (field);
153 free (thread); 156 free (thread);
157 WRITE_TO_FILE
154 158
155} 159}
diff --git a/dis/original/Transitive/transitive.c b/dis/original/Transitive/transitive.c
index 854d57c..ca16a31 100644
--- a/dis/original/Transitive/transitive.c
+++ b/dis/original/Transitive/transitive.c
@@ -18,6 +18,7 @@
18#include <assert.h> 18#include <assert.h>
19#include <stdlib.h> 19#include <stdlib.h>
20#include "DISstressmarkRNG.h" 20#include "DISstressmarkRNG.h"
21#include "extra.h"
21 22
22#define MIN_VERTICES 8 23#define MIN_VERTICES 8
23#define MAX_VERTICES 16384 24#define MAX_VERTICES 16384
@@ -34,7 +35,7 @@
34 * main() 35 * main()
35 */ 36 */
36 37
37int main(){ 38int main(int argc, char** argv){
38 unsigned int *din, *dout; 39 unsigned int *din, *dout;
39 unsigned int n; 40 unsigned int n;
40 unsigned int m; 41 unsigned int m;
@@ -68,12 +69,14 @@ int main(){
68 *(din + j*n + i) = randInt(MIN_EDGES, MAX_EDGES); 69 *(din + j*n + i) = randInt(MIN_EDGES, MAX_EDGES);
69 } 70 }
70 71
72 SET_UP
71 startTime = time(NULL); 73 startTime = time(NULL);
72 74
73 for (k=0; k<n; k++){ 75 for (k=0; k<n; k++){
74 unsigned int old; 76 unsigned int old;
75 unsigned int new1; 77 unsigned int new1;
76 unsigned int *dtemp; 78 unsigned int *dtemp;
79 START_LOOP
77 80
78 for (i=0; i<n; i++){ 81 for (i=0; i<n; i++){
79 for (j=0; j<n; j++){ 82 for (j=0; j<n; j++){
@@ -87,6 +90,7 @@ int main(){
87 dtemp = dout; 90 dtemp = dout;
88 dout = din; 91 dout = din;
89 din = dtemp; 92 din = dtemp;
93 STOP_LOOP
90 } 94 }
91 95
92 startTime = time(NULL) - startTime; 96 startTime = time(NULL) - startTime;
@@ -112,6 +116,7 @@ int main(){
112 fprintf(stdout, " total time = %u seconds. \n", (unsigned int)startTime); 116 fprintf(stdout, " total time = %u seconds. \n", (unsigned int)startTime);
113 free(din); 117 free(din);
114 free(dout); 118 free(dout);
119 WRITE_TO_FILE
115 return(0); 120 return(0);
116 } 121 }
117 122
diff --git a/dis/original/Update/update.c b/dis/original/Update/update.c
index 51e1530..92384cd 100644
--- a/dis/original/Update/update.c
+++ b/dis/original/Update/update.c
@@ -18,6 +18,7 @@
18#include <time.h> 18#include <time.h>
19#include<assert.h> 19#include<assert.h>
20#include "DISstressmarkRNG.h" 20#include "DISstressmarkRNG.h"
21#include "extra.h"
21 22
22#define MIN_FIELD_SIZE 16 23#define MIN_FIELD_SIZE 16
23 24
@@ -39,7 +40,7 @@
39 *main() 40 *main()
40 */ 41 */
41 42
42int main(){ 43int main(int argc, char** argv){
43 44
44 unsigned int *field; 45 unsigned int *field;
45 unsigned int f; 46 unsigned int f;
@@ -76,6 +77,7 @@ int main(){
76 field[l] = randInt(0, f-w); 77 field[l] = randInt(0, f-w);
77 } 78 }
78 79
80 SET_UP
79 startTime = time(NULL); 81 startTime = time(NULL);
80 82
81 hops = 0; 83 hops = 0;
@@ -90,6 +92,7 @@ int main(){
90 unsigned int max, min; 92 unsigned int max, min;
91 unsigned int partition; 93 unsigned int partition;
92 unsigned int high; 94 unsigned int high;
95 START_LOOP
93 max = MAX_FIELD_SIZE; 96 max = MAX_FIELD_SIZE;
94 min = 0; 97 min = 0;
95 high = 0; 98 high = 0;
@@ -122,6 +125,7 @@ int main(){
122 field[index] = sum % (f-w); 125 field[index] = sum % (f-w);
123 index = (partition+hops)%(f-w); 126 index = (partition+hops)%(f-w);
124 hops++; 127 hops++;
128 STOP_LOOP
125 }/* end for loop */ 129 }/* end for loop */
126 130
127 startTime = time(NULL) - startTime; 131 startTime = time(NULL) - startTime;
@@ -129,5 +133,6 @@ int main(){
129 fprintf(stdout, "%u hops\n", hops); 133 fprintf(stdout, "%u hops\n", hops);
130 fprintf(stderr, "total time = %u seconds.\n", (unsigned int)startTime); 134 fprintf(stderr, "total time = %u seconds.\n", (unsigned int)startTime);
131 free(field); 135 free(field);
136 WRITE_TO_FILE
132 return(1); 137 return(1);
133} 138}
diff --git a/dis/original/runDIS1.sh b/dis/original/runDIS1.sh
new file mode 100755
index 0000000..88d2989
--- /dev/null
+++ b/dis/original/runDIS1.sh
@@ -0,0 +1,2 @@
1#!/bin/bash
2cat inputs/Field/in1 | ./field field 80 3 May20-fieldtest 1
diff --git a/dis/original/runDIS2.sh b/dis/original/runDIS2.sh
new file mode 100755
index 0000000..9471319
--- /dev/null
+++ b/dis/original/runDIS2.sh
@@ -0,0 +1,2 @@
1#!/bin/bash
2cat inputs/Matrix/in0 | ./matrix matrix 1000 3 Nov27-matrixtest 1
diff --git a/dis/original/runDIS4.sh b/dis/original/runDIS4.sh
new file mode 100755
index 0000000..58072a5
--- /dev/null
+++ b/dis/original/runDIS4.sh
@@ -0,0 +1,5 @@
1#!/bin/bash
2cat inputs/Neighborhood/in0 | ./neighborhood neighborhood 1 3 Oct19-neighborhoodtest 1
3cat inputs/Pointer/in0 | ./pointer pointer 10 3 Oct19-pointertest 1
4cat inputs/Transitive/in1 | ./transitive transitive 800 3 Oct19-transitivetest 1
5cat inputs/Update/in0 | ./update update 1000 3 Oct19-updatetest 1
diff --git a/dis/original/summarize.py b/dis/original/summarize.py
new file mode 100755
index 0000000..f8f6929
--- /dev/null
+++ b/dis/original/summarize.py
@@ -0,0 +1,71 @@
1#!/usr/bin/python3
2import sys
3
4f = sys.argv[1]
5res = {}
6mem_res = {}
7memw_res = {}
8samples = {}
9max_res = {}
10
11with open(f) as fp:
12 for line in fp:
13 s = line.split()
14 if s[0] not in res:
15# print(s[0])
16 res[s[0]] = list([int(s[5])])#)int(s[5])
17 mem_res[s[0]] = int(s[8])
18 memw_res[s[0]] = int(s[9])
19 samples[s[0]] = int(s[4])
20 max_res[s[0]] = int(s[5])
21 else:
22 res[s[0]].append(int(s[5]))
23 mem_res[s[0]] += int(s[8])
24 memw_res[s[0]] += int(s[9])
25 max_res[s[0]] = max(int(s[5]), max_res[s[0]])
26## {{{ http://code.activestate.com/recipes/511478/ (r1)
27import math
28import functools
29
30def percentile(N, percent, key=lambda x:x):
31 """
32 Find the percentile of a list of values.
33
34 @parameter N - is a list of values. Note N MUST BE already sorted.
35 @parameter percent - a float value from 0.0 to 1.0.
36 @parameter key - optional key function to compute value from each element of N.
37
38 @return - the percentile of the values
39 """
40 if not N:
41 return None
42 k = (len(N)-1) * percent
43 f = math.floor(k)
44 c = math.ceil(k)
45 if f == c:
46 return key(N[int(k)])
47 d0 = key(N[int(f)]) * (c-k)
48 d1 = key(N[int(c)]) * (k-f)
49 return d0+d1
50## end of http://code.activestate.com/recipes/511478/ }}}
51"""
52print("Average times:")
53for r in res.keys():
54 print(res[r]/samples[r])
55
56print("Average memory read:")
57for r in mem_res.keys():
58 print(mem_res[r]/samples[r])
59
60print("Average memory write:")
61for r in memw_res.keys():
62 print(memw_res[r]/samples[r])
63
64print("Max times:")
65for r in max_res.keys():
66 print(max_res[r])
67"""
68print("Name\t\tAverage\t\tMax\t\t99th %\t\tAvg Mem Read\tAvg Mem Write\t")
69for r in res.keys():
70# print(r + "\t\t" + str(res[r]/samples[r]) + "\t\t" + str(max_res[r]))
71 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]))