Skip to content

Commit

Permalink
Remove duplicate code in scaling plots, add debug prints
Browse files Browse the repository at this point in the history
Update post_processing/plot_gpu_scaling_utils.jl

Co-authored-by: Nat Efrat-Henrici <60049837+nefrathenrici@users.noreply.github.com>
  • Loading branch information
charleskawczynski and nefrathenrici committed Apr 9, 2024
1 parent 9c3a382 commit 0b57467
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 38 deletions.
37 changes: 37 additions & 0 deletions post_processing/plot_gpu_scaling_utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using JLD2
function get_jld2data(output_dir, job_id, s)
FT = Float64
nprocs_clima_atmos = Int[]
ncols_per_process = Int[]
walltime_clima_atmos = FT[]
found = false
for foldername in readdir(output_dir)
if occursin(job_id, foldername) && occursin(s, foldername)
nprocs_string = split(split(foldername, s)[end], "process")[1]
file = joinpath(
output_dir,
foldername,
"output_active",
"scaling_data_$(nprocs_string)_processes.jld2",
)
if !isfile(file)
@show readdir(output_dir)
@show readdir(dirname(file))
end
dict = load(file)
push!(nprocs_clima_atmos, Int(dict["nprocs"]))
push!(ncols_per_process, Int(dict["ncols_per_process"]))
push!(walltime_clima_atmos, FT(dict["walltime"]))
else
@show occursin(job_id, foldername)
@show occursin(s, foldername)
end
end
if !found
@show readdir(output_dir)
end
@show nprocs_clima_atmos
@show ncols_per_process
@show walltime_clima_atmos
return (; nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos)
end
23 changes: 4 additions & 19 deletions post_processing/plot_gpu_strong_scaling.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using CairoMakie
using JLD2

include("plot_gpu_scaling_utils.jl")

job_id = "gpu_aquaplanet_dyamond_ss"
output_dir = "./"

Expand All @@ -16,25 +18,8 @@ nlevels = z_elem + 1
t_int = string(t_int_days) * " days"

# read ClimaAtmos scaling data
I, FT = Int, Float64
nprocs_clima_atmos = I[]
ncols_per_process = I[]
walltime_clima_atmos = FT[]
for foldername in readdir(output_dir)
if occursin(job_id, foldername) && occursin("_ss_", foldername)
nprocs_string = split(split(foldername, "_ss_")[end], "process")[1]
dict = load(
joinpath(
output_dir,
foldername,
"scaling_data_$(nprocs_string)_processes.jld2",
),
)
push!(nprocs_clima_atmos, I(dict["nprocs"]))
push!(ncols_per_process, I(dict["ncols_per_process"]))
push!(walltime_clima_atmos, FT(dict["walltime"]))
end
end
(; nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos) =
get_jld2data(output_dir, job_id, "_ss_")

order = sortperm(nprocs_clima_atmos)
nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos =
Expand Down
25 changes: 6 additions & 19 deletions post_processing/plot_gpu_weak_scaling.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using CairoMakie
using JLD2

include("plot_gpu_scaling_utils.jl")

job_id = "gpu_aquaplanet_dyamond_ws"
output_dir = "./"

Expand All @@ -16,30 +18,15 @@ nlevels = z_elem + 1
t_int = string(t_int_days) * " days"

# read ClimaAtmos scaling data
I, FT = Int, Float64
nprocs_clima_atmos = I[]
ncols_per_process = I[]
walltime_clima_atmos = FT[]
for foldername in readdir(output_dir)
if occursin(job_id, foldername) && occursin("_ws_", foldername)
nprocs_string = split(split(foldername, "_ws_")[end], "process")[1]
dict = load(
joinpath(
output_dir,
foldername,
"scaling_data_$(nprocs_string)_processes.jld2",
),
)
push!(nprocs_clima_atmos, I(dict["nprocs"]))
push!(ncols_per_process, I(dict["ncols_per_process"]))
push!(walltime_clima_atmos, FT(dict["walltime"]))
end
end
(; nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos) =
get_jld2data(output_dir, job_id, "_ws_")

order = sortperm(nprocs_clima_atmos)
nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos =
nprocs_clima_atmos[order],
ncols_per_process[order],
walltime_clima_atmos[order]

# simulated years per day
sypd_clima_atmos =
(secs_per_day ./ walltime_clima_atmos) * t_int_days ./ days_per_year
Expand Down

0 comments on commit 0b57467

Please sign in to comment.