-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.py
39 lines (36 loc) · 1.29 KB
/
table.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
import numpy as np
from prettytable import PrettyTable
def make_table(benchmark_results, nproc_range):
impl_col = []
nproc_col = []
avg_col = []
err_col = []
for impl in benchmark_results.keys():
if impl in ["serial", "map-serial"]:
impl_col.append(impl)
nproc_col.append("-")
avg_col.append(np.mean(benchmark_results[impl]))
err_col.append(
np.std(benchmark_results[impl]) / np.sqrt(len(benchmark_results[impl]))
)
else:
impl_col.extend([impl] * len(list(nproc_range)))
nproc_col.extend([nproc for nproc in nproc_range])
avg_col.extend(
[
np.mean(individual_times)
for individual_times in benchmark_results[impl]
]
)
err_col.extend(
[
np.std(individual_times) / np.sqrt(len(individual_times))
for individual_times in benchmark_results[impl]
]
)
table = PrettyTable()
table.add_column("Implementation", impl_col)
table.add_column("# processes", nproc_col)
table.add_column("Average time (s)", avg_col)
table.add_column("Standard error (s)", err_col)
return table