-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbench.py
executable file
·37 lines (31 loc) · 1.4 KB
/
bench.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
#!/usr/bin/python
# ------------------------------------------------------------------
# BSOF/I - Block structured factorization and inversion codes
# for CPU+GPU platforms
# Copyright (c) 2013, Sergiy Gogolenko
# e-mail: [email protected]
# ------------------------------------------------------------------
# Description:
# Benchmarking script.
# ------------------------------------------------------------------
import os
L = 4
n_list = (1024, 512, 256)
nthreads = 12
implementations = ('hybrid', 'cpu')
ofolder = r"./results"
cmd_all = r"./{implement}/bench -t {ntests} -n {blksize} -L {blknum} > "\
"{ofolder}/mkl_{blksize:04d}_{nthreads:02d}.blk"
if not os.path.exists(ofolder): os.mkdir(ofolder)
for implementation in implementations:
ofolder_local = os.path.join(ofolder, implementation)
if not os.path.exists(ofolder_local): os.mkdir(ofolder_local)
# for nthreads in (12,): # 6, 4, 2)
# os.environ['OMP_NUM_THREADS'] = str(nthreads)
# os.environ['MKL_NUM_THREADS'] = str(nthreads)
for n in n_list:
ntests = 44*(1024/n) - 3
print cmd_all.format(implement = implementation, ofolder = ofolder_local,
nthreads=nthreads, ntests=ntests, blknum=L, blksize=n)
os.system(cmd_all.format(implement = implementation, ofolder = ofolder_local,
nthreads=nthreads, ntests=ntests, blknum=L, blksize=n))