-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotting.jl
More file actions
85 lines (72 loc) · 2.19 KB
/
plotting.jl
File metadata and controls
85 lines (72 loc) · 2.19 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
using CSV, DataFrames, Plots
function make_efficiency_plot(csv, title, file)
csv = joinpath("benchmarks/", csv)
file = joinpath("benchmarks/", file)
df = CSV.read(csv, DataFrame)
sort!(df, [:model, :gpus])
# Compute efficiency = T(1) / T(Np) for each model
df_eff = DataFrame()
for g in groupby(df, :model)
t1 = g.mean_time_ms[g.gpus .== 1][1]
eff = t1 ./ g.mean_time_ms
df_tmp = DataFrame(model=g.model, gpus=g.gpus, efficiency=eff)
append!(df_eff, df_tmp)
end
# Plot efficiency
plt_eff = plot(;
xlabel = "Number of GPUs",
ylabel = "Scaling Efficiency [T(1) / T(Np)]",
title = title,
xticks = [1, 2, 4, 8],
legend = :bottomleft,
dpi = 300,
xscale = :log2,
ylims = (0, 1.2)
)
for g in groupby(df_eff, :model)
label = g.model[1]
sort!(g, :gpus)
plot!(plt_eff, g.gpus, g.efficiency;
label=label,
lw=2,
marker=:circle,
xticks=([1,2,4,8], ["1","2","4","8"])
)
end
savefig(plt_eff, file)
println("Saved weak scaling efficiency plot to $(file)")
end
function make_weak_plot(csv, title, file)
csv = joinpath("benchmarks/", csv)
file = joinpath("benchmarks/", file)
df = CSV.read(csv, DataFrame)
# Compute total problem size and per-GPU size
df.size = df.n .* df.m
df.size_per_gpu = df.size ./ df.gpus
df.gflops_per_gpu = df.gflops ./ df.gpus
# Sort so GPUs increase left-to-right
sort!(df, [:model, :gpus])
plt = plot(;
xlabel = "Number of GPUs",
ylabel = "GFLOPS / GPU",
title = title,
xticks = sort(unique(df.gpus)),
legend = :bottomright,
dpi = 300
)
# Plot one line per model
for g in groupby(df, :model)
label = g.model[1]
sort!(g, :gpus)
plot!(plt, g.gpus, g.gflops_per_gpu;
label=label,
lw=2,
marker=:circle,
xscale=:log2,
yscale=:log10,
ylims=(1, 1e5),
xticks = ([1, 2, 4, 8], ["1", "2", "4", "8"]))
end
savefig(plt, file)
println("Saved plot to $(file)")
end