-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_wrapper.py
150 lines (144 loc) · 4.59 KB
/
run_wrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import os
import sys
import argparse
import run_test_set
"""
A wrapper script to run all tests for a particular test set.
"""
DEFAULT_NUM_SEEDS = 100
DEFAULT_MP_POOL_SIZE = 128
TESTU01_OUTPUTS = ["std32", "rev32", "std32lo", "rev32lo", "std32hi", "rev32hi"]
def main():
parser = argparse.ArgumentParser(description="Run all test sets against a PRNG")
parser.add_argument("generator", help="Specify the generator binary")
parser.add_argument(
"--numseeds",
type=int,
default=DEFAULT_NUM_SEEDS,
help="The number of seeds to test",
)
parser.add_argument("--dryrun", action="store_true", help="Don't run anything")
parser.add_argument(
"--mppoolsize",
type=int,
default=DEFAULT_MP_POOL_SIZE,
help="The size of the multiprocessing pool",
)
parser.add_argument("--smallcrush", action="store_true", help="Run SmallCrush")
parser.add_argument("--crush", action="store_true", help="Run Crush")
parser.add_argument("--bigcrush", action="store_true", help="Run BigCrush")
parser.add_argument("--alphabit", action="store_true", help="Run Alphabit")
parser.add_argument("--practrand", action="store_true", help="Run Practrand")
parser.add_argument("--gjrand", action="store_true", help="Run Gjrand")
parser.add_argument(
"--matrixrank_bits", action="store_true", help="Run MatrixRank test on each bit"
)
parser.add_argument(
"--linearcomp_bits", action="store_true", help="Run LinearComp test on each bit"
)
args = parser.parse_args()
generator_name = os.path.basename(args.generator)
# SmallCrush
if args.smallcrush:
for output in TESTU01_OUTPUTS:
run_test_set.run_all_seeds(
args.generator,
"smallcrush",
output,
args.numseeds,
0,
f"TEST_{generator_name}_smallcrush_{output}_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
# Crush
if args.crush:
for output in TESTU01_OUTPUTS:
run_test_set.run_all_seeds(
args.generator,
"crush",
output,
args.numseeds,
0,
f"TEST_{generator_name}_crush_{output}_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
# BigCrush
if args.bigcrush:
for output in TESTU01_OUTPUTS:
run_test_set.run_all_seeds(
args.generator,
"bigcrush",
output,
args.numseeds,
0,
f"TEST_{generator_name}_bigcrush_{output}_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
# Alphabit
if args.alphabit:
run_test_set.run_all_seeds(
args.generator,
"alphabit",
"std32",
args.numseeds,
0,
f"TEST_{generator_name}_alphabit_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
# PractRand
if args.practrand:
run_test_set.run_all_seeds(
args.generator,
"practrand",
"std64",
args.numseeds,
0,
f"TEST_{generator_name}_practrand_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
# Gjrand
if args.gjrand:
run_test_set.run_all_seeds(
args.generator,
"gjrand",
"std64",
args.numseeds,
0,
f"TEST_{generator_name}_gjrand_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
# MatrixRank individual bits
if args.matrixrank_bits:
for index in range(64):
run_test_set.run_all_seeds(
args.generator,
"matrixrank",
"std32",
args.numseeds,
index,
f"TEST_{generator_name}_maxtrixrank_bit{index}_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
# LinearComp individual bits
if args.linearcomp_bits:
for index in range(64):
run_test_set.run_all_seeds(
args.generator,
"linearcomp",
"std32",
args.numseeds,
index,
f"TEST_{generator_name}_linearcomp_bit{index}_{args.numseeds}",
args.dryrun,
args.mppoolsize,
)
return 0
if __name__ == "__main__":
sys.exit(main())