-
Notifications
You must be signed in to change notification settings - Fork 0
/
time_some_commands.py
51 lines (40 loc) · 1.31 KB
/
time_some_commands.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
from numpy import mean, std
from os import environ, system
from time import time
cmake_times = []
make_core_times = []
make_mesh_times = []
test_mesh_times = []
num_cores = '-j3'
num_runs = 1
for i in range(num_runs):
# Reset environment
environ['CC'] = ""
environ['CXX'] = ""
environ['PETSC_DIR'] = ""
environ['PETSC_ARCH'] = ""
# Reset build directory
system('rm CMakeCache.txt')
system('make clean')
# Time configuration
start = time()
system('cmake ..')
cmake_times.append(time() - start)
# Time building libraries
start = time()
system('make %s chaste_core' % num_cores)
make_core_times.append(time() - start)
# Time building tests
start = time()
system('make %s mesh' % num_cores)
make_mesh_times.append(time() - start)
# Time running tests
start = time()
system('ctest %s -L mesh -E Parallel' % num_cores)
test_mesh_times.append(time() - start)
with open('times.csv', 'w') as f:
f.write(',mean,std\n')
f.write('configure,%s,%s\n' % (mean(cmake_times), std(cmake_times)))
f.write('build_libs,%s,%s\n' % (mean(make_core_times), std(make_core_times)))
f.write('build_tests,%s,%s\n' % (mean(make_mesh_times), std(make_mesh_times)))
f.write('run_tests,%s,%s\n' % (mean(test_mesh_times), std(test_mesh_times)))