-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_benchmarks.py
44 lines (38 loc) · 1.4 KB
/
run_benchmarks.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
import os
import time
import statistics
import subprocess
from collections import OrderedDict
import pickle
def individual_test(trials, build, num_threads, t, c, k):
# Each plot will get its own output directory, determined by
# workload, not build type or number of threads
out_dir = f'benchmarks/{t}_{c}_{k}'
for n in num_threads:
build_out = f'{build}_{n}.txt'
# Clear the file for this build type
if os.path.exists(f'{out_dir}/{build_out}'):
os.remove(f'{out_dir}/{build_out}')
for _ in range(trials):
cmd = [f'./{build}', '-n', n, '-k', k, '-c', c, '-t', t, '-o', f'../{out_dir}/{build_out}']
print('running cmd', cmd)
subprocess.run(cmd, cwd='build')
def test_barrage():
trials = 5
# The N x N x ... tests
builds = ['gcc_bench']
num_threads = ['1', '2', '4', '8', '16', '20', '32']
types = ['rb', 'hash']
configs = ['read', 'mixed']
key_range = ['small', 'large']
for t in types:
for c in configs:
for k in key_range:
out_dir = f'benchmarks/{t}_{c}_{k}'
if not os.path.exists(out_dir):
os.makedirs(out_dir)
# Each plot will get its own output directory
for build in builds:
individual_test(trials, build, num_threads, t, c, k)
if __name__ == '__main__':
test_barrage()