-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcalib_scalability_tests_plotting.py
More file actions
executable file
·128 lines (123 loc) · 3.51 KB
/
Copy pathcalib_scalability_tests_plotting.py
File metadata and controls
executable file
·128 lines (123 loc) · 3.51 KB
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
#!/usr/bin/env python3
import sys
import numpy as np
from dateutil import parser
from plotly.offline import plot
import plotly.graph_objs as go
key_to_symbol = {
(100000 , 'wall_time'): 'circle',
(100000 , 'mem') : 'circle-open',
(1000000, 'wall_time'): 'square',
(1000000, 'mem') : 'square-open',
(2000000, 'wall_time'): 'diamond',
(2000000, 'mem') : 'diamond-open',
}
data = list()
mems = list()
wall_times = list()
output_html = sys.argv[1]
for tsv_path in sys.argv[2:]:
num_molecules = int(tsv_path.split('molNum')[1].split('/')[0].split('.')[0])
tsv_lines = open(tsv_path).readlines()
field_to_idx = dict()
for idx, field in enumerate(tsv_lines[0].rstrip().split('\t')):
field_to_idx[field] = idx
thread_count_to_performance = dict()
for line in tsv_lines[1:]:
line = line.rstrip().split('\t')
c = int(line[field_to_idx['log_comment']].split('_')[-1])
mem = float(line[field_to_idx['mem']])/1024/1024
mem = round(mem, 2)
wall_time = line[field_to_idx['wall_time']].split(':')
wall_time = list(reversed(wall_time))
secs = 0
for idx, t in enumerate(wall_time):
secs += float(t)*(60**idx)
mins = secs/60
print(wall_time, mins)
thread_count_to_performance[c] = dict(
wall_time=mins,
mem=mem,
)
mems.append(mem)
wall_times.append(mins)
x_list = list()
y1_list = list()
y2_list = list()
for c in sorted(thread_count_to_performance.keys()):
x_list.append(c)
y1_list.append(thread_count_to_performance[c]['wall_time'])
y2_list.append(thread_count_to_performance[c]['mem'])
trace = go.Scatter(
name='Time for molNum = {}'.format(num_molecules),
x=x_list,
y=y1_list,
mode='markers+lines',
marker=dict(
symbol=key_to_symbol[(num_molecules,'wall_time')],
size=10,
),
line=dict(
color='black',
dash='solid',
)
)
data.append(trace)
trace = go.Scatter(
name='RAM for molNum = {}'.format(num_molecules),
x=x_list,
y=y2_list,
yaxis='y2',
mode='markers+lines',
marker=dict(
symbol=key_to_symbol[(num_molecules,'mem')],
size=10,
),
line=dict(
color='black',
dash='longdash',
)
)
print(key_to_symbol[(num_molecules,'mem')],)
data.append(trace)
mems.sort()
mems = mems[2:]
wall_times.sort()
wall_times = wall_times[2:]
layout = go.Layout(
legend=dict(
x=0.85,
y=0.80,
borderwidth=2,
),
hovermode='closest',
font=dict(
family='Times New Roman',
),
xaxis=dict(
title='Number of threads',
rangemode='nonnegative',
type='linear',
),
yaxis=dict(
title='Wall clock time',
rangemode='nonnegative',
tickmode='array',
tickvals=wall_times,
ticktext=['{:4.2f} min'.format(min) for min in wall_times],
# tickangle=45,
),
yaxis2=dict(
title='RAM',
rangemode='nonnegative',
overlaying='y',
side='right',
anchor='y',
tickmode='array',
tickvals=mems,
ticktext=['{:4.2f} GB'.format(mem) for mem in mems],
# tickangle=45,
),
)
fig = go.Figure(data=data, layout=layout)
plot(fig, filename='{}.html'.format(output_html.rstrip('.html')), auto_open=False, image_height=900, image_width=1600)