diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-06-11 21:32:55 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-06-11 21:32:55 -0400 |
| commit | a100a322fe414021a1e5878b910a84e9df37df61 (patch) | |
| tree | fe6f9e51c1c90683ba53838838f496b45a7a3422 /dis/original | |
| parent | 3d7bc39109895130d7de703893dd5aa7448b01cd (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.md | 83 | ||||
| -rwxr-xr-x | dis/original/clean.sh | 1 | ||||
| -rwxr-xr-x | dis/original/gen_input.py | 113 | ||||
| -rw-r--r-- | dis/original/inputs/WSSS | 12 | ||||
| -rw-r--r-- | dis/original/inputs/WSSS_maxstride4mb | 16 | ||||
| -rw-r--r-- | dis/original/inputs/caches | 7 | ||||
| -rw-r--r-- | dis/original/inputs/caches_maxstride2ways | 11 | ||||
| -rwxr-xr-x | dis/original/postproc.sh | 3 | ||||
| -rwxr-xr-x | dis/original/run_dis.sh | 81 | ||||
| -rwxr-xr-x | dis/original/setup_mem_and_global.sh | 13 |
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 | ||
| 4 | 1 allocation in main() | ||
| 5 | f = 1st input param | ||
| 6 | |||
| 7 | sizeof(unsigned char) * f | ||
| 8 | |||
| 9 | ## Matrix | ||
| 10 | 6 allocations in main(), 7 allocations in biConjugateGradient() | ||
| 11 | |||
| 12 | *Allocations in main()* | ||
| 13 | dim = 2nd input param | ||
| 14 | numberNonzero = 3nd input param | ||
| 15 | |||
| 16 | sizeof(double) * (dim^2+3dim+numberNonzero) + sizeof(int) * (2dim+1+numberNonzero) | ||
| 17 | |||
| 18 | *Allocations in biConjugateGradient()* | ||
| 19 | sizeof(double) * 7dim | ||
| 20 | |||
| 21 | ## Neighborhood | ||
| 22 | 1 allocation in createImage, 2 allocations in neighborhoodCalculation | ||
| 23 | |||
| 24 | *Allocations in createImage()* | ||
| 25 | dimension = 3rd input param | ||
| 26 | |||
| 27 | sizeof(short int) * dimension^2 | ||
| 28 | |||
| 29 | *Allocations in neighborhoodCalculation()* | ||
| 30 | bitDepth = 2nd param | ||
| 31 | |||
| 32 | sizeof(int) * (2^(bitDepth + 1) - 1) | ||
| 33 | |||
| 34 | ## Pointer | ||
| 35 | n = 5th input param | ||
| 36 | f = 1st input param | ||
| 37 | |||
| 38 | sizeof(unsigned int) * 4n + sizeof(int) * f | ||
| 39 | |||
| 40 | ## Transitive | ||
| 41 | n = 1st input param | ||
| 42 | |||
| 43 | sizeof(unsigned int) * 2n^2 | ||
| 44 | |||
| 45 | ## Update | ||
| 46 | f = 1st input param | ||
| 47 | |||
| 48 | sizeof(int) * f | ||
| 49 | |||
| 50 | ## Testplan | ||
| 51 | *Problem!* Larger WSS = more computations | ||
| 52 | Use testcase #1 for non-specified parameters | ||
| 53 | Below 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 | ||
| 58 | Just vary first param | ||
| 59 | |||
| 60 | f = WSS | ||
| 61 | |||
| 62 | ### Matrix | ||
| 63 | 0.3 - 16% number nonzero | ||
| 64 | - Fixed at 8% | ||
| 65 | Just vary dim (matrix size) | ||
| 66 | |||
| 67 | sizeof(double) * (dim^2+10dim+numberNonzero) + sizeof(int) * (2dim+1+numberNonzero) = WSS | ||
| 68 | |||
| 69 | |||
| 70 | ### Neighborhood | ||
| 71 | 8 or 15 bit depth | ||
| 72 | - Fix at 12? | ||
| 73 | Just vary dim (image size) | ||
| 74 | |||
| 75 | ### Pointer | ||
| 76 | 10 for n | ||
| 77 | Just vary f | ||
| 78 | |||
| 79 | ### Transitive | ||
| 80 | Just vary n | ||
| 81 | |||
| 82 | ### Update | ||
| 83 | Just 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 | |||
| 10 | from ctypes import sizeof, c_double, c_int, c_short | ||
| 11 | from math import sqrt, floor | ||
| 12 | import sys # For argv and stderr | ||
| 13 | |||
| 14 | USAGE = """Usage: {} <benchmark> <template> <WSS in bytes>""" | ||
| 15 | |||
| 16 | # Check input | ||
| 17 | if (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 | ||
| 22 | def setup_field(params, wss): | ||
| 23 | params[0] = wss | ||
| 24 | return params | ||
| 25 | |||
| 26 | def 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 | |||
| 38 | def 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 | |||
| 53 | def 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 | |||
| 62 | def 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 | |||
| 71 | def 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 | |||
| 84 | def setup_random_walk(params, wss): | ||
| 85 | params[0] = wss | ||
| 86 | return params | ||
| 87 | |||
| 88 | BENCH_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 | ||
| 91 | benchmark_name = sys.argv[1] | ||
| 92 | if benchmark_name not in BENCH_TO_PARAMS.keys(): | ||
| 93 | print("Invalid benchmark name.", file=sys.stderr) | ||
| 94 | exit(2) | ||
| 95 | |||
| 96 | wss = int(sys.argv[3]) | ||
| 97 | if wss <= 0: | ||
| 98 | print("Invalid working set size", file=sys.stderr) | ||
| 99 | exit(3) | ||
| 100 | |||
| 101 | with 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 | |||
