Skip to content

Commit a7b463a

Browse files
Merge pull request #2877 from CliMA/ck/fix_paths3
Remove duplicate code in scaling plots, add debug prints
2 parents 9c3a382 + 0b57467 commit a7b463a

File tree

3 files changed

+47
-38
lines changed

3 files changed

+47
-38
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using JLD2
2+
function get_jld2data(output_dir, job_id, s)
3+
FT = Float64
4+
nprocs_clima_atmos = Int[]
5+
ncols_per_process = Int[]
6+
walltime_clima_atmos = FT[]
7+
found = false
8+
for foldername in readdir(output_dir)
9+
if occursin(job_id, foldername) && occursin(s, foldername)
10+
nprocs_string = split(split(foldername, s)[end], "process")[1]
11+
file = joinpath(
12+
output_dir,
13+
foldername,
14+
"output_active",
15+
"scaling_data_$(nprocs_string)_processes.jld2",
16+
)
17+
if !isfile(file)
18+
@show readdir(output_dir)
19+
@show readdir(dirname(file))
20+
end
21+
dict = load(file)
22+
push!(nprocs_clima_atmos, Int(dict["nprocs"]))
23+
push!(ncols_per_process, Int(dict["ncols_per_process"]))
24+
push!(walltime_clima_atmos, FT(dict["walltime"]))
25+
else
26+
@show occursin(job_id, foldername)
27+
@show occursin(s, foldername)
28+
end
29+
end
30+
if !found
31+
@show readdir(output_dir)
32+
end
33+
@show nprocs_clima_atmos
34+
@show ncols_per_process
35+
@show walltime_clima_atmos
36+
return (; nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos)
37+
end

post_processing/plot_gpu_strong_scaling.jl

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using CairoMakie
22
using JLD2
33

4+
include("plot_gpu_scaling_utils.jl")
5+
46
job_id = "gpu_aquaplanet_dyamond_ss"
57
output_dir = "./"
68

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

1820
# read ClimaAtmos scaling data
19-
I, FT = Int, Float64
20-
nprocs_clima_atmos = I[]
21-
ncols_per_process = I[]
22-
walltime_clima_atmos = FT[]
23-
for foldername in readdir(output_dir)
24-
if occursin(job_id, foldername) && occursin("_ss_", foldername)
25-
nprocs_string = split(split(foldername, "_ss_")[end], "process")[1]
26-
dict = load(
27-
joinpath(
28-
output_dir,
29-
foldername,
30-
"scaling_data_$(nprocs_string)_processes.jld2",
31-
),
32-
)
33-
push!(nprocs_clima_atmos, I(dict["nprocs"]))
34-
push!(ncols_per_process, I(dict["ncols_per_process"]))
35-
push!(walltime_clima_atmos, FT(dict["walltime"]))
36-
end
37-
end
21+
(; nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos) =
22+
get_jld2data(output_dir, job_id, "_ss_")
3823

3924
order = sortperm(nprocs_clima_atmos)
4025
nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos =

post_processing/plot_gpu_weak_scaling.jl

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using CairoMakie
22
using JLD2
33

4+
include("plot_gpu_scaling_utils.jl")
5+
46
job_id = "gpu_aquaplanet_dyamond_ws"
57
output_dir = "./"
68

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

1820
# read ClimaAtmos scaling data
19-
I, FT = Int, Float64
20-
nprocs_clima_atmos = I[]
21-
ncols_per_process = I[]
22-
walltime_clima_atmos = FT[]
23-
for foldername in readdir(output_dir)
24-
if occursin(job_id, foldername) && occursin("_ws_", foldername)
25-
nprocs_string = split(split(foldername, "_ws_")[end], "process")[1]
26-
dict = load(
27-
joinpath(
28-
output_dir,
29-
foldername,
30-
"scaling_data_$(nprocs_string)_processes.jld2",
31-
),
32-
)
33-
push!(nprocs_clima_atmos, I(dict["nprocs"]))
34-
push!(ncols_per_process, I(dict["ncols_per_process"]))
35-
push!(walltime_clima_atmos, FT(dict["walltime"]))
36-
end
37-
end
21+
(; nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos) =
22+
get_jld2data(output_dir, job_id, "_ws_")
23+
3824
order = sortperm(nprocs_clima_atmos)
3925
nprocs_clima_atmos, ncols_per_process, walltime_clima_atmos =
4026
nprocs_clima_atmos[order],
4127
ncols_per_process[order],
4228
walltime_clima_atmos[order]
29+
4330
# simulated years per day
4431
sypd_clima_atmos =
4532
(secs_per_day ./ walltime_clima_atmos) * t_int_days ./ days_per_year

0 commit comments

Comments
 (0)