Move reduction notebook, add reduce_bench eval script
This commit is contained in:
parent
4584285126
commit
78717c2b43
119
data/evaluate_reduce_bench.jl
Normal file
119
data/evaluate_reduce_bench.jl
Normal file
@ -0,0 +1,119 @@
|
||||
using Plots
|
||||
using StatsPlots
|
||||
using CSV
|
||||
using DataFrames
|
||||
using LaTeXStrings
|
||||
|
||||
|
||||
if (length(ARGS) < 2)
|
||||
println("Please use with \"input_file.csv\" \"input_file_gpu.csv\"")
|
||||
end
|
||||
|
||||
|
||||
function proc_to_n(str::AbstractString)
|
||||
parts = split(str, "'")
|
||||
parts = split(parts[2], "->")
|
||||
k_count = count(c -> c == 'k', parts[2])
|
||||
return k_count
|
||||
end
|
||||
|
||||
function beautify_title(str::AbstractString)
|
||||
parts = split(str, "->")
|
||||
|
||||
prefix = parts[1]
|
||||
suffix = parts[2]
|
||||
|
||||
k_count = count(c -> c == 'k', suffix)
|
||||
B_count = count(c -> c == 'B', suffix)
|
||||
|
||||
if k_count == 1 || B_count == 1
|
||||
new_suffix = suffix
|
||||
elseif k_count >= 1
|
||||
new_suffix = replace(suffix, r"k+" => "k^$k_count")
|
||||
elseif B_count >= 1
|
||||
new_suffix = replace(suffix, r"B+" => "B^$B_count")
|
||||
end
|
||||
|
||||
return L"%$prefix \rightarrow %$new_suffix"
|
||||
end
|
||||
|
||||
processes =
|
||||
["ke->ke", "ke->kke", "ke->kkke", "ke->kkkke", "ke->kkkkke", "AB->AB", "AB->ABBB", "AB->ABBBBB", "AB->ABBBBBBB"]
|
||||
|
||||
input_file = ARGS[1]
|
||||
input_file_gpu = ARGS[2]
|
||||
df = CSV.read(input_file, DataFrame)
|
||||
df_gpu = CSV.read(input_file_gpu, DataFrame)
|
||||
n_inputs = 50_000
|
||||
|
||||
|
||||
for process in processes
|
||||
df_filt = filter(:process => x -> x == process, df)
|
||||
df_filt_gpu = filter(:process => x -> x == process, df_gpu)
|
||||
|
||||
cpu = !isempty(df_filt)
|
||||
gpu = !isempty(df_filt_gpu)
|
||||
|
||||
ymax = 0.0
|
||||
|
||||
if cpu
|
||||
@df df_filt scatter(
|
||||
:operations,
|
||||
:cumulative_optimization_time,
|
||||
label = "Cumulative Optimization Time (s)",
|
||||
markersize = 7,
|
||||
)
|
||||
ymax = max(df_filt[!, :cpu_st_t]..., df_filt[!, :cumulative_optimization_time]...) * 1.1
|
||||
@df df_filt scatter!(
|
||||
:operations,
|
||||
:cpu_st_t,
|
||||
label = "Single-Threaded Execution (s)",
|
||||
markersize = 7,
|
||||
markershape = :square,
|
||||
)
|
||||
end
|
||||
|
||||
if gpu
|
||||
if !cpu
|
||||
@df df_filt_gpu scatter(
|
||||
:operations,
|
||||
:cumulative_optimization_time,
|
||||
label = "Cumulative Optimization Time (s)",
|
||||
markersize = 7,
|
||||
)
|
||||
ymax = max(df_filt_gpu[!, :gpu_t]..., df_filt_gpu[!, :cumulative_optimization_time]...) * 1.1
|
||||
end
|
||||
|
||||
@df df_filt_gpu scatter!(
|
||||
:operations,
|
||||
:gpu_t,
|
||||
label = "GPU Execution (s)",
|
||||
markersize = 7,
|
||||
markershape = :diamond,
|
||||
)
|
||||
end
|
||||
|
||||
if cpu || gpu
|
||||
plot!(
|
||||
title = ("$(beautify_title(process)) Reduction Progression ($(n_inputs) Inputs)"),
|
||||
xscale = :linear,
|
||||
yscale = :linear,
|
||||
ylim = (0, ymax),
|
||||
legend = :outerbottom,
|
||||
minorgrid = true,
|
||||
xticks = :process_size,
|
||||
#yticks = [1e-3, 1e-1, 1e1, 1e3],
|
||||
xgrid = false,
|
||||
xminorticks = false,
|
||||
legendcolumns = 1,
|
||||
legend_font_pointsize = 12,
|
||||
fontsize = 12,
|
||||
size = (800, 600),
|
||||
xlabel = "optimizer steps (#)",
|
||||
ylabel = "time (s)",
|
||||
)
|
||||
|
||||
savefig("$(String(process))_reduction_bench.pdf")
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user