-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test add unit test buildkite fix distributed space in test distributed space in test rm redundant dir bash script docs modify sbatch script revs
- Loading branch information
1 parent
c8daf59
commit f9510b0
Showing
7 changed files
with
118 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#= | ||
Unit tests for ClimaCoupler Checkpointer module functions to exercise MPI | ||
These are in a separate testing file from the other Checkpointer unit tests so | ||
that MPI can be enabled for testing of these functions. | ||
=# | ||
|
||
using ClimaCore: Meshes, Domains, Topologies, Spaces, Fields, InputOutput | ||
using ClimaCoupler: TestHelper | ||
using ClimaComms | ||
using Test | ||
import ClimaCoupler: Interfacer | ||
import ClimaCoupler.Checkpointer: get_model_state_vector, restart_model_state!, checkpoint_model_state | ||
|
||
# set up MPI communications context | ||
const comms_ctx = ClimaComms.context(ClimaComms.CPUSingleThreaded()) | ||
const pid, nprocs = ClimaComms.init(comms_ctx) | ||
@info pid | ||
ClimaComms.barrier(comms_ctx) | ||
|
||
FT = Float64 | ||
struct DummySimulation{S} <: Interfacer.AtmosModelSimulation | ||
state::S | ||
end | ||
get_model_state_vector(sim::DummySimulation) = sim.state | ||
@testset "checkpoint_model_state, restart_model_state!" begin | ||
boundary_space = TestHelper.create_space(FT, comms_ctx = comms_ctx) | ||
t = 1 | ||
|
||
# old sim run | ||
sim = DummySimulation(Fields.FieldVector(T = ones(boundary_space))) | ||
checkpoint_model_state(sim, comms_ctx, t, output_dir = "test_checkpoint") | ||
|
||
# new sim run | ||
sim_new = DummySimulation(Fields.FieldVector(T = zeros(boundary_space))) | ||
restart_model_state!(sim_new, comms_ctx, t, input_dir = "test_checkpoint") | ||
@test sim_new.state.T == sim.state.T | ||
|
||
# remove checkpoint directory | ||
ClimaComms.barrier(comms_ctx) | ||
if ClimaComms.iamroot(comms_ctx) | ||
rm("./test_checkpoint/", force = true, recursive = true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
#SBATCH --time=24:00:00 | ||
#SBATCH --nodes=1 | ||
#SBATCH --job-name=mpi_restart_test | ||
#SBATCH --reservation=clima | ||
#SBATCH --mem=32GB | ||
#SBATCH --ntasks=2 | ||
|
||
module purge | ||
module load julia/1.8.5 openmpi/4.1.1 hdf5/1.12.1-ompi411 | ||
export JULIA_MPI_BINARY=system | ||
export JULIA_NUM_THREADS=${SLURM_CPUS_PER_TASK:=1} | ||
export CLIMACORE_DISTRIBUTED="MPI" | ||
export JULIA_HDF5_PATH="" | ||
|
||
export RUN_NAME=amip_restart_mpi_test | ||
export RESTART_DIR=experiments/AMIP/modular/output/amip/${RUN_NAME}_artifacts/ | ||
export RESTART_T=200 | ||
|
||
julia -e 'using Pkg; Pkg.add("MPIPreferences"); using MPIPreferences; use_system_binary()' | ||
julia --project -e 'using Pkg; Pkg.instantiate()' | ||
julia --project -e 'using Pkg; Pkg.build("MPI")' | ||
julia --project -e 'using Pkg; Pkg.build("HDF5")' | ||
julia --project -e 'using Pkg; Pkg.API.precompile()' | ||
|
||
julia --project=experiments/AMIP/modular/ -e 'using Pkg; Pkg.instantiate(;verbose=true)' | ||
julia --project=experiments/AMIP/modular/ -e 'using Pkg; Pkg.precompile()' | ||
julia --project=experiments/AMIP/modular/ -e 'using Pkg; Pkg.status()' | ||
|
||
julia --project=artifacts -e 'using Pkg; Pkg.instantiate(;verbose=true)' | ||
julia --project=artifacts -e 'using Pkg; Pkg.precompile()' | ||
julia --project=artifacts -e 'using Pkg; Pkg.status()' | ||
julia --project=artifacts artifacts/download_artifacts.jl | ||
|
||
# run spin up | ||
# - specify `--monthly_checkpoint true` to save monthly checkpoints of all model prognostic states | ||
mpiexec julia --color=yes --project=experiments/AMIP/modular/ experiments/AMIP/modular/coupler_driver_modular.jl --run_name $RUN_NAME --coupled true --start_date 19790101 --monthly_checkpoint true --anim true --surface_setup PrescribedSurface --dt_cpl 200 --energy_check false --mode_name amip --mono_surface false --vert_diff true --moist equil --rad clearsky --precip_model 0M --z_elem 35 --dz_bottom 50 --h_elem 12 --kappa_4 3e16 --rayleigh_sponge true --alpha_rayleigh_uh 0 --dt 200secs --t_end 0.1days --job_id $RUN_NAME --dt_save_to_sol 1000days --dt_save_to_disk 10days --apply_limiter false --FLOAT_TYPE Float64 | ||
|
||
# init using a restart | ||
# - specify the directory of the `checkpoint/` folder (i.e., `--restart_dir`) and time (in secs; `--restart_t`) of the restart file | ||
mpiexec julia --color=yes --project=experiments/AMIP/modular/ experiments/AMIP/modular/coupler_driver_modular.jl --run_name $RUN_NAME --coupled true --restart_dir $RESTART_DIR --restart_t $RESTART_T --start_date 19790102 --anim true --surface_setup PrescribedSurface --dt_cpl 200 --energy_check false --mode_name amip --mono_surface false --vert_diff true --moist equil --rad clearsky --precip_model 0M --z_elem 35 --dz_bottom 50 --h_elem 12 --kappa_4 3e16 --rayleigh_sponge true --alpha_rayleigh_uh 0 --dt 200secs --t_end 0.1days --job_id $RUN_NAME --dt_save_to_sol 1000days --dt_save_to_disk 10days --apply_limiter false --FLOAT_TYPE Float64 |