diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2020-05-29 12:44:28 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2020-05-29 12:44:28 -0400 |
| commit | 8dfefc152f16f9fd9e8aa0910fd4d23d6543d87e (patch) | |
| tree | 4e5c596dadf1df4fb77c9a10b3e483939c6aa018 | |
| parent | 43ce989b5077913f18a5b083501498f5e1a6d349 (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.c | 8 | ||||
| -rw-r--r-- | dis/original/Neighborhood/neighborhood.c | 9 | ||||
| -rw-r--r-- | dis/original/Neighborhood/utili.h | 2 | ||||
| -rw-r--r-- | dis/original/Pointer/pointer.c | 8 | ||||
| -rw-r--r-- | dis/original/Transitive/transitive.c | 7 | ||||
| -rw-r--r-- | dis/original/Update/update.c | 7 | ||||
| -rwxr-xr-x | dis/original/runDIS1.sh | 2 | ||||
| -rwxr-xr-x | dis/original/runDIS2.sh | 2 | ||||
| -rwxr-xr-x | dis/original/runDIS4.sh | 5 | ||||
| -rwxr-xr-x | dis/original/summarize.py | 71 |
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 | ||
| 41 | int main(){ | 42 | int 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 | */ |
| 26 | int main() | 27 | int 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 | ||
| 57 | typedef short int Pixel; /* short int;*/ | 57 | typedef char Pixel; /* short int;*/ |
| 58 | 58 | ||
| 59 | 59 | ||
| 60 | void drawLineSegment(Pixel *image, | 60 | void 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 | */ |
| 37 | int main(){ | 38 | int 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 | |||
| 88 | startTime = time(NULL); | 89 | startTime = time(NULL); |
| 89 | clock(); | 90 | clock(); |
| 90 | 91 | ||
| 91 | for (l=0; l<n; l++) | 92 | for (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 | ||
| 37 | int main(){ | 38 | int 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 | ||
| 42 | int main(){ | 43 | int 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 | ||
| 2 | cat 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 | ||
| 2 | cat 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 | ||
| 2 | cat inputs/Neighborhood/in0 | ./neighborhood neighborhood 1 3 Oct19-neighborhoodtest 1 | ||
| 3 | cat inputs/Pointer/in0 | ./pointer pointer 10 3 Oct19-pointertest 1 | ||
| 4 | cat inputs/Transitive/in1 | ./transitive transitive 800 3 Oct19-transitivetest 1 | ||
| 5 | cat 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 | ||
| 2 | import sys | ||
| 3 | |||
| 4 | f = sys.argv[1] | ||
| 5 | res = {} | ||
| 6 | mem_res = {} | ||
| 7 | memw_res = {} | ||
| 8 | samples = {} | ||
| 9 | max_res = {} | ||
| 10 | |||
| 11 | with 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) | ||
| 27 | import math | ||
| 28 | import functools | ||
| 29 | |||
| 30 | def 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 | """ | ||
| 52 | print("Average times:") | ||
| 53 | for r in res.keys(): | ||
| 54 | print(res[r]/samples[r]) | ||
| 55 | |||
| 56 | print("Average memory read:") | ||
| 57 | for r in mem_res.keys(): | ||
| 58 | print(mem_res[r]/samples[r]) | ||
| 59 | |||
| 60 | print("Average memory write:") | ||
| 61 | for r in memw_res.keys(): | ||
| 62 | print(memw_res[r]/samples[r]) | ||
| 63 | |||
| 64 | print("Max times:") | ||
| 65 | for r in max_res.keys(): | ||
| 66 | print(max_res[r]) | ||
| 67 | """ | ||
| 68 | print("Name\t\tAverage\t\tMax\t\t99th %\t\tAvg Mem Read\tAvg Mem Write\t") | ||
| 69 | for 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])) | ||
