Skip to content

Commit

Permalink
Merge pull request #2151 from CliMA/ncc/split-tests-take2
Browse files Browse the repository at this point in the history
Split tests into smaller bits and pieces (take #2)
  • Loading branch information
navidcy committed Jan 16, 2022
2 parents ead615f + c3834b0 commit 94d55b3
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 55 deletions.
112 changes: 104 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,67 @@ steps:
##### Solver tests
#####

- label: "🦅 gpu solver tests"
- label: "🦅 gpu poisson solver tests"
env:
JULIA_DEPOT_PATH: "$SVERDRUP_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "solvers"
TEST_GROUP: "poisson_solvers"
commands:
- "$SVERDRUP_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: GPU
depends_on: "init_gpu"

- label: "🕊️ cpu solver tests"
- label: "🕊️ cpu poisson solver tests"
env:
JULIA_DEPOT_PATH: "$TARTARUS_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "solvers"
TEST_GROUP: "poisson_solvers"
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: CPU
depends_on: "init_cpu"

- label: "🌷 gpu matrix poisson solver tests"
env:
JULIA_DEPOT_PATH: "$SVERDRUP_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "matrix_poisson_solvers"
commands:
- "$SVERDRUP_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: GPU
depends_on: "init_gpu"

- label: "🌹 cpu matrix poisson solver tests"
env:
JULIA_DEPOT_PATH: "$TARTARUS_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "matrix_poisson_solvers"
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: CPU
depends_on: "init_cpu"

- label: "🦤 gpu general solver tests"
env:
JULIA_DEPOT_PATH: "$SVERDRUP_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "general_solvers"
commands:
- "$SVERDRUP_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: GPU
depends_on: "init_gpu"

- label: "🦃 cpu general solver tests"
env:
JULIA_DEPOT_PATH: "$TARTARUS_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "general_solvers"
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
Expand Down Expand Up @@ -163,6 +209,33 @@ steps:
architecture: CPU
depends_on: "init_cpu"

#####
##### Turbulence Closures
#####

- label: "🎣 gpu turbulence closures"
env:
JULIA_DEPOT_PATH: "$SVERDRUP_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "turbulence_closures"
commands:
- "$SVERDRUP_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: GPU
depends_on: "init_gpu"

- label: "🎏 cpu turbulence closures"
env:
JULIA_DEPOT_PATH: "$TARTARUS_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "turbulence_closures"
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: CPU
depends_on: "init_cpu"

#####
##### HydrostaticFreeSurfaceModel
#####
Expand Down Expand Up @@ -320,21 +393,44 @@ steps:
##### Regression
#####

- label: "🐫 gpu regression tests"
- label: "🐫 gpu nonhydrostatic regression tests"
env:
JULIA_DEPOT_PATH: "$SVERDRUP_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "nonhydrostatic_regression"
commands:
- "$SVERDRUP_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: GPU
depends_on: "init_gpu"

- label: "🐪 cpu nonhydrostatic regression tests"
env:
JULIA_DEPOT_PATH: "$TARTARUS_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "nonhydrostatic_regression"
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: CPU
depends_on: "init_cpu"

- label: "🙈 gpu hydrostatic regression tests"
env:
JULIA_DEPOT_PATH: "$SVERDRUP_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "regression"
TEST_GROUP: "hydrostatic_regression"
commands:
- "$SVERDRUP_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
agents:
queue: Oceananigans
architecture: GPU
depends_on: "init_gpu"

- label: "🐪 cpu regression tests"
- label: "🙉 cpu hydrostatic regression tests"
env:
JULIA_DEPOT_PATH: "$TARTARUS_HOME/.julia-$BUILDKITE_BUILD_NUMBER"
TEST_GROUP: "regression"
TEST_GROUP: "hydrostatic_regression"
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$TARTARUS_HOME/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.test()'"
Expand Down
33 changes: 26 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,25 @@ include("dependencies_for_runtests.jl")
end
end

if group == :solvers || group == :all
@testset "Solvers" begin
include("test_batched_tridiagonal_solver.jl")
include("test_preconditioned_conjugate_gradient_solver.jl")
if group == :poisson_solvers || group == :all
@testset "Poisson Solvers" begin
include("test_poisson_solvers.jl")
end
end

if group == :matrix_poisson_solvers || group == :all
@testset "Matrix Poisson Solvers" begin
include("test_matrix_poisson_solver.jl")
end
end

if group == :general_solvers || group == :all
@testset "General Solvers" begin
include("test_batched_tridiagonal_solver.jl")
include("test_preconditioned_conjugate_gradient_solver.jl")
end
end

# Simulations
if group == :simulation || group == :all
@testset "Simulation tests" begin
Expand All @@ -64,11 +74,16 @@ include("dependencies_for_runtests.jl")
@testset "Model and time stepping tests (part 2)" begin
include("test_boundary_conditions_integration.jl")
include("test_forcings.jl")
include("test_turbulence_closures.jl")
include("test_dynamics.jl")
end
end

if group == :turbulence_closures || group == :all
@testset "Turbulence closures tests" begin
include("test_turbulence_closures.jl")
end
end

if group == :shallow_water || group == :all
include("test_shallow_water_models.jl")
end
Expand Down Expand Up @@ -99,8 +114,12 @@ include("dependencies_for_runtests.jl")
include("test_distributed_poisson_solvers.jl")
end

if group == :regression || group == :all
include("test_regression.jl")
if group == :nonhydrostatic_regression || group == :all
include("test_nonhydrostatic_regression.jl")
end

if group == :hydrostatic_regression || group == :all
include("test_hydrostatic_regression.jl")
end

if group == :scripts || group == :all
Expand Down
55 changes: 15 additions & 40 deletions test/test_regression.jl → test/test_hydrostatic_regression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function show_hydrostatic_test(grid, free_surface, comp)
return testset_str, info_str
end


function get_fields_from_checkpoint(filename)
file = jldopen(filename)

Expand Down Expand Up @@ -56,47 +55,22 @@ function get_fields_from_checkpoint(filename)
return solution, Gⁿ, G⁻
end

include("regression_tests/thermal_bubble_regression_test.jl")
include("regression_tests/rayleigh_benard_regression_test.jl")
include("regression_tests/ocean_large_eddy_simulation_regression_test.jl")
include("regression_tests/hydrostatic_free_turbulence_regression_test.jl")

@testset "Regression" begin
@info "Running regression tests..."
@testset "Hydrostatic Regression" begin
@info "Running hydrostatic regression tests..."

for arch in archs
for grid_type in [:regular, :vertically_unstretched]
@testset "Thermal bubble [$(typeof(arch)), $grid_type grid]" begin
@info " Testing thermal bubble regression [$(typeof(arch)), $grid_type grid]"
run_thermal_bubble_regression_test(arch, grid_type)
end

@testset "Rayleigh–Bénard tracer [$(typeof(arch)), $grid_type grid]]" begin
@info " Testing Rayleigh–Bénard tracer regression [$(typeof(arch)), $grid_type grid]"
run_rayleigh_benard_regression_test(arch, grid_type)
end

for closure in (AnisotropicMinimumDissipation=1.05e-6, κ=1.46e-7), SmagorinskyLilly(C=0.23, Cb=1, Pr=1, ν=1.05e-6, κ=1.46e-7))
closurename = string(typeof(closure).name.wrapper)
@testset "Ocean large eddy simulation [$(typeof(arch)), $closurename, $grid_type grid]" begin
@info " Testing oceanic large eddy simulation regression [$(typeof(arch)), $closurename, $grid_type grid]"
run_ocean_large_eddy_simulation_regression_test(arch, grid_type, closure)
end
end
end

# Hydrostatic regression test

longitude = ((-180, 180), collect(-180:2:180), (-160, 160), collect(-160:2:160))
latitude = ((-60, 60), collect(-60:2:60))
zcoord = ((-90, 0) , collect(-90:30:0))

explicit_free_surface = ExplicitFreeSurface(gravitational_acceleration=1.0)
longitude = ((-180, 180), (-160, 160))
latitude = ((-60, 60),)
zcoord = ((-90, 0),)

explicit_free_surface = ExplicitFreeSurface(gravitational_acceleration = 1.0)
implicit_free_surface = ImplicitFreeSurface(gravitational_acceleration = 1.0,
solver_method = :PreconditionedConjugateGradient,
tolerance = 1e-15)

for lon in longitude, lat in latitude, z in zcoord, comp in (true, false)
solver_method = :PreconditionedConjugateGradient,
tolerance = 1e-15)
for lon in longitude, lat in latitude, z in zcoord, comp in (true, false)

lon[1] == -180 ? N = (180, 60, 3) : N = (160, 60, 3)

Expand All @@ -109,18 +83,19 @@ include("regression_tests/hydrostatic_free_turbulence_regression_test.jl")
precompute_metrics = comp)

for free_surface in [explicit_free_surface, implicit_free_surface]

# GPU + ImplicitFreeSurface + precompute metrics is not compatible at the moment.
# kernel " uses too much parameter space (maximum 0x1100 bytes) " error
if !(comp && free_surface isa ImplicitFreeSurface && arch isa GPU)

testset_str, info_str = show_hydrostatic_test(grid, free_surface, comp)

@testset "$testset_str" begin
@info "$info_str"
run_hydrostatic_free_turbulence_regression_test(grid, free_surface)
end
end
end
end
end
end
end
end
69 changes: 69 additions & 0 deletions test/test_nonhydrostatic_regression.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
include("dependencies_for_runtests.jl")

using Oceananigans.Grids: topology, XRegLatLonGrid, YRegLatLonGrid, ZRegLatLonGrid

function get_fields_from_checkpoint(filename)
file = jldopen(filename)

tracers = keys(file["tracers"])
tracers = Tuple(Symbol(c) for c in tracers)

velocity_fields = (u = file["velocities/u/data"],
v = file["velocities/v/data"],
w = file["velocities/w/data"])

tracer_fields =
NamedTuple{tracers}(Tuple(file["tracers/$c/data"] for c in tracers))

current_tendency_velocity_fields = (u = file["timestepper/Gⁿ/u/data"],
v = file["timestepper/Gⁿ/v/data"],
w = file["timestepper/Gⁿ/w/data"])

current_tendency_tracer_fields =
NamedTuple{tracers}(Tuple(file["timestepper/Gⁿ/$c/data"] for c in tracers))

previous_tendency_velocity_fields = (u = file["timestepper/G⁻/u/data"],
v = file["timestepper/G⁻/v/data"],
w = file["timestepper/G⁻/w/data"])

previous_tendency_tracer_fields =
NamedTuple{tracers}(Tuple(file["timestepper/G⁻/$c/data"] for c in tracers))

close(file)

solution = merge(velocity_fields, tracer_fields)
Gⁿ = merge(current_tendency_velocity_fields, current_tendency_tracer_fields)
G⁻ = merge(previous_tendency_velocity_fields, previous_tendency_tracer_fields)

return solution, Gⁿ, G⁻
end

include("regression_tests/thermal_bubble_regression_test.jl")
include("regression_tests/rayleigh_benard_regression_test.jl")
include("regression_tests/ocean_large_eddy_simulation_regression_test.jl")

@testset "Nonhydrostatic Regression" begin
@info "Running nonhydrostatic regression tests..."

for arch in archs
for grid_type in [:regular, :vertically_unstretched]
@testset "Thermal bubble [$(typeof(arch)), $grid_type grid]" begin
@info " Testing thermal bubble regression [$(typeof(arch)), $grid_type grid]"
run_thermal_bubble_regression_test(arch, grid_type)
end

@testset "Rayleigh–Bénard tracer [$(typeof(arch)), $grid_type grid]]" begin
@info " Testing Rayleigh–Bénard tracer regression [$(typeof(arch)), $grid_type grid]"
run_rayleigh_benard_regression_test(arch, grid_type)
end

for closure in (AnisotropicMinimumDissipation=1.05e-6, κ=1.46e-7), SmagorinskyLilly(C=0.23, Cb=1, Pr=1, ν=1.05e-6, κ=1.46e-7))
closurename = string(typeof(closure).name.wrapper)
@testset "Ocean large eddy simulation [$(typeof(arch)), $closurename, $grid_type grid]" begin
@info " Testing oceanic large eddy simulation regression [$(typeof(arch)), $closurename, $grid_type grid]"
run_ocean_large_eddy_simulation_regression_test(arch, grid_type, closure)
end
end
end
end
end

0 comments on commit 94d55b3

Please sign in to comment.