-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathplot_dss_timing_results.jl
More file actions
243 lines (236 loc) · 7.38 KB
/
Copy pathplot_dss_timing_results.jl
File metadata and controls
243 lines (236 loc) · 7.38 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
using Plots
using Plots.PlotMeasures
using JLD2
@assert length(ARGS) ≥ 1
case = get(ARGS, 1, "shallow_water")
if occursin("hybrid3dcubedsphere", case)
resolution = get(ARGS, 2, "low")
if occursin("low", resolution)
output_dir = joinpath(Base.@__DIR__, "hybrid", "dss_output_low_res")
output_file = "dss_scaling_low_res_3dcs"
else
output_dir = joinpath(Base.@__DIR__, "hybrid", "dss_output_high_res")
output_file = "dss_scaling_high_res_3dcs"
end
@show resolution
else
output_dir = joinpath(Base.@__DIR__, "sphere", "output")
output_file = "dss_scaling_shallow_water"
end
poly = (2, 4)
npoly = length(poly)
# read ClimaAtmos scaling data
I, FT = Int, Float64
nprocs = map(i -> Vector{I}(undef, 0), zeros(I, npoly))
walltime_dss_full = map(i -> Vector{FT}(undef, 0), zeros(I, npoly))
walltime_dss2_full = map(i -> Vector{FT}(undef, 0), zeros(I, npoly))
walltime_dss_internal = map(i -> Vector{FT}(undef, 0), zeros(I, npoly))
walltime_dss_comms = map(i -> Vector{FT}(undef, 0), zeros(I, npoly))
walltime_dss_comms_fsb = map(i -> Vector{FT}(undef, 0), zeros(I, npoly))
walltime_dss_comms_other = map(i -> Vector{FT}(undef, 0), zeros(I, npoly))
for filename in readdir(output_dir)
if occursin("dss_scaling_data", filename)
np = parse(I, split(split(filename, "npoly_")[end], ".")[1])
loc = findfirst(poly .== np)
if !isnothing(loc)
dict = load(joinpath(output_dir, filename))
push!(nprocs[loc], I(dict["nprocs"]))
push!(walltime_dss_full[loc], FT(dict["walltime_dss_full"]))
push!(walltime_dss2_full[loc], FT(dict["walltime_dss2_full"]))
push!(walltime_dss_internal[loc], FT(dict["walltime_dss_internal"]))
push!(walltime_dss_comms[loc], FT(dict["walltime_dss_comms"]))
push!(
walltime_dss_comms_fsb[loc],
FT(dict["walltime_dss_comms_fsb"]),
)
push!(
walltime_dss_comms_other[loc],
FT(dict["walltime_dss_comms_other"]),
)
end
end
end
log2nprocs = deepcopy(nprocs)
for i in 1:npoly
order = sortperm(nprocs[i])
nprocs[i] = nprocs[i][order]
walltime_dss_full[i] = walltime_dss_full[i][order]
walltime_dss2_full[i] = walltime_dss2_full[i][order]
walltime_dss_internal[i] = walltime_dss_internal[i][order]
walltime_dss_comms[i] = walltime_dss_comms[i][order]
walltime_dss_comms_fsb[i] = walltime_dss_comms_fsb[i][order]
walltime_dss_comms_other[i] = walltime_dss_comms_other[i][order]
log2nprocs[i] .= log2.(nprocs[i])
end
xticksstr = (log2nprocs[1], [string(i) for i in nprocs[1]])
kwargs = (
markershape = [:circle :square],
markercolor = [:blue :green],
label = ["npoly = 2" "npoly = 4"],
xticks = xticksstr,
yaxis = :log,
ylabel = "walltime (sec)",
xlabel = "# of procs",
legendfontsize = 3,
xlabelfontsize = 6,
ylabelfontsize = 6,
titlefontsize = 8,
left_margin = 5mm,
bottom_margin = 5mm,
top_margin = 5mm,
)
plots = Plots.Plot{Plots.GRBackend}[
plot(
[log2nprocs[1] log2nprocs[2]],
[walltime_dss_full[1] walltime_dss_full[2]],
title = "Full DSS",
legend = :topleft;
kwargs...,
),
plot(
[log2nprocs[1] log2nprocs[2]],
[walltime_dss_internal[1] walltime_dss_internal[2]],
title = "Internal DSS",
legend = :bottomleft;
kwargs...,
),
plot(
[log2nprocs[1] log2nprocs[2]],
[walltime_dss_comms[1] walltime_dss_comms[2]],
title = "Communication only",
legend = :bottom;
kwargs...,
),
plot(
[log2nprocs[1] log2nprocs[2]],
[walltime_dss_comms_fsb[1] walltime_dss_comms_fsb[2]],
title = "fill send buffer",
legend = :bottom;
kwargs...,
),
plot(
[log2nprocs[1] log2nprocs[2]],
[walltime_dss_comms_other[1] walltime_dss_comms_other[2]],
title = "Start and end",
legend = :topleft;
kwargs...,
),
]
Plots.plot(plots..., layout = @layout([° °; ° °; ° _]))
savefig(joinpath(output_dir, "$output_file.png"))
savefig(joinpath(output_dir, "$output_file.pdf"))
kwargs = (
markershape = :circle,
markercolor = :blue,
label = "Δt Np4/Δt Np2",
xticks = xticksstr,
ylim = (0.0, Inf),
ylabel = "speedup",
xlabel = "# of procs",
legendfontsize = 3,
legend = :bottom,
xlabelfontsize = 6,
ylabelfontsize = 6,
titlefontsize = 8,
left_margin = 5mm,
bottom_margin = 5mm,
top_margin = 5mm,
)
plots = Plots.Plot{Plots.GRBackend}[
plot(
log2nprocs[1],
walltime_dss_full[2] ./ walltime_dss_full[1],
title = "Full DSS";
kwargs...,
),
plot(
log2nprocs[1],
walltime_dss_internal[2] ./ walltime_dss_internal[1],
title = "Internal DSS";
kwargs...,
),
plot(
log2nprocs[1],
walltime_dss_comms[2] ./ walltime_dss_comms[1],
title = "Communication only";
kwargs...,
),
plot(
log2nprocs[1],
walltime_dss_comms_fsb[2] ./ walltime_dss_comms_fsb[1],
title = "fill send buffer";
kwargs...,
),
plot(
log2nprocs[1],
walltime_dss_comms_other[2] ./ walltime_dss_comms_other[1],
title = "Start and end";
kwargs...,
),
]
output_file = replace(output_file, "scaling" => "comparison")
Plots.plot(plots..., layout = @layout([° °; ° °; ° _]))
savefig(joinpath(output_dir, "$output_file.png"))
savefig(joinpath(output_dir, "$output_file.pdf"))
kwargs = (
xticks = xticksstr,
ylim = (0.0, Inf),
xlabel = "# of procs",
legendfontsize = 6,
xlabelfontsize = 6,
ylabelfontsize = 6,
titlefontsize = 8,
left_margin = 5mm,
bottom_margin = 5mm,
top_margin = 5mm,
)
plots = Plots.Plot{Plots.GRBackend}[
plot(
[log2nprocs[1] log2nprocs[1]],
[walltime_dss_full[1] walltime_dss2_full[1]],
title = "DSS vs DSS2 (npoly = 2)",
label = ["current DSS" "DSS2"],
ylabel = "walltime (sec)",
markershape = [:circle :square],
markercolor = [:blue :green],
legend = :topright;
kwargs...,
),
plot(
[log2nprocs[2] log2nprocs[2]],
[walltime_dss_full[2] walltime_dss2_full[2]],
title = "DSS vs DSS2 (npoly = 4)",
label = ["current DSS" "DSS2"],
ylabel = "walltime (sec)",
markershape = [:circle :square],
markercolor = [:blue :green],
legend = :topright;
kwargs...,
),
plot(
log2nprocs[1],
walltime_dss_full[1] ./ walltime_dss2_full[1],
title = "Speedup DSS vs DSS2 (npoly = 2)",
label = "walltime DSS/DSS2",
ylabel = "walltime (DSS/DSS2)",
markershape = :circle,
markercolor = :blue,
legend = :topleft;
kwargs...,
),
plot(
log2nprocs[2],
walltime_dss_full[2] ./ walltime_dss2_full[2],
title = "Speedup DSS vs DSS2 (npoly = 4)",
label = "walltime DSS/DSS2",
ylabel = "walltime (DSS/DSS2)",
markershape = :circle,
markercolor = :blue,
legend = :topleft;
kwargs...,
),
]
output_file = replace(output_file, "comparison" => "compare_dss_dss2")
Plots.plot(plots..., layout = @layout([° °; ° °]))
savefig(joinpath(output_dir, "$output_file.png"))
savefig(joinpath(output_dir, "$output_file.pdf"))