Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tests. #556

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .buildkite/A100_pipeline/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ steps:
slurm_mem_per_cpu: 6G

- label: "Flame Graph: All Sky"
command: "julia --color=yes --project=test perf/flame.jl all_sky.jl"
artifact_paths: "flame_graphs/all_sky/*"
command: "julia --color=yes --project=test perf/flame.jl cloudy_sky.jl"
artifact_paths: "flame_graphs/cloudy_sky/*"
agents:
slurm_ntasks: 1
slurm_mem_per_cpu: 6G
Expand Down Expand Up @@ -113,8 +113,8 @@ steps:
slurm_gres: "gpu:1"
slurm_exclusive:

- label: "GPU all-sky DYAMOND benchmark"
command: "julia --color=yes --project=test test/all_sky_dyamond_gpu_benchmark.jl"
- label: "GPU cloudy-sky DYAMOND benchmark"
command: "julia --color=yes --project=test test/cloudy_sky_dyamond_gpu_benchmark.jl"
env:
CLIMACOMMS_DEVICE: "CUDA"
agents:
Expand Down
6 changes: 3 additions & 3 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ steps:
slurm_mem_per_cpu: 6G

- label: "Flame Graph: All Sky"
command: "julia --color=yes --project=test perf/flame.jl all_sky.jl"
artifact_paths: "flame_graphs/all_sky/*"
command: "julia --color=yes --project=test perf/flame.jl cloudy_sky.jl"
artifact_paths: "flame_graphs/cloudy_sky/*"
agents:
slurm_ntasks: 1
slurm_mem_per_cpu: 6G
Expand Down Expand Up @@ -112,7 +112,7 @@ steps:
slurm_gres: "gpu:1"

- label: "GPU all-sky DYAMOND benchmark"
command: "julia --color=yes --project=test test/all_sky_dyamond_gpu_benchmark.jl"
command: "julia --color=yes --project=test test/cloudy_sky_dyamond_gpu_benchmark.jl"
env:
CLIMACOMMS_DEVICE: "CUDA"
agents:
Expand Down
52 changes: 5 additions & 47 deletions perf/benchmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ end
show(stdout, MIME("text/plain"), trial)
println()

@info "------------------------------------------------- Benchmark: all_sky"
@info "------------------------------------------------- Benchmark: cloudy_sky"
# @suppress_out begin
include(joinpath(root_dir, "test", "all_sky_utils.jl"))
include(joinpath(root_dir, "test", "cloudy_sky_utils.jl"))

toler_lw_noscat = Dict(Float64 => Float64(1e-5), Float32 => Float32(0.05))
toler_lw_2stream = Dict(Float64 => Float64(5), Float32 => Float32(5))
toler_sw = Dict(Float64 => Float64(1e-5), Float32 => Float32(0.06))

all_sky(
cloudy_sky(
ClimaComms.context(),
TwoStreamLWRTE,
TwoStreamSWRTE,
Expand All @@ -117,7 +117,7 @@ all_sky(
solve_sw!(slv_sw, as, lookup_sw, lookup_sw_cld) # compile first
solve_lw!(slv_lw, as, lookup_lw, lookup_lw_cld) # compile first

@info "all_sky, lw, use_lut=true"
@info "cloudy_sky, lw, use_lut=true"
device = ClimaComms.device(ClimaComms.context())
trial = if device isa ClimaComms.CUDADevice
using CUDA
Expand All @@ -127,7 +127,7 @@ else
end
show(stdout, MIME("text/plain"), trial)
println()
@info "all_sky, sw, use_lut=true"
@info "cloudy_sky, sw, use_lut=true"
device = ClimaComms.device(ClimaComms.context())
trial = if device isa ClimaComms.CUDADevice
using CUDA
Expand All @@ -137,45 +137,3 @@ else
end
show(stdout, MIME("text/plain"), trial)
println()

#=
# @suppress_out begin
all_sky(
ClimaComms.context(),
TwoStream,
TwoStream,
TwoStreamLWRTE,
TwoStreamSWRTE,
FT;
use_lut = false,
cldfrac = FT(1),
exfiltrate = true,
)
# end

(; slv_lw, slv_sw, as, lookup_sw, lookup_sw_cld, lookup_lw, lookup_lw_cld) = Infiltrator.exfiltrated

solve_sw!(slv_sw, as, lookup_sw, lookup_sw_cld) # compile first
solve_lw!(slv_lw, as, lookup_lw, lookup_lw_cld) # compile first

@info "all_sky, lw, use_lut=false"
device = ClimaComms.device(ClimaComms.context())
trial = if device isa ClimaComms.CUDADevice
using CUDA
@benchmark CUDA.@sync solve_lw!($slv_lw, $as, $lookup_lw, $lookup_lw_cld)
else
@benchmark solve_lw!($slv_lw, $as, $lookup_lw, $lookup_lw_cld)
end
show(stdout, MIME("text/plain"), trial)
println()
@info "all_sky, sw, use_lut=false"
device = ClimaComms.device(ClimaComms.context())
trial = if device isa ClimaComms.CUDADevice
using CUDA
@benchmark CUDA.@sync solve_sw!($slv_sw, $as, $lookup_sw, $lookup_sw_cld)
else
@benchmark solve_sw!($slv_sw, $as, $lookup_sw, $lookup_sw_cld)
end
show(stdout, MIME("text/plain"), trial)
println()
=#
4 changes: 2 additions & 2 deletions test/clear_sky_dyamond_gpu_benchmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using RRTMGP.ArtifactPaths
# overriding some parameters to match with RRTMGP FORTRAN code

include("reference_files.jl")
include("read_rfmip_clear_sky.jl")
include("read_clear_sky.jl")

function benchmark_clear_sky(
context,
Expand Down Expand Up @@ -62,7 +62,7 @@ function benchmark_clear_sky(
input_file = get_input_filename(:gas, :lw) # all-sky atmos state
ds_lw_in = Dataset(input_file, "r")
(as, sfc_emis, sfc_alb_direct, cos_zenith, toa_flux, bot_at_1) =
setup_rfmip_as(context, ds_lw_in, idx_gases, expt_no, lookup_lw, ncol, FT, VMR, param_set)
setup_clear_sky_as(context, ds_lw_in, idx_gases, expt_no, lookup_lw, ncol, FT, VMR, param_set)
close(ds_lw_in)

nlay, _ = AtmosphericStates.get_dims(as)
Expand Down
4 changes: 2 additions & 2 deletions test/clear_sky_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using RRTMGP.ArtifactPaths
# overriding some parameters to match with RRTMGP FORTRAN code

include("reference_files.jl")
include("read_rfmip_clear_sky.jl")
include("read_clear_sky.jl")
#---------------------------------------------------------------
function clear_sky(
context,
Expand Down Expand Up @@ -63,7 +63,7 @@ function clear_sky(
# reading rfmip data to atmospheric state
ds_lw_in = Dataset(input_file, "r")
(as, sfc_emis, sfc_alb_direct, cos_zenith, toa_flux, bot_at_1) =
setup_rfmip_as(context, ds_lw_in, idx_gases, expt_no, lookup_lw, ncol, FT, VMR, param_set)
setup_clear_sky_as(context, ds_lw_in, idx_gases, expt_no, lookup_lw, ncol, FT, VMR, param_set)
close(ds_lw_in)

nlay, _ = AtmosphericStates.get_dims(as)
Expand Down
6 changes: 3 additions & 3 deletions test/all_sky.jl → test/cloudy_sky.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FT = get(ARGS, 1, Float64) == "Float32" ? Float32 : Float64
include("all_sky_utils.jl")
include("cloudy_sky_utils.jl")

context = ClimaComms.context()

Expand All @@ -8,7 +8,7 @@ toler_lw_2stream = Dict(Float64 => Float64(5), Float32 => Float32(5))
toler_sw = Dict(Float64 => Float64(1e-5), Float32 => Float32(0.06))

@testset "Cloudy-sky (gas + clouds) calculations using lookup table method, with non-scattering LW and TwoStream SW solvers" begin
@time all_sky(
@time cloudy_sky(
context,
NoScatLWRTE,
TwoStreamSWRTE,
Expand All @@ -22,7 +22,7 @@ toler_sw = Dict(Float64 => Float64(1e-5), Float32 => Float32(0.06))
end

@testset "Cloudy-sky (gas + clouds) Two-stream calculations using lookup table method" begin
@time all_sky(
@time cloudy_sky(
context,
TwoStreamLWRTE,
TwoStreamSWRTE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using RRTMGP.ArtifactPaths
# overriding some parameters to match with RRTMGP FORTRAN code

include("reference_files.jl")
include("read_all_sky.jl")
include("read_cloudy_sky.jl")

function benchmark_all_sky(
context,
Expand Down Expand Up @@ -70,7 +70,7 @@ function benchmark_all_sky(
close(ds_sw_cld)
# reading input file
ds_in = Dataset(input_file, "r")
as, sfc_emis, sfc_alb_direct, sfc_alb_diffuse, cos_zenith, toa_flux, bot_at_1 = setup_allsky_as(
as, sfc_emis, sfc_alb_direct, sfc_alb_diffuse, cos_zenith, toa_flux, bot_at_1 = setup_cloudy_sky_as(
context,
ds_in,
idx_gases,
Expand Down
6 changes: 3 additions & 3 deletions test/all_sky_utils.jl → test/cloudy_sky_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ using RRTMGP.ArtifactPaths
# overriding some parameters to match with RRTMGP FORTRAN code

include("reference_files.jl")
include("read_all_sky.jl")
include("read_cloudy_sky.jl")

function all_sky(
function cloudy_sky(
context,
::Type{SLVLW},
::Type{SLVSW},
Expand Down Expand Up @@ -70,7 +70,7 @@ function all_sky(
close(ds_sw_cld)
# reading input file
ds_in = Dataset(input_file, "r")
as, sfc_emis, sfc_alb_direct, sfc_alb_diffuse, cos_zenith, toa_flux, bot_at_1 = setup_allsky_as(
as, sfc_emis, sfc_alb_direct, sfc_alb_diffuse, cos_zenith, toa_flux, bot_at_1 = setup_cloudy_sky_as(
context,
ds_in,
idx_gases,
Expand Down
2 changes: 1 addition & 1 deletion test/read_rfmip_clear_sky.jl → test/read_clear_sky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function ncol_ds_clear_sky()
return size(Array(ds_comp["rlu"]), 2)
end

function setup_rfmip_as(
function setup_clear_sky_as(
context,
ds_lw_in,
idx_gases,
Expand Down
2 changes: 1 addition & 1 deletion test/read_all_sky.jl → test/read_cloudy_sky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function ncol_ds_all_sky(use_lut)
return size(Array(ds_comp["lw_flux_up"]), 1)
end

function setup_allsky_as(
function setup_cloudy_sky_as(
context,
ds_in,
idx_gases,
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ printstyled("=================================\n\n", color = color1)
toler_lw_2stream = Dict(Float64 => Float64(5), Float32 => Float32(5))
toler_sw = Dict(Float64 => Float64(1e-5), Float32 => Float32(0.06))

include("all_sky_utils.jl")
include("cloudy_sky_utils.jl")
for FT in (Float32, Float64)
all_sky(
cloudy_sky(
context,
NoScatLWRTE,
TwoStreamSWRTE,
Expand All @@ -48,7 +48,7 @@ printstyled("=================================\n\n", color = color1)
use_lut = true,
cldfrac = FT(1),
)
all_sky(
cloudy_sky(
context,
TwoStreamLWRTE,
TwoStreamSWRTE,
Expand Down
Loading