summaryrefslogtreecommitdiffstats
path: root/dis/original
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2020-06-11 21:32:55 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-06-11 21:32:55 -0400
commita100a322fe414021a1e5878b910a84e9df37df61 (patch)
treefe6f9e51c1c90683ba53838838f496b45a7a3422 /dis/original
parent3d7bc39109895130d7de703893dd5aa7448b01cd (diff)
Add inital testing infrastructure
Works for three-way WSS/cache size/execution time comparisons
Diffstat (limited to 'dis/original')
-rw-r--r--dis/original/WSS_DOCS.md83
-rwxr-xr-xdis/original/clean.sh1
-rwxr-xr-xdis/original/gen_input.py113
-rw-r--r--dis/original/inputs/WSSS12
-rw-r--r--dis/original/inputs/WSSS_maxstride4mb16
-rw-r--r--dis/original/inputs/caches7
-rw-r--r--dis/original/inputs/caches_maxstride2ways11
-rwxr-xr-xdis/original/postproc.sh3
-rwxr-xr-xdis/original/run_dis.sh81
-rwxr-xr-xdis/original/setup_mem_and_global.sh13
10 files changed, 340 insertions, 0 deletions
diff --git a/dis/original/WSS_DOCS.md b/dis/original/WSS_DOCS.md
new file mode 100644
index 0000000..da5e066
--- /dev/null
+++ b/dis/original/WSS_DOCS.md
@@ -0,0 +1,83 @@
1# Documentation Mapping DIS Stressmark Parameters to WSS
2
3## Field
41 allocation in main()
5f = 1st input param
6
7sizeof(unsigned char) * f
8
9## Matrix
106 allocations in main(), 7 allocations in biConjugateGradient()
11
12*Allocations in main()*
13dim = 2nd input param
14numberNonzero = 3nd input param
15
16sizeof(double) * (dim^2+3dim+numberNonzero) + sizeof(int) * (2dim+1+numberNonzero)
17
18*Allocations in biConjugateGradient()*
19sizeof(double) * 7dim
20
21## Neighborhood
221 allocation in createImage, 2 allocations in neighborhoodCalculation
23
24*Allocations in createImage()*
25dimension = 3rd input param
26
27sizeof(short int) * dimension^2
28
29*Allocations in neighborhoodCalculation()*
30bitDepth = 2nd param
31
32sizeof(int) * (2^(bitDepth + 1) - 1)
33
34## Pointer
35n = 5th input param
36f = 1st input param
37
38sizeof(unsigned int) * 4n + sizeof(int) * f
39
40## Transitive
41n = 1st input param
42
43sizeof(unsigned int) * 2n^2
44
45## Update
46f = 1st input param
47
48sizeof(int) * f
49
50## Testplan
51*Problem!* Larger WSS = more computations
52Use testcase #1 for non-specified parameters
53Below math computed for x86_64
54- Test WSS at powers of 2: 16 KiB, 32, 64, 128, 256, 512, 1MiB, 2, 4, 8, 16, 32
55- For each WSS, measure cache allocation of 0, 1, 2, 4, 8, 16
56
57### Field
58Just vary first param
59
60f = WSS
61
62### Matrix
630.3 - 16% number nonzero
64- Fixed at 8%
65Just vary dim (matrix size)
66
67sizeof(double) * (dim^2+10dim+numberNonzero) + sizeof(int) * (2dim+1+numberNonzero) = WSS
68
69
70### Neighborhood
718 or 15 bit depth
72- Fix at 12?
73Just vary dim (image size)
74
75### Pointer
7610 for n
77Just vary f
78
79### Transitive
80Just vary n
81
82### Update
83Just vary f
diff --git a/dis/original/clean.sh b/dis/original/clean.sh
new file mode 100755
index 0000000..7c58295
--- /dev/null
+++ b/dis/original/clean.sh
@@ -0,0 +1 @@
tail -n +2 $1 | tr "-" " " | sed "s/L3:0=0000;1=0000;2=0000;3=0000/0/" | sed "s/L3:0=0000;1=0000;2=0000;3=0001/1/" | sed "s/L3:0=0000;1=0000;2=0000;3=0003/2/" | sed "s/L3:0=0000;1=0000;2=0000;3=0007/3/" | sed "s/L3:0=0000;1=0000;2=0000;3=000f/4/" | sed "s/L3:0=0000;1=0000;2=0000;3=003f/6/" | sed "s/L3:0=0000;1=0000;2=0000;3=00ff/8/" | sed "s/L3:0=0000;1=0000;2=0000;3=03ff/10/" | sed "s/L3:0=0000;1=0000;2=0000;3=0fff/12/" | sed "s/L3:0=0000;1=0000;2=0000;3=3fff/14/" | sed "s/L3:0=0000;1=0000;2=0000;3=ffff/16/" > $1.clean
diff --git a/dis/original/gen_input.py b/dis/original/gen_input.py
new file mode 100755
index 0000000..c7821b0
--- /dev/null
+++ b/dis/original/gen_input.py
@@ -0,0 +1,113 @@
1#!/usr/bin/python3
2#####
3# Copyright 2020 Joshua Bakita
4#
5# This program generates input data for the DIS benchmark suite on stdout
6# given a requested working set size.
7#####
8
9
10from ctypes import sizeof, c_double, c_int, c_short
11from math import sqrt, floor
12import sys # For argv and stderr
13
14USAGE = """Usage: {} <benchmark> <template> <WSS in bytes>"""
15
16# Check input
17if (len(sys.argv) < 4):
18 print(USAGE.format(sys.argv[0]), file=sys.stderr)
19 exit(1);
20
21# Don't try to understand the logic in these functions, see WSS_DOCS.md
22def setup_field(params, wss):
23 params[0] = wss
24 return params
25
26def setup_matrix(params, wss):
27 nnZR = 0.08 # 8% seems average
28 # This formula is out of a solver
29 si = sizeof(c_int)
30 sd = sizeof(c_double)
31 d = (sqrt((si**2) * (-(nnZR-1)) - si*sd*(nnZR-9) + si*wss*nnZR + sd*(25*sd+wss*nnZR+wss)) - si - 5*sd) / (si*nnZR + sd*nnZR + sd)
32 params[1] = floor(d);
33 params[2] = floor(d*d*nnZR);
34 if params[1] <= 0 or params[2] <= 0:
35 raise Exception("WSS too small for matrix benchmark!")
36 return params
37
38def setup_neighborhood(params, wss):
39 bitDepth = 8
40 bitDepthAlloc = sizeof(c_int) * (2**(bitDepth + 1) - 1)
41 dim = sqrt((wss - bitDepthAlloc) / sizeof(c_short))
42 params[1] = bitDepth
43 params[2] = floor(dim)
44 if params[1] <= 0 or params[2] <= 0:
45 raise Exception("WSS too small for neighborhood benchmark!")
46 # Cap maximum line thinkness to the image size
47 params[5] = min(params[2]-1, int(params[5]))
48 # Cap line lengths to the image size
49 params[6] = min(params[2]-1, int(params[6]))
50 params[7] = min(params[2]-1, int(params[7]))
51 return params
52
53def setup_pointer(params, wss):
54 n = 10;
55 f = (wss - sizeof(c_int) * 4 * n) / sizeof(c_int)
56 params[0] = floor(f)
57 params[4] = floor(n)
58 if params[0] <= 0 or params[4] <= 0:
59 raise Exception("WSS too small for pointer benchmark!")
60 return params
61
62def setup_transitive(params, wss):
63 n = sqrt(wss / (sizeof(c_int) * 2))
64 params[0] = floor(n)
65 # Fix edges at 50%
66 params[1] = floor(params[0] * 0.5)
67 if params[0] <= 0:
68 raise Exception("WSS too small for transitive benchmark!")
69 return params
70
71def setup_update(params, wss):
72 f = wss / sizeof(c_int)
73 params[0] = floor(f)
74 if params[0] <= 0:
75 raise Exception("WSS too small for update benchmark!")
76 # Don't do more than 100M hops (keeps time array feasible)
77 params[2] = min(100000000, int(params[2]))
78 # Enforce size requirements
79 params[4] = min(params[0]-1, int(params[4]))
80 params[5] = min(params[0]-1, int(params[5]))
81 params[6] = min(params[0]-1, int(params[6]))
82 return params
83
84def setup_random_walk(params, wss):
85 params[0] = wss
86 return params
87
88BENCH_TO_PARAMS = {"field":setup_field, "matrix":setup_matrix, "neighborhood":setup_neighborhood, "pointer":setup_pointer, "transitive":setup_transitive, "update":setup_update, "random_walk":setup_random_walk}
89
90# Main logic
91benchmark_name = sys.argv[1]
92if benchmark_name not in BENCH_TO_PARAMS.keys():
93 print("Invalid benchmark name.", file=sys.stderr)
94 exit(2)
95
96wss = int(sys.argv[3])
97if wss <= 0:
98 print("Invalid working set size", file=sys.stderr)
99 exit(3)
100
101with open(sys.argv[2], "r") as template:
102 # We expect the initialization params to all be on the first line
103 params = template.readline().split()
104 mutated_params = BENCH_TO_PARAMS[benchmark_name](params, wss);
105