diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index bfbc6b4fb0..a3d87ce744 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -34,15 +34,15 @@ steps: - "julia --project -e 'using Pkg; Pkg.precompile()'" - "julia --project -e 'using Pkg; Pkg.status()'" - - echo "--- Instantiate sea breeze env" - - "julia --project=experiments/ClimaCore/sea_breeze -e 'using Pkg; Pkg.instantiate(;verbose=true)'" - - "julia --project=experiments/ClimaCore/sea_breeze -e 'using Pkg; Pkg.precompile()'" - - "julia --project=experiments/ClimaCore/sea_breeze -e 'using Pkg; Pkg.status()'" + # - echo "--- Instantiate sea breeze env" + # - "julia --project=experiments/ClimaCore/sea_breeze -e 'using Pkg; Pkg.instantiate(;verbose=true)'" + # - "julia --project=experiments/ClimaCore/sea_breeze -e 'using Pkg; Pkg.precompile()'" + # - "julia --project=experiments/ClimaCore/sea_breeze -e 'using Pkg; Pkg.status()'" - - echo "--- Instantiate climacore exp env" - - "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'" - - "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.precompile()'" - - "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.status()'" + # - echo "--- Instantiate climacore exp env" + # - "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'" + # - "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.precompile()'" + # - "julia --project=experiments/ClimaCore/ -e 'using Pkg; Pkg.status()'" - echo "--- Instantiate AMIP env" - "julia --project=experiments/AMIP/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'" @@ -54,11 +54,11 @@ steps: - "julia --project=perf/ -e 'using Pkg; Pkg.precompile()'" - "julia --project=perf/ -e 'using Pkg; Pkg.status()'" - - echo "--- Instantiate test env" - - "julia --project=test/ -e 'using Pkg; Pkg.develop(path=\".\")'" - - "julia --project=test/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'" - - "julia --project=test/ -e 'using Pkg; Pkg.precompile()'" - - "julia --project=test/ -e 'using Pkg; Pkg.status()'" + # - echo "--- Instantiate test env" + # - "julia --project=test/ -e 'using Pkg; Pkg.develop(path=\".\")'" + # - "julia --project=test/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'" + # - "julia --project=test/ -e 'using Pkg; Pkg.precompile()'" + # - "julia --project=test/ -e 'using Pkg; Pkg.status()'" - echo "--- Download artifacts" - "julia --project=artifacts -e 'using Pkg; Pkg.instantiate(;verbose=true)'" @@ -77,61 +77,61 @@ steps: - wait - - group: "Unit Tests" - steps: - - label: "MPI Regridder unit tests" - key: "regridder_mpi_tests" - command: "srun julia --color=yes --project=test/ test/mpi_tests/regridder_mpi_tests.jl --config_file $MPI_CONFIG_PATH/regridder_mpi.yml" - timeout_in_minutes: 20 - env: - CLIMACORE_DISTRIBUTED: "MPI" - NPROCS: 2 - agents: - slurm_ntasks: 2 - slurm_mem: 16GB - - - label: "MPI BCReader unit tests" - key: "bcreader_mpi_tests" - command: "srun julia --color=yes --project=test/ test/mpi_tests/bcreader_mpi_tests.jl --run_name bcreader_mpi --job_id bcreader_mpi" - timeout_in_minutes: 20 - env: - CLIMACORE_DISTRIBUTED: "MPI" - agents: - slurm_ntasks: 2 - slurm_mem: 16GB - - - label: "MPI Checkpointer unit tests" - key: "checkpointer_mpi_tests" - command: "srun julia --color=yes --project=test/ test/mpi_tests/checkpointer_mpi_tests.jl --run_name checkpointer_mpi --job_id checkpointer_mpi" - timeout_in_minutes: 20 - env: - CLIMACORE_DISTRIBUTED: "MPI" - agents: - slurm_ntasks: 2 - slurm_mem: 16GB - - - label: "MPI Utilities unit tests" - key: "utilities_mpi_tests" - command: "srun julia --color=yes --project=test/ test/utilities_tests.jl --run_name utilities_mpi --job_id utilities_mpi" - timeout_in_minutes: 20 - env: - CLIMACORE_DISTRIBUTED: "MPI" - agents: - slurm_ntasks: 2 - slurm_mem: 16GB - - - label: "GPU Utilities unit tests" - key: "utilities_gpu_tests" - command: "srun julia --color=yes --project=test/ test/utilities_tests.jl --run_name utilities_gpu --job_id utilities_gpu" - agents: - slurm_mem: 5GB - slurm_gpus: 1 - - - label: "Perf flame graph diff tests" - command: "julia --color=yes --project=perf/ perf/flame_test.jl --run_name flame_test --job_id flame_perf_target" - timeout_in_minutes: 5 - agents: - slurm_mem: 16GB + # - group: "Unit Tests" + # steps: + # - label: "MPI Regridder unit tests" + # key: "regridder_mpi_tests" + # command: "srun julia --color=yes --project=test/ test/mpi_tests/regridder_mpi_tests.jl --config_file $MPI_CONFIG_PATH/regridder_mpi.yml" + # timeout_in_minutes: 20 + # env: + # CLIMACORE_DISTRIBUTED: "MPI" + # NPROCS: 2 + # agents: + # slurm_ntasks: 2 + # slurm_mem: 16GB + + # - label: "MPI BCReader unit tests" + # key: "bcreader_mpi_tests" + # command: "srun julia --color=yes --project=test/ test/mpi_tests/bcreader_mpi_tests.jl --run_name bcreader_mpi --job_id bcreader_mpi" + # timeout_in_minutes: 20 + # env: + # CLIMACORE_DISTRIBUTED: "MPI" + # agents: + # slurm_ntasks: 2 + # slurm_mem: 16GB + + # - label: "MPI Checkpointer unit tests" + # key: "checkpointer_mpi_tests" + # command: "srun julia --color=yes --project=test/ test/mpi_tests/checkpointer_mpi_tests.jl --run_name checkpointer_mpi --job_id checkpointer_mpi" + # timeout_in_minutes: 20 + # env: + # CLIMACORE_DISTRIBUTED: "MPI" + # agents: + # slurm_ntasks: 2 + # slurm_mem: 16GB + + # - label: "MPI Utilities unit tests" + # key: "utilities_mpi_tests" + # command: "srun julia --color=yes --project=test/ test/utilities_tests.jl --run_name utilities_mpi --job_id utilities_mpi" + # timeout_in_minutes: 20 + # env: + # CLIMACORE_DISTRIBUTED: "MPI" + # agents: + # slurm_ntasks: 2 + # slurm_mem: 16GB + + # - label: "GPU Utilities unit tests" + # key: "utilities_gpu_tests" + # command: "srun julia --color=yes --project=test/ test/utilities_tests.jl --run_name utilities_gpu --job_id utilities_gpu" + # agents: + # slurm_mem: 5GB + # slurm_gpus: 1 + + # - label: "Perf flame graph diff tests" + # command: "julia --color=yes --project=perf/ perf/flame_test.jl --run_name flame_test --job_id flame_perf_target" + # timeout_in_minutes: 5 + # agents: + # slurm_mem: 16GB - group: "Integration Tests" steps: @@ -147,37 +147,38 @@ steps: # - input data: monotonous remapping (land mask, SST, SIC) # - slurm: unthreaded, 1 ntask # - diagnostics: check and plot energy conservation, output plots after 9 days - - label: "Slabplanet: default" - key: "slabplanet_default" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_default.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_default_artifacts/*" - agents: - slurm_mem: 20GB - - - label: "Slabplanet: default with Float32" - key: "slabplanet_ft32" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_ft32.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_ft32_artifacts/*" - agents: - slurm_mem: 20GB - - - label: "Slabplanet: partitioned turbulent fluxes" - key: "slabplanet_partitioned_fluxes" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_partitioned_fluxes.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_partitioned_fluxes_artifacts/*" - agents: - slurm_mem: 20GB - - - label: "Slabplanet: non-monotonous surface remap" - key: "slabplanet_non-monotonous" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_nonmono.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_nonmono_artifacts/*" - agents: - slurm_mem: 20GB + # - label: "Slabplanet: default" + # key: "slabplanet_default" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_default.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_default_artifacts/*" + # agents: + # slurm_mem: 20GB + + # - label: "Slabplanet: default with Float32" + # key: "slabplanet_ft32" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_ft32.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_ft32_artifacts/*" + # agents: + # slurm_mem: 20GB + + # - label: "Slabplanet: partitioned turbulent fluxes" + # key: "slabplanet_partitioned_fluxes" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_partitioned_fluxes.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_partitioned_fluxes_artifacts/*" + # agents: + # slurm_mem: 20GB + + # - label: "Slabplanet: non-monotonous surface remap" + # key: "slabplanet_non-monotonous" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_nonmono.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_nonmono_artifacts/*" + # agents: + # slurm_mem: 20GB - label: "Slabplanet: albedo from static map" + key: "slabplanet_albedo_static_map" command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_albedo_static_map.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_albedo_static_map_artifacts/total_energy*.png" + artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_albedo_static_map_artifacts/*" agents: slurm_mem: 20GB @@ -195,19 +196,19 @@ steps: agents: slurm_mem: 20GB - - label: "Slabplanet: eisenman sea ice" - key: "slabplanet_eisenman" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_eisenman.yml" - artifact_paths: "experiments/AMIP/output/slabplanet_eisenman/slabplanet_eisenman_artifacts/*" - agents: - slurm_mem: 20GB + # - label: "Slabplanet: eisenman sea ice" + # key: "slabplanet_eisenman" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_eisenman.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet_eisenman/slabplanet_eisenman_artifacts/*" + # agents: + # slurm_mem: 20GB - - label: "Slabplanet: extra atmos diagnostics" - key: "slabplanet_atmos_diags" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_atmos_diags.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_atmos_diags_artifacts/*" - agents: - slurm_mem: 20GB + # - label: "Slabplanet: extra atmos diagnostics" + # key: "slabplanet_atmos_diags" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/slabplanet_atmos_diags.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/slabplanet_atmos_diags_artifacts/*" + # agents: + # slurm_mem: 20GB # AMIP @@ -216,158 +217,187 @@ steps: # PERFORMANCE - # slabplanet default: track unthreaded performance (alloc tests, flame graph, flame graph diff, build history) - - label: ":rocket: Slabplanet: default (unthreaded)" - key: "slabplanet_unthreaded" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/default_unthreaded.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/default_unthreaded_artifacts/*" - env: - FLAME_PLOT: "" - BUILD_HISTORY_HANDLE: "" - agents: - slurm_ntasks: 1 - slurm_mem: 20GB - - - label: ":rocket: Slabplanet: default (unthreaded) - flame graph and allocation tests" - command: "julia --color=yes --project=perf perf/flame.jl --config_file $PERF_CONFIG_PATH/perf_default_unthreaded.yml" - artifact_paths: "perf/output/perf_default_unthreaded/*" - agents: - slurm_mem: 20GB - - - label: ":rocket: Slabplanet: default (unthreaded) - flame graph diff" - command: "julia --color=yes --project=perf perf/flame_diff.jl --config_file $PERF_CONFIG_PATH/perf_diff_default_unthreaded.yml" - artifact_paths: "perf/output/perf_diff_default_unthreaded/*" - agents: - slurm_mem: 20GB - - # < end Drivers for release - - # CLIMACORE EXPERIMENTS - - - label: "sea_breeze" - command: "julia --color=yes --project=experiments/ClimaCore/sea_breeze experiments/ClimaCore/sea_breeze/run.jl" - artifact_paths: "experiments/ClimaCore/sea_breeze/output/*" - agents: - slurm_mem: 20GB - - - label: "heat-diffusion" - command: "julia --color=yes --project=experiments/ClimaCore/ experiments/ClimaCore/heat-diffusion/run.jl" - artifact_paths: "experiments/ClimaCore/output/heat-diffusion_artifacts/*" - agents: - slurm_mem: 20GB - - # AMIP AND SLABPLANET EXPERIMENTS - - - label: "Moist earth with slab surface - default: monin gray no_sponge idealinsol freq_dt_cpl" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/default_mono.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/default_mono_artifacts/total_energy*.png" - agents: - slurm_mem: 20GB - - - label: "Moist earth with slab surface - notmono: monin gray no_sponge idealinsol freq_dt_cpl notmono" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/default_notmono.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/default_notmono_artifacts/total_energy*.png" - agents: - slurm_mem: 20GB - - # - label: "Moist earth with slab surface - test: monin allsky sponge idealinsol infreq_dt_cpl" - # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --FLOAT_TYPE Float64 --coupled true --surface_setup PrescribedSurface --moist equil --vert_diff true --rad allskywithclear --rayleigh_sponge true --alpha_rayleigh_uh 0 --alpha_rayleigh_w 10 --energy_check true --mode_name slabplanet --t_end 10days --dt_save_to_sol 3600secs --dt_cpl 21600 --dt 200secs --dt_rad 6hours --mono_surface true --h_elem 4 --precip_model 0M --run_name target_params_in_slab_test1 --job_id target_params_in_slab_test1" # Unconverged SF (reproduced locally); works with 200s dt_cpl - # artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab_test1_artifacts/total_energy*.png" - - - label: "Moist earth with slab surface - test: bulk allsky sponge realinsol infreq_dt_cpl" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_params_in_slab_test2.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab_test2_artifacts/total_energy*.png" - agents: - slurm_mem: 20GB - - - label: "Moist earth with slab surface - test: monin gray sponge realinsol infreq_dt_cpl" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_params_in_slab_test3.yml" - artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab_test3_artifacts/total_energy*.png" - agents: - slurm_mem: 20GB - - # breaking: - # - label: "Moist earth with slab surface - monin allsky no_sponge idealinsol infreq_dt_cpl" - # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --coupled true --surface_setup PrescribedSurface --moist equil --vert_diff true --rad allskywithclear --rayleigh_sponge false --energy_check true --mode_name slabplanet --t_end 10days --dt_save_to_sol 3600secs --dt_cpl 21600 --dt 200secs --dt_rad 6hours --idealized_insolation true --mono_surface true --h_elem 4 --precip_model 0M --run_name target_params_in_slab1" - # artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab1_artifacts/total_energy*.png" - - - label: "AMIP target: albedo from function" - key: "target_amip_albedo_function" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_amip_albedo_function.yml" - artifact_paths: "experiments/AMIP/output/amip/target_amip_albedo_function_artifacts/*" - agents: - slurm_mem: 20GB - - - label: "AMIP - Float64 + hourly checkpoint" - key: "amip" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft64_hourly_checkpoints.yml" - artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft64_hourly_checkpoints_artifacts/*" - env: - FLAME_PLOT: "" - BUILD_HISTORY_HANDLE: "" - agents: - slurm_ntasks: 1 - slurm_mem: 20GB - - - label: "AMIP - Float64 + hourly checkpoint + co2" - key: "coarse_single_ft64_hourly_checkpoints_co2" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft64_hourly_checkpoints_co2.yml" - artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft64_hourly_checkpoints_co2_artifacts/*" - env: - FLAME_PLOT: "" - BUILD_HISTORY_HANDLE: "" - agents: - slurm_ntasks: 1 - slurm_mem: 20GB - - - label: "AMIP - Float64 test" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft64.yml" - artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft64_artifacts/*" - agents: - slurm_ntasks: 1 - slurm_mem: 20GB - - - label: "AMIP - Float32 test" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft32.yml" - artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft32_artifacts/*" - agents: - slurm_ntasks: 1 - slurm_mem: 20GB - - - label: "MPI AMIP" - command: "srun julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_mpi_n2.yml" - artifact_paths: "experiments/AMIP/output/amip/coarse_mpi_n2_artifacts/*" - timeout_in_minutes: 240 - env: - CLIMACORE_DISTRIBUTED: "MPI" - agents: - slurm_ntasks: 2 - slurm_mem: 16GB - - - label: "batch script" - command: "sbatch test/mpi_tests/local_checks.sh" - - # short high-res performance test - - label: "Unthreaded AMIP FINE" # also reported by longruns with a flame graph - key: "unthreaded_amip_fine" - command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_amip_n1_shortrun.yml" - artifact_paths: "experiments/AMIP/output/amip/target_amip_n1_shortrun_artifacts/*" - env: - BUILD_HISTORY_HANDLE: "" - agents: - slurm_mem: 20GB - - # PERFORMANCE RUNS: flame graphs + allocation tests - - - label: ":rocket: flame graph and allocation tests: perf_coarse_single_ft64" - command: "julia --color=yes --project=perf perf/flame.jl --config_file $PERF_CONFIG_PATH/perf_coarse_single_ft64.yml" - artifact_paths: "perf/output/perf_coarse_single_ft64/*" - agents: - slurm_mem: 20GB - - - label: ":rocket: performance: flame graph diff: perf_diff_coarse_single_ft64" - command: "julia --color=yes --project=perf perf/flame_diff.jl --config_file $PERF_CONFIG_PATH/perf_diff_coarse_single_ft64.yml" - artifact_paths: "perf/output/perf_diff_coarse_single_ft64/*" + # # slabplanet default: track unthreaded performance (alloc tests, flame graph, flame graph diff, build history) + # - label: ":rocket: Slabplanet: default (unthreaded)" + # key: "slabplanet_unthreaded" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/default_unthreaded.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/default_unthreaded_artifacts/*" + # env: + # FLAME_PLOT: "" + # BUILD_HISTORY_HANDLE: "" + # agents: + # slurm_ntasks: 1 + # slurm_mem: 20GB + + # - label: ":rocket: Slabplanet: default (unthreaded) - flame graph and allocation tests" + # command: "julia --color=yes --project=perf perf/flame.jl --config_file $PERF_CONFIG_PATH/perf_default_unthreaded.yml" + # artifact_paths: "perf/output/perf_default_unthreaded/*" + # agents: + # slurm_mem: 20GB + + # - label: ":rocket: Slabplanet: default (unthreaded) - flame graph diff" + # command: "julia --color=yes --project=perf perf/flame_diff.jl --config_file $PERF_CONFIG_PATH/perf_diff_default_unthreaded.yml" + # artifact_paths: "perf/output/perf_diff_default_unthreaded/*" + # agents: + # slurm_mem: 20GB + + # # < end Drivers for release + + # # CLIMACORE EXPERIMENTS + + # - label: "sea_breeze" + # command: "julia --color=yes --project=experiments/ClimaCore/sea_breeze experiments/ClimaCore/sea_breeze/run.jl" + # artifact_paths: "experiments/ClimaCore/sea_breeze/output/*" + # agents: + # slurm_mem: 20GB + + # - label: "heat-diffusion" + # command: "julia --color=yes --project=experiments/ClimaCore/ experiments/ClimaCore/heat-diffusion/run.jl" + # artifact_paths: "experiments/ClimaCore/output/heat-diffusion_artifacts/*" + # agents: + # slurm_mem: 20GB + + # # AMIP AND SLABPLANET EXPERIMENTS + + # - label: "Moist earth with slab surface - default: monin gray no_sponge idealinsol freq_dt_cpl" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/default_mono.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/default_mono_artifacts/total_energy*.png" + # agents: + # slurm_mem: 20GB + + # - label: "Moist earth with slab surface - notmono: monin gray no_sponge idealinsol freq_dt_cpl notmono" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/default_notmono.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/default_notmono_artifacts/total_energy*.png" + # agents: + # slurm_mem: 20GB + + # # - label: "Moist earth with slab surface - test: monin allsky sponge idealinsol infreq_dt_cpl" + # # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --FLOAT_TYPE Float64 --coupled true --surface_setup PrescribedSurface --moist equil --vert_diff true --rad allskywithclear --rayleigh_sponge true --alpha_rayleigh_uh 0 --alpha_rayleigh_w 10 --energy_check true --mode_name slabplanet --t_end 10days --dt_save_to_sol 3600secs --dt_cpl 21600 --dt 200secs --dt_rad 6hours --mono_surface true --h_elem 4 --precip_model 0M --run_name target_params_in_slab_test1 --job_id target_params_in_slab_test1" # Unconverged SF (reproduced locally); works with 200s dt_cpl + # # artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab_test1_artifacts/total_energy*.png" + + # - label: "Moist earth with slab surface - test: bulk allsky sponge realinsol infreq_dt_cpl" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_params_in_slab_test2.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab_test2_artifacts/total_energy*.png" + # agents: + # slurm_mem: 20GB + + # - label: "Moist earth with slab surface - test: monin gray sponge realinsol infreq_dt_cpl" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_params_in_slab_test3.yml" + # artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab_test3_artifacts/total_energy*.png" + # agents: + # slurm_mem: 20GB + + # # breaking: + # # - label: "Moist earth with slab surface - monin allsky no_sponge idealinsol infreq_dt_cpl" + # # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --coupled true --surface_setup PrescribedSurface --moist equil --vert_diff true --rad allskywithclear --rayleigh_sponge false --energy_check true --mode_name slabplanet --t_end 10days --dt_save_to_sol 3600secs --dt_cpl 21600 --dt 200secs --dt_rad 6hours --idealized_insolation true --mono_surface true --h_elem 4 --precip_model 0M --run_name target_params_in_slab1" + # # artifact_paths: "experiments/AMIP/output/slabplanet/target_params_in_slab1_artifacts/total_energy*.png" + + # - label: "AMIP target: albedo from function" + # key: "target_amip_albedo_function" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_amip_albedo_function.yml" + # artifact_paths: "experiments/AMIP/output/amip/target_amip_albedo_function_artifacts/*" + # agents: + # slurm_mem: 20GB + + # - label: "AMIP - Float64 + hourly checkpoint" + # key: "amip" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft64_hourly_checkpoints.yml" + # artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft64_hourly_checkpoints_artifacts/*" + # env: + # FLAME_PLOT: "" + # BUILD_HISTORY_HANDLE: "" + # agents: + # slurm_ntasks: 1 + # slurm_mem: 20GB + + # - label: "AMIP - Float64 + hourly checkpoint + co2" + # key: "coarse_single_ft64_hourly_checkpoints_co2" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft64_hourly_checkpoints_co2.yml" + # artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft64_hourly_checkpoints_co2_artifacts/*" + # env: + # FLAME_PLOT: "" + # BUILD_HISTORY_HANDLE: "" + # agents: + # slurm_ntasks: 1 + # slurm_mem: 20GB + + # - label: "AMIP - Float64 test" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft64.yml" + # artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft64_artifacts/*" + # agents: + # slurm_ntasks: 1 + # slurm_mem: 20GB + + # - label: "AMIP - Float32 test" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_single_ft32.yml" + # artifact_paths: "experiments/AMIP/output/amip/coarse_single_ft32_artifacts/*" + # agents: + # slurm_ntasks: 1 + # slurm_mem: 20GB + + # - label: "MPI AMIP" + # command: "srun julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/coarse_mpi_n2.yml" + # artifact_paths: "experiments/AMIP/output/amip/coarse_mpi_n2_artifacts/*" + # timeout_in_minutes: 240 + # env: + # CLIMACORE_DISTRIBUTED: "MPI" + # agents: + # slurm_ntasks: 2 + # slurm_mem: 16GB + + # - label: "batch script" + # command: "sbatch test/mpi_tests/local_checks.sh" + + # # short high-res performance test + # - label: "Unthreaded AMIP FINE" # also reported by longruns with a flame graph + # key: "unthreaded_amip_fine" + # command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/target_amip_n1_shortrun.yml" + # artifact_paths: "experiments/AMIP/output/amip/target_amip_n1_shortrun_artifacts/*" + # env: + # BUILD_HISTORY_HANDLE: "" + # agents: + # slurm_mem: 20GB + + # # PERFORMANCE RUNS: flame graphs + allocation tests + + # - label: ":rocket: flame graph and allocation tests: perf_coarse_single_ft64" + # command: "julia --color=yes --project=perf perf/flame.jl --config_file $PERF_CONFIG_PATH/perf_coarse_single_ft64.yml" + # artifact_paths: "perf/output/perf_coarse_single_ft64/*" + # agents: + # slurm_mem: 20GB + + # - label: ":rocket: performance: flame graph diff: perf_diff_coarse_single_ft64" + # command: "julia --color=yes --project=perf perf/flame_diff.jl --config_file $PERF_CONFIG_PATH/perf_diff_coarse_single_ft64.yml" + # artifact_paths: "perf/output/perf_diff_coarse_single_ft64/*" + # agents: + # slurm_mem: 20GB + + # GPU COMPARISON RUNS: AMIP + - label: "AMIP test: albedo from function" + key: "amip_albedo_function" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/amip_albedo_function.yml" + artifact_paths: "experiments/AMIP/output/amip/amip_albedo_function_artifacts/*" + agents: + slurm_mem: 20GB + + - label: "AMIP target: topography and diagnostic EDMF" + key: "amip_target_topo_diagedmf_shortrun" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/amip_target_topo_diagedmf_shortrun.yml" + artifact_paths: "experiments/AMIP/output/amip/amip_target_topo_diagedmf_shortrun_artifacts/*" + agents: + slurm_mem: 20GB + + - label: "AMIP: albedo from static map" + key: "amip_albedo_static_map" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/amip_albedo_static_map.yml" + artifact_paths: "experiments/AMIP/output/amip/amip_albedo_static_map_artifacts/*" + agents: + slurm_mem: 20GB + + - label: "AMIP: albedo from temporal map" + key: "amip_albedo_temporal_map" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/coupler_driver.jl --config_file $CONFIG_PATH/amip_albedo_temporal_map.yml" + artifact_paths: "experiments/AMIP/output/amip/amip_albedo_temporal_map_artifacts/*" agents: slurm_mem: 20GB @@ -431,10 +461,59 @@ steps: slurm_mem: 20GB slurm_gpus: 1 - - - wait + - group: "CPU/GPU comparisons" + steps: + - label: "Compare Slabplanet: albedo from function" + key: "compare_slabplanet_albedo_function" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/compare_cpu_gpu.jl --cpu_run_name slabplanet_albedo_function --mode_name slabplanet" + depends_on: + - "slabplanet_albedo_function" + - "gpu_slabplanet_albedo_function" + + - label: "Compare Slabplanet: albedo from static map" + key: "compare_slabplanet_albedo_static_map" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/compare_cpu_gpu.jl --cpu_run_name slabplanet_albedo_static_map --mode_name slabplanet" + depends_on: + - "slabplanet_albedo_static_map" + - "gpu_slabplanet_albedo_static_map" + + - label: "Compare Slabplanet: albedo from temporal map" + key: "compare_slabplanet_albedo_temporal_map" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/compare_cpu_gpu.jl --cpu_run_name slabplanet_albedo_temporal_map --mode_name slabplanet" + depends_on: + - "slabplanet_albedo_temporal_map" + - "gpu_slabplanet_albedo_temporal_map" + + - label: "Compare AMIP: albedo from function" + key: "compare_amip_albedo_function" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/compare_cpu_gpu.jl --cpu_run_name amip_albedo_function --mode_name amip" + depends_on: + - "amip_albedo_function" + - "gpu_amip_albedo_function" + + - label: "Compare AMIP: albedo from static map" + key: "compare_amip_albedo_static_map" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/compare_cpu_gpu.jl --cpu_run_name amip_albedo_static_map --mode_name amip" + depends_on: + - "amip_albedo_static_map" + - "gpu_amip_albedo_static_map" + + - label: "Compare AMIP: albedo from temporal map" + key: "compare_amip_albedo_temporal_map" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/compare_cpu_gpu.jl --cpu_run_name amip_albedo_temporal_map --mode_name amip" + depends_on: + - "amip_albedo_temporal_map" + - "gpu_amip_albedo_temporal_map" + + - label: "Compare AMIP target: topography and diagnostic EDMF" + key: "compare_amip_target_topo_diagedmf_shortrun" + command: "julia --color=yes --project=experiments/AMIP/ experiments/AMIP/compare_cpu_gpu.jl --cpu_run_name amip_target_topo_diagedmf_shortrun --mode_name amip" + depends_on: + - "amip_target_topo_diagedmf_shortrun" + - "gpu_amip_target_topo_diagedmf_shortrun" + - wait # plot job performance history diff --git a/config/model_configs/amip_albedo_function.yml b/config/model_configs/amip_albedo_function.yml new file mode 100644 index 0000000000..2c1eb090d6 --- /dev/null +++ b/config/model_configs/amip_albedo_function.yml @@ -0,0 +1,22 @@ +alpha_rayleigh_uh: 0 +alpha_rayleigh_w: 10 +apply_limiter: false +dt: "150secs" +dt_cpl: 150 +dt_rad: "2days" +dt_save_to_sol: "1days" +dz_bottom: 30 +dz_top: 3000 +h_elem: 4 +job_id: "amip_albedo_function" +land_albedo_type: "function" +mode_name: "amip" +moist: "equil" +precip_model: "0M" +rad: "gray" +rayleigh_sponge: true +run_name: "amip_albedo_function" +t_end: "400secs" +vert_diff: "true" +z_elem: 50 +z_stretch: false diff --git a/config/model_configs/amip_albedo_static_map.yml b/config/model_configs/amip_albedo_static_map.yml new file mode 100644 index 0000000000..ce962bc6d9 --- /dev/null +++ b/config/model_configs/amip_albedo_static_map.yml @@ -0,0 +1,22 @@ +alpha_rayleigh_uh: 0 +alpha_rayleigh_w: 10 +apply_limiter: false +dt: "150secs" +dt_cpl: 150 +dt_rad: "2days" +dt_save_to_sol: "1days" +dz_bottom: 30 +dz_top: 3000 +h_elem: 4 +job_id: "amip_albedo_static_map" +land_albedo_type: "map_static" +mode_name: "amip" +moist: "equil" +precip_model: "0M" +rad: "gray" +rayleigh_sponge: true +run_name: "amip_albedo_static_map" +t_end: "400secs" +vert_diff: "true" +z_elem: 50 +z_stretch: false diff --git a/config/model_configs/amip_albedo_temporal_map.yml b/config/model_configs/amip_albedo_temporal_map.yml new file mode 100644 index 0000000000..50c5ab0c7a --- /dev/null +++ b/config/model_configs/amip_albedo_temporal_map.yml @@ -0,0 +1,22 @@ +alpha_rayleigh_uh: 0 +alpha_rayleigh_w: 10 +apply_limiter: false +dt: "150secs" +dt_cpl: 150 +dt_rad: "2days" +dt_save_to_sol: "1days" +dz_bottom: 30 +dz_top: 3000 +h_elem: 4 +job_id: "amip_albedo_temporal_map" +land_albedo_type: "map_temporal" +mode_name: "amip" +moist: "equil" +precip_model: "0M" +rad: "gray" +rayleigh_sponge: true +run_name: "amip_albedo_temporal_map" +t_end: "400secs" +vert_diff: "true" +z_elem: 50 +z_stretch: false diff --git a/config/model_configs/amip_target_topo_diagedmf_shortrun.yml b/config/model_configs/amip_target_topo_diagedmf_shortrun.yml new file mode 100644 index 0000000000..3b6e86d3b4 --- /dev/null +++ b/config/model_configs/amip_target_topo_diagedmf_shortrun.yml @@ -0,0 +1,26 @@ +FLOAT_TYPE: "Float32" +anim: false +apply_limiter: false +atmos_config_file: "config/longrun_configs/longrun_aquaplanet_rhoe_equil_55km_nz63_allsky_diagedmf_0M.yml" +dt: "100secs" +dt_cloud_fraction: "1hours" +dt_cpl: 100 +dt_rad: "2days" +dt_save_state_to_disk: "1days" +dt_save_to_sol: "1days" +energy_check: false +hourly_checkpoint: true +idealized_insolation: false +job_id: "amip_target_topo_diagedmf_shortrun" +land_albedo_type: "map_temporal" +mode_name: "amip" +mono_surface: false +netcdf_output_at_levels: true +run_name: "amip_target_topo_diagedmf_shortrun" +start_date: "19790301" +surface_setup: "PrescribedSurface" +t_end: "400secs" +topo_smoothing: true +topography: "Earth" +turb_flux_partition: "CombinedStateFluxes" +use_reference_state: false diff --git a/config/model_configs/gpu_amip_albedo_function.yml b/config/model_configs/gpu_amip_albedo_function.yml index 8d126c791b..a49319a92c 100644 --- a/config/model_configs/gpu_amip_albedo_function.yml +++ b/config/model_configs/gpu_amip_albedo_function.yml @@ -3,7 +3,7 @@ alpha_rayleigh_w: 10 apply_limiter: false dt: "150secs" dt_cpl: 150 -dt_rad: "1hours" +dt_rad: "2days" dt_save_to_sol: "1days" dz_bottom: 30 dz_top: 3000 @@ -16,7 +16,7 @@ precip_model: "0M" rad: "gray" rayleigh_sponge: true run_name: "gpu_amip_albedo_function" -t_end: "300secs" +t_end: "400secs" vert_diff: "true" z_elem: 50 z_stretch: false diff --git a/config/model_configs/gpu_amip_albedo_static_map.yml b/config/model_configs/gpu_amip_albedo_static_map.yml index eb95c07a72..bb64d030e9 100644 --- a/config/model_configs/gpu_amip_albedo_static_map.yml +++ b/config/model_configs/gpu_amip_albedo_static_map.yml @@ -3,7 +3,7 @@ alpha_rayleigh_w: 10 apply_limiter: false dt: "150secs" dt_cpl: 150 -dt_rad: "1hours" +dt_rad: "2days" dt_save_to_sol: "1days" dz_bottom: 30 dz_top: 3000 @@ -16,7 +16,7 @@ precip_model: "0M" rad: "gray" rayleigh_sponge: true run_name: "gpu_amip_albedo_static_map" -t_end: "300secs" +t_end: "400secs" vert_diff: "true" z_elem: 50 z_stretch: false diff --git a/config/model_configs/gpu_amip_albedo_temporal_map.yml b/config/model_configs/gpu_amip_albedo_temporal_map.yml index 084eeb0e2b..304a277ee9 100644 --- a/config/model_configs/gpu_amip_albedo_temporal_map.yml +++ b/config/model_configs/gpu_amip_albedo_temporal_map.yml @@ -3,7 +3,7 @@ alpha_rayleigh_w: 10 apply_limiter: false dt: "150secs" dt_cpl: 150 -dt_rad: "1hours" +dt_rad: "2days" dt_save_to_sol: "1days" dz_bottom: 30 dz_top: 3000 @@ -16,7 +16,7 @@ precip_model: "0M" rad: "gray" rayleigh_sponge: true run_name: "gpu_amip_albedo_temporal_map" -t_end: "300secs" +t_end: "400secs" vert_diff: "true" z_elem: 50 z_stretch: false diff --git a/config/model_configs/gpu_amip_target_topo_diagedmf_shortrun.yml b/config/model_configs/gpu_amip_target_topo_diagedmf_shortrun.yml index 129e3f7409..8a0408c70f 100644 --- a/config/model_configs/gpu_amip_target_topo_diagedmf_shortrun.yml +++ b/config/model_configs/gpu_amip_target_topo_diagedmf_shortrun.yml @@ -5,7 +5,7 @@ atmos_config_file: "config/longrun_configs/longrun_aquaplanet_rhoe_equil_55km_nz dt: "100secs" dt_cloud_fraction: "1hours" dt_cpl: 100 -dt_rad: "1hours" +dt_rad: "2days" dt_save_state_to_disk: "1days" dt_save_to_sol: "1days" energy_check: false @@ -19,7 +19,7 @@ netcdf_output_at_levels: true run_name: "gpu_amip_target_topo_diagedmf_shortrun" start_date: "19790301" surface_setup: "PrescribedSurface" -t_end: "200secs" +t_end: "400secs" topo_smoothing: true topography: "Earth" turb_flux_partition: "CombinedStateFluxes" diff --git a/config/model_configs/gpu_slabplanet_albedo_function.yml b/config/model_configs/gpu_slabplanet_albedo_function.yml index e9ee5ede71..18603df6b9 100644 --- a/config/model_configs/gpu_slabplanet_albedo_function.yml +++ b/config/model_configs/gpu_slabplanet_albedo_function.yml @@ -2,6 +2,7 @@ apply_limiter: false conservation_softfail: true dt: "200secs" dt_cpl: 200 +dt_rad: "2days" dt_save_to_sol: "3600secs" energy_check: true h_elem: 4 @@ -13,5 +14,5 @@ mono_surface: true precip_model: "0M" rad: "gray" run_name: "gpu_slabplanet_albedo_function" -t_end: "10days" +t_end: "400secs" vert_diff: "true" diff --git a/config/model_configs/gpu_slabplanet_albedo_static_map.yml b/config/model_configs/gpu_slabplanet_albedo_static_map.yml index 82969cb066..19a8a08e99 100644 --- a/config/model_configs/gpu_slabplanet_albedo_static_map.yml +++ b/config/model_configs/gpu_slabplanet_albedo_static_map.yml @@ -2,6 +2,7 @@ apply_limiter: false conservation_softfail: true dt: "200secs" dt_cpl: 200 +dt_rad: "2days" dt_save_to_sol: "3600secs" energy_check: true h_elem: 4 @@ -13,5 +14,5 @@ mono_surface: true precip_model: "0M" rad: "gray" run_name: "gpu_slabplanet_albedo_static_map" -t_end: "10days" +t_end: "400secs" vert_diff: "true" diff --git a/config/model_configs/gpu_slabplanet_albedo_temporal_map.yml b/config/model_configs/gpu_slabplanet_albedo_temporal_map.yml index c263918c09..6c1302b359 100644 --- a/config/model_configs/gpu_slabplanet_albedo_temporal_map.yml +++ b/config/model_configs/gpu_slabplanet_albedo_temporal_map.yml @@ -2,6 +2,7 @@ apply_limiter: false conservation_softfail: true dt: "200secs" dt_cpl: 200 +dt_rad: "2days" dt_save_to_sol: "3600secs" energy_check: true h_elem: 4 @@ -13,5 +14,5 @@ mono_surface: true precip_model: "0M" rad: "gray" run_name: "gpu_slabplanet_albedo_temporal_map" -t_end: "10days" +t_end: "400secs" vert_diff: "true" diff --git a/config/model_configs/slabplanet_albedo_function.yml b/config/model_configs/slabplanet_albedo_function.yml index 7d4b024879..70a44dd3ad 100644 --- a/config/model_configs/slabplanet_albedo_function.yml +++ b/config/model_configs/slabplanet_albedo_function.yml @@ -1,6 +1,7 @@ apply_limiter: false dt: "200secs" dt_cpl: 200 +dt_rad: "2days" dt_save_to_sol: "3600secs" energy_check: true h_elem: 4 @@ -12,5 +13,5 @@ mono_surface: true precip_model: "0M" rad: "gray" run_name: "slabplanet_albedo_function" -t_end: "10days" +t_end: "400secs" vert_diff: "true" diff --git a/config/model_configs/slabplanet_albedo_static_map.yml b/config/model_configs/slabplanet_albedo_static_map.yml index cb4d9936ce..080a5f5d93 100644 --- a/config/model_configs/slabplanet_albedo_static_map.yml +++ b/config/model_configs/slabplanet_albedo_static_map.yml @@ -1,6 +1,7 @@ apply_limiter: false dt: "200secs" dt_cpl: 200 +dt_rad: "2days" dt_save_to_sol: "3600secs" energy_check: true h_elem: 4 @@ -12,5 +13,5 @@ mono_surface: true precip_model: "0M" rad: "gray" run_name: "slabplanet_albedo_static_map" -t_end: "10days" +t_end: "400secs" vert_diff: "true" diff --git a/config/model_configs/slabplanet_albedo_temporal_map.yml b/config/model_configs/slabplanet_albedo_temporal_map.yml index 22bb505c97..78334b5792 100644 --- a/config/model_configs/slabplanet_albedo_temporal_map.yml +++ b/config/model_configs/slabplanet_albedo_temporal_map.yml @@ -1,6 +1,7 @@ apply_limiter: false dt: "200secs" dt_cpl: 200 +dt_rad: "2days" dt_save_to_sol: "3600secs" energy_check: true h_elem: 4 @@ -12,5 +13,5 @@ mono_surface: true precip_model: "0M" rad: "gray" run_name: "slabplanet_albedo_temporal_map" -t_end: "10days" +t_end: "400secs" vert_diff: "true" diff --git a/experiments/AMIP/Manifest.toml b/experiments/AMIP/Manifest.toml index e1cbe1ea60..88d7385934 100644 --- a/experiments/AMIP/Manifest.toml +++ b/experiments/AMIP/Manifest.toml @@ -1,8 +1,8 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.2" +julia_version = "1.10.0" manifest_format = "2.0" -project_hash = "284db48dcd39d58ad8518daa0c1caded1552fa4a" +project_hash = "e7c2a82f22e8619878a7097e9408358ac0f56ac0" [[deps.ADTypes]] git-tree-sha1 = "016833eb52ba2d6bea9fcb50ca295980e728ee24" @@ -150,9 +150,9 @@ version = "0.4.2" [[deps.BandedMatrices]] deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra", "PrecompileTools"] -git-tree-sha1 = "fe7ed7b33416db994f706f66e31bbd1b378f71b7" +git-tree-sha1 = "c946c5014cf4cdbfacacb363b110e7bffba3e742" uuid = "aae01518-5342-5314-be14-df237901396f" -version = "1.6.0" +version = "1.6.1" weakdeps = ["SparseArrays"] [deps.BandedMatrices.extensions] @@ -397,9 +397,9 @@ weakdeps = ["ClimaParams"] [[deps.ClimaParams]] deps = ["DocStringExtensions", "TOML", "Test"] -git-tree-sha1 = "ec67949db856e01df4cbf7d6ddafefeda02f93ee" +git-tree-sha1 = "1a3d2455fff201bcf130bbd5a71ac16fc3c21fd1" uuid = "5c42b081-d73a-476f-9059-fd94b934656c" -version = "0.10.3" +version = "0.10.4" [[deps.ClimaTimeSteppers]] deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"] @@ -500,7 +500,7 @@ weakdeps = ["Dates", "LinearAlgebra"] [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.1.0+0" +version = "1.0.5+1" [[deps.CompositionsBase]] git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad" @@ -521,9 +521,9 @@ version = "2.4.1" [[deps.ConstructionBase]] deps = ["LinearAlgebra"] -git-tree-sha1 = "c53fc348ca4d40d7b371e71fd52251839080cbc9" +git-tree-sha1 = "260fd2400ed2dab602a7c15cf10c1933c59930a2" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" -version = "1.5.4" +version = "1.5.5" weakdeps = ["IntervalSets", "StaticArrays"] [deps.ConstructionBase.extensions] @@ -850,9 +850,9 @@ version = "0.3.1" [[deps.FileIO]] deps = ["Pkg", "Requires", "UUIDs"] -git-tree-sha1 = "c5c28c245101bd59154f649e19b038d15901b5dc" +git-tree-sha1 = "82d8afa92ecf4b52d78d869f038ebfb881267322" uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" -version = "1.16.2" +version = "1.16.3" [[deps.FilePaths]] deps = ["FilePathsBase", "MacroTools", "Reexport", "Requires"] @@ -905,9 +905,9 @@ version = "0.8.4" [[deps.Flux]] deps = ["Adapt", "ChainRulesCore", "Compat", "Functors", "LinearAlgebra", "MLUtils", "MacroTools", "NNlib", "OneHotArrays", "Optimisers", "Preferences", "ProgressLogging", "Random", "Reexport", "SparseArrays", "SpecialFunctions", "Statistics", "Zygote"] -git-tree-sha1 = "5a626d6ef24ae0a8590c22dc12096fb65eb66325" +git-tree-sha1 = "502d0232ec6430d40b6e5b57637333f32192592e" uuid = "587475ba-b771-5e3f-ad9e-33799f191a9c" -version = "0.14.13" +version = "0.14.14" [deps.Flux.extensions] FluxAMDGPUExt = "AMDGPU" @@ -1127,9 +1127,9 @@ version = "1.3.14+0" [[deps.GridLayoutBase]] deps = ["GeometryBasics", "InteractiveUtils", "Observables"] -git-tree-sha1 = "af13a277efd8a6e716d79ef635d5342ccb75be61" +git-tree-sha1 = "6f93a83ca11346771a93bbde2bdad2f65b61498f" uuid = "3955a311-db13-416c-9275-1d80ed98e5e9" -version = "0.10.0" +version = "0.10.2" [[deps.Grisu]] git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2" @@ -1154,9 +1154,9 @@ version = "1.14.3+1" [[deps.HTTP]] deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] -git-tree-sha1 = "db864f2d91f68a5912937af80327d288ea1f3aee" +git-tree-sha1 = "995f762e0182ebc50548c434c171a5bb6635f8e4" uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" -version = "1.10.3" +version = "1.10.4" [[deps.HarfBuzz_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"] @@ -1430,9 +1430,9 @@ version = "3.0.0+1" [[deps.LLVM]] deps = ["CEnum", "LLVMExtra_jll", "Libdl", "Preferences", "Printf", "Requires", "Unicode"] -git-tree-sha1 = "ddab4d40513bce53c8e3157825e245224f74fae7" +git-tree-sha1 = "7c6650580b4c3169d9905858160db895bff6d2e2" uuid = "929cbde3-209d-540e-8aea-75f648917ca0" -version = "6.6.0" +version = "6.6.1" weakdeps = ["BFloat16s"] [deps.LLVM.extensions] @@ -1926,7 +1926,7 @@ version = "0.3.24+0" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.23+4" +version = "0.3.23+2" [[deps.OpenEXR]] deps = ["Colors", "FileIO", "OpenEXR_jll"] @@ -2119,9 +2119,9 @@ version = "1.40.2" [[deps.Polyester]] deps = ["ArrayInterface", "BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "ManualMemory", "PolyesterWeave", "Requires", "Static", "StaticArrayInterface", "StrideArraysCore", "ThreadingUtilities"] -git-tree-sha1 = "fca25670784a1ae44546bcb17288218310af2778" +git-tree-sha1 = "8df43bbe60029526dd628af7e9951f5af680d4d7" uuid = "f517fe37-dbe3-4b94-8317-1923a5111588" -version = "0.7.9" +version = "0.7.10" [[deps.PolyesterWeave]] deps = ["BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "Static", "ThreadingUtilities"] @@ -2405,10 +2405,10 @@ uuid = "76ed43ae-9a5d-5a62-8c75-30186b810ce8" version = "3.45.0+0" [[deps.SciMLBase]] -deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] -git-tree-sha1 = "3a281a9fce9cd62b849d7f16e412933a5fe755cb" +deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] +git-tree-sha1 = "48f724c6a3355f11dae5f762983073d367c8b934" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.29.0" +version = "2.30.1" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -2435,6 +2435,11 @@ git-tree-sha1 = "10499f619ef6e890f3f4a38914481cc868689cd5" uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" version = "0.3.8" +[[deps.SciMLStructures]] +git-tree-sha1 = "5833c10ce83d690c124beedfe5f621b50b02ba4d" +uuid = "53ae85a6-f571-4167-b2af-e1d143709226" +version = "1.1.0" + [[deps.Scratch]] deps = ["Dates"] git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386" @@ -2791,9 +2796,9 @@ uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" version = "0.5.23" [[deps.TranscodingStreams]] -git-tree-sha1 = "3caa21522e7efac1ba21834a03734c57b4611c7e" +git-tree-sha1 = "a09c933bebed12501890d8e92946bbab6a1690f1" uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" -version = "0.10.4" +version = "0.10.5" weakdeps = ["Random", "Test"] [deps.TranscodingStreams.extensions] diff --git a/experiments/AMIP/Project.toml b/experiments/AMIP/Project.toml index f0c30ae8f2..9af3accdce 100644 --- a/experiments/AMIP/Project.toml +++ b/experiments/AMIP/Project.toml @@ -15,6 +15,7 @@ ClimaParams = "5c42b081-d73a-476f-9059-fd94b934656c" ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79" CloudMicrophysics = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" +DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" Dierckx = "39dd38d3-220a-591b-8e3c-4c3a8c710a94" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" diff --git a/experiments/AMIP/compare_cpu_gpu.jl b/experiments/AMIP/compare_cpu_gpu.jl new file mode 100644 index 0000000000..620b4adee2 --- /dev/null +++ b/experiments/AMIP/compare_cpu_gpu.jl @@ -0,0 +1,111 @@ +import DelimitedFiles as DLM +using Statistics +import ClimaCoupler +import ArgParse + +function argparse_settings() + s = ArgParse.ArgParseSettings() + ArgParse.@add_arg_table! s begin + "--cpu_run_name" + help = "The name of the CPU run we want to compare. User must specify CPU and/or GPU run name." + arg_type = String + default = nothing + "--gpu_run_name" + help = "The name of the GPU run we want to compare." + arg_type = String + default = nothing + "--mode_name" + help = "The mode of the simulations being compared (`slabplanet` or `AMIP`)." + arg_type = String + default = nothing + "--coupler_output_dir" + help = "Directory to save output files." + arg_type = String + default = "experiments/AMIP/output" + end + return s +end + +# Read in CPU and GPU run name info from command line +parsed_args = ArgParse.parse_args(ARGS, argparse_settings()) +cpu_run_name = parsed_args["cpu_run_name"] +gpu_run_name = parsed_args["gpu_run_name"] +if isnothing(cpu_run_name) && isnothing(gpu_run_name) + error("Must pass CPU and/or GPU run name to compare them.") +elseif isnothing(gpu_run_name) + gpu_run_name = "gpu_" * cpu_run_name +elseif isnothing(cpu_run_name) + cpu_run_name = gpu_run_name[5:end] +end + +# Read in mode name from command line (or retrieve from run name) +mode_name = parsed_args["mode_name"] +if isnothing(mode_name) + mode_name = + occursin("amip", cpu_run_name) ? "amip" : + (occursin("slabplanet", cpu_run_name) ? "slabplanet" : error("Please provide a valid `mode_name`.")) +end + +# Construct CPU and GPU artifacts directories +output_dir = parsed_args["coupler_output_dir"] +cpu_artifacts_dir = joinpath(output_dir, joinpath(mode_name, cpu_run_name)) * "_artifacts" +gpu_artifacts_dir = joinpath(output_dir, joinpath(mode_name, gpu_run_name)) * "_artifacts" + + +# Read in and compare atmos state variables on centers and on faces +cpu_atmos_state_center = DLM.readdlm(joinpath(cpu_artifacts_dir, "atmos_state_center_tend_cpu.txt"), ',') +gpu_atmos_state_center = DLM.readdlm(joinpath(gpu_artifacts_dir, "atmos_state_center_tend_gpu.txt"), ',') + +@show abs(maximum(cpu_atmos_state_center .- gpu_atmos_state_center)) +@show abs(median(cpu_atmos_state_center .- gpu_atmos_state_center)) +@show abs(mean(cpu_atmos_state_center .- gpu_atmos_state_center)) +atmos_center_approx = isapprox(cpu_atmos_state_center, gpu_atmos_state_center) + +cpu_atmos_state_face = DLM.readdlm(joinpath(cpu_artifacts_dir, "atmos_state_face_tend_cpu.txt"), ',') +gpu_atmos_state_face = DLM.readdlm(joinpath(gpu_artifacts_dir, "atmos_state_face_tend_gpu.txt"), ',') + +@show abs(maximum(cpu_atmos_state_face .- gpu_atmos_state_face)) +@show abs(median(cpu_atmos_state_face .- gpu_atmos_state_face)) +@show abs(mean(cpu_atmos_state_face .- gpu_atmos_state_face)) +println() +atmos_face_approx = isapprox(cpu_atmos_state_face, gpu_atmos_state_face) + + +# Read in and compare land state variables on 3D space and 2D space +cpu_land_state_3d = DLM.readdlm(joinpath(cpu_artifacts_dir, "land_state_3d_tend_cpu.txt"), ',') +gpu_land_state_3d = DLM.readdlm(joinpath(gpu_artifacts_dir, "land_state_3d_tend_gpu.txt"), ',') + +@show abs(maximum(cpu_land_state_3d .- gpu_land_state_3d)) +@show abs(median(cpu_land_state_3d .- gpu_land_state_3d)) +@show abs(mean(cpu_land_state_3d .- gpu_land_state_3d)) +land_3d_approx = isapprox(cpu_land_state_3d, gpu_land_state_3d) + +cpu_land_state_2d = DLM.readdlm(joinpath(cpu_artifacts_dir, "land_state_2d_tend_cpu.txt"), ',') +gpu_land_state_2d = DLM.readdlm(joinpath(gpu_artifacts_dir, "land_state_2d_tend_gpu.txt"), ',') + +@show abs(maximum(cpu_land_state_2d .- gpu_land_state_2d)) +@show abs(median(cpu_land_state_2d .- gpu_land_state_2d)) +@show abs(mean(cpu_land_state_2d .- gpu_land_state_2d)) +println() +land_2d_approx = isapprox(cpu_land_state_2d, gpu_land_state_2d) + + +# Read in ocean state variables (if not AMIP) +ocean_approx = true +if !(mode_name == "amip") + cpu_ocean_state = DLM.readdlm(joinpath(cpu_artifacts_dir, "ocean_state_tend_cpu.txt"), ',') + gpu_ocean_state = DLM.readdlm(joinpath(gpu_artifacts_dir, "ocean_state_tend_gpu.txt"), ',') + + @show abs(maximum(cpu_ocean_state .- gpu_ocean_state)) + @show abs(median(cpu_ocean_state .- gpu_ocean_state)) + @show abs(mean(cpu_ocean_state .- gpu_ocean_state)) + ocean_approx = isapprox(cpu_ocean_state, gpu_ocean_state) +end + +# Output warning for each component model if not equal +!atmos_center_approx || !atmos_face_approx ? @warn("atmos states not equal") : nothing +!land_2d_approx || !land_3d_approx ? @warn("land states not equal") : nothing +!ocean_approx ? @warn("ocean states not equal") : nothing + +# Assert all states are equal at the end so we still check all of them +@assert atmos_center_approx && atmos_face_approx && land_3d_approx && land_2d_approx && ocean_approx diff --git a/experiments/AMIP/coupler_driver.jl b/experiments/AMIP/coupler_driver.jl index 8fff9b38c8..1055d15b37 100644 --- a/experiments/AMIP/coupler_driver.jl +++ b/experiments/AMIP/coupler_driver.jl @@ -39,6 +39,7 @@ We then specify the input data file names. If these are not already downloaded, ## standard packages using Dates import YAML +import DelimitedFiles as DLM # ## ClimaESM packages import ClimaAtmos as CA @@ -98,8 +99,9 @@ include("cli_options.jl") parsed_args = parse_commandline(argparse_settings()) ## modify parsed args for fast testing from REPL #hide +include("user_io/debug_plots.jl") +pkg_dir = pkgdir(ClimaCoupler) if isinteractive() - include("user_io/debug_plots.jl") parsed_args["config_file"] = isnothing(parsed_args["config_file"]) ? joinpath(pkg_dir, "config/model_configs/interactive_debug.yml") : parsed_args["config_file"] @@ -124,8 +126,9 @@ const FT = config_dict["FLOAT_TYPE"] == "Float64" ? Float64 : Float32 land_sim_name = "bucket" t_end = Float64(time_to_seconds(config_dict["t_end"])) t_start = 0.0 -tspan = (t_start, t_end) Δt_cpl = Float64(config_dict["dt_cpl"]) +# t_end = Δt_cpl +tspan = (t_start, t_end) saveat = Float64(time_to_seconds(config_dict["dt_save_to_sol"])) date0 = date = DateTime(config_dict["start_date"], dateformat"yyyymmdd") mono_surface = config_dict["mono_surface"] @@ -173,6 +176,10 @@ The data files are downloaded from the `ClimaCoupler` artifacts directory. If th original sources. =# +debug_dir = COUPLER_ARTIFACTS_DIR +isdir(debug_dir) ? nothing : mkpath(debug_dir) + +# get the paths to the necessary data files: land-sea mask, sst map, sea ice concentration include(joinpath(pkgdir(ClimaCoupler), "artifacts", "artifact_funcs.jl")) sst_data = joinpath(sst_dataset_path(), "sst.nc") sic_data = joinpath(sic_dataset_path(), "sic.nc") @@ -567,6 +574,8 @@ cs = CoupledSimulation{FT}( thermo_params, ); +debug(cs, debug_dir * "/0_initialized_cs_") + #= ## Restart component model states if specified If a restart directory is specified and contains output files from the `checkpoint_cb` callback, the component model states are restarted from those files. The restart directory @@ -591,18 +600,21 @@ The concrete steps for proper initialization are: # 1.coupler updates surface model area fractions update_surface_fractions!(cs) +debug(cs, debug_dir * "/2_surface_fraction_update_") # 2.surface density (`ρ_sfc`): calculated by the coupler by adiabatically extrapolating atmospheric thermal state to the surface. # For this, we need to import surface and atmospheric fields. The model sims are then updated with the new surface density. import_combined_surface_fields!(cs.fields, cs.model_sims, cs.boundary_space, cs.turbulent_fluxes) import_atmos_fields!(cs.fields, cs.model_sims, cs.boundary_space, cs.turbulent_fluxes) update_model_sims!(cs.model_sims, cs.fields, cs.turbulent_fluxes) +debug(cs, debug_dir * "/3_update_sims_") # 3.surface vapor specific humidity (`q_sfc`): step surface models with the new surface density to calculate their respective `q_sfc` internally ## TODO: the q_sfc calculation follows the design of the bucket q_sfc, but it would be neater to abstract this from step! (#331) step!(land_sim, Δt_cpl) step!(ocean_sim, Δt_cpl) step!(ice_sim, Δt_cpl) +debug(cs, debug_dir * "/4_step_surface_models_") # 4.turbulent fluxes: now we have all information needed for calculating the initial turbulent surface fluxes using the combined state # or the partitioned state method @@ -621,9 +633,11 @@ elseif cs.turbulent_fluxes isa PartitionedStateFluxes CA.SurfaceConditions.update_surface_conditions!(atmos_sim.integrator.u, new_p, atmos_sim.integrator.t) ## sets T_sfc (but SF calculation not necessary - requires split functionality in CA) atmos_sim.integrator.p.precomputed.sfc_conditions .= new_p.precomputed.sfc_conditions end +debug(cs, debug_dir * "/5_after_turb_fluxes_") # 5.reinitialize models + radiative flux: prognostic states and time are set to their initial conditions. For atmos, this also triggers the callbacks and sets a nonzero radiation flux (given the new sfc_conditions) reinit_model_sims!(cs.model_sims) +debug(cs, debug_dir * "/6_after_reinit_") # 6.update all fluxes: coupler re-imports updated atmos fluxes (radiative fluxes for both `turbulent_fluxes` types # and also turbulent fluxes if `turbulent_fluxes isa CombinedStateFluxes`, @@ -632,6 +646,8 @@ reinit_model_sims!(cs.model_sims) import_atmos_fields!(cs.fields, cs.model_sims, cs.boundary_space, cs.turbulent_fluxes) update_model_sims!(cs.model_sims, cs.fields, cs.turbulent_fluxes) +debug(cs, debug_dir * "/7_import_atmos_fluxes_") + #= ## Coupling Loop @@ -646,8 +662,9 @@ function solve_coupler!(cs) ClimaComms.iamroot(comms_ctx) ? @info("Starting coupling loop") : nothing ## step in time walltime = @elapsed for t in ((tspan[begin] + Δt_cpl):Δt_cpl:tspan[end]) + cs.dates.date[1] = current_date(cs, t) # if not global, `date` is not updated. - cs.dates.date[1] = current_date(cs, t) + debug(cs, debug_dir * "/9_coupler_loop_$t") ## print date on the first of month if cs.dates.date[1] >= cs.dates.date1[1] @@ -741,6 +758,8 @@ end #hide ## run the coupled simulation solve_coupler!(cs); +debug(cs, debug_dir * "/8_after_solve_") + #= ## Postprocessing Currently all postprocessing is performed using the root process only. @@ -748,6 +767,59 @@ Currently all postprocessing is performed using the root process only. if ClimaComms.iamroot(comms_ctx) + # Save states after simulation for CPU/GPU comparison + device_suffix = comms_ctx.device isa ClimaComms.AbstractCPUDevice ? "cpu" : "gpu" + + # Extract atmos state variables + atmos_ρe_tot = cs.model_sims.atmos_sim.integrator.u.c.ρe_tot + atmos_ρq_tot = cs.model_sims.atmos_sim.integrator.u.c.ρq_tot + atmos_ρ = cs.model_sims.atmos_sim.integrator.u.c.ρ + atmos_uₕ = cs.model_sims.atmos_sim.integrator.u.c.uₕ + atmos_u₃ = cs.model_sims.atmos_sim.integrator.u.f.u₃ + + # Write to text files + open(joinpath(COUPLER_ARTIFACTS_DIR, "atmos_state_center_tend_$device_suffix.txt"), "w") do io + DLM.writedlm( + io, + hcat( + Array(parent(atmos_ρe_tot))[:], + Array(parent(atmos_ρq_tot))[:], + Array(parent(atmos_ρ))[:], + Array(parent(atmos_uₕ.components))[:, :, :, 1, :][:], + Array(parent(atmos_uₕ.components))[:, :, :, 2, :][:], + ), + ',', + ) + end; + + open(joinpath(COUPLER_ARTIFACTS_DIR, "atmos_state_face_tend_$device_suffix.txt"), "w") do io + DLM.writedlm(io, Array(parent(atmos_u₃))[:], ',') + end; + + # Extract land state variables + land_T = cs.model_sims.land_sim.integrator.u.bucket.T + land_W = cs.model_sims.land_sim.integrator.u.bucket.W + land_Ws = cs.model_sims.land_sim.integrator.u.bucket.Ws + land_σS = cs.model_sims.land_sim.integrator.u.bucket.σS + + # Write to text files + open(joinpath(COUPLER_ARTIFACTS_DIR, "land_state_3d_tend_$device_suffix.txt"), "w") do io + DLM.writedlm(io, Array(parent(land_T))[:], ',') + end; + open(joinpath(COUPLER_ARTIFACTS_DIR, "land_state_2d_tend_$device_suffix.txt"), "w") do io + DLM.writedlm(io, hcat(Array(parent(land_W))[:], Array(parent(land_Ws))[:], Array(parent(land_σS))[:]), ',') + end; + + # ocean state + if cs.mode.name != "amip" + ocean_T_sfc = cs.model_sims.ocean_sim.integrator.u.T_sfc + + # Write to text files + open(joinpath(COUPLER_ARTIFACTS_DIR, "ocean_state_tend_$device_suffix.txt"), "w") do io + DLM.writedlm(io, Array(parent(ocean_T_sfc))[:], ',') + end + end; + ## energy check plots if !isnothing(cs.conservation_checks) && cs.mode.name[1:10] == "slabplanet" @info "Conservation Check Plots" diff --git a/experiments/AMIP/debug_cpu-gpu.jl b/experiments/AMIP/debug_cpu-gpu.jl new file mode 100644 index 0000000000..c02fbd7fcd --- /dev/null +++ b/experiments/AMIP/debug_cpu-gpu.jl @@ -0,0 +1,88 @@ +using ClimaComms +using ClimaCore: InputOutput, Fields +using Statistics + +# atmos rho e +varname = "atmos_ρe_tot" +comms_ctx = ClimaComms.SingletonCommsContext() + +cpu_filename = "experiments/AMIP/cpu-gpu_temporalmap/cpu_temporalmap_atmos_ρe_tot_1979-01-01T00-03-20.hdf5" +cpu_hdf5reader = InputOutput.HDF5Reader(cpu_filename, comms_ctx) +cpu_atmos_ρe_tot = InputOutput.read_field(cpu_hdf5reader, varname) +close(cpu_hdf5reader) + +gpu_filename = "experiments/AMIP/cpu-gpu_temporalmap/gpu_temporalmap_atmos_ρe_tot_1979-01-01T00-03-20.hdf5" +gpu_hdf5reader = InputOutput.HDF5Reader(gpu_filename, comms_ctx) +gpu_atmos_ρe_tot = InputOutput.read_field(gpu_hdf5reader, varname) +close(gpu_hdf5reader) + +cpu_atmos_ρe_tot == gpu_atmos_ρe_tot # false +abs(mean(parent(cpu_atmos_ρe_tot)) - mean(parent(gpu_atmos_ρe_tot))) < eps(Float64) # false temporal map (3.64e-12), true function + +# atmos rho q +varname = "atmos_ρq_tot" +comms_ctx = ClimaComms.SingletonCommsContext() + +cpu_filename = "experiments/AMIP/cpu_function_atmos_ρq_tot_1979-01-01T00-03-20.hdf5" +cpu_hdf5reader = InputOutput.HDF5Reader(cpu_filename, comms_ctx) +cpu_atmos_ρq_tot = InputOutput.read_field(cpu_hdf5reader, varname) +close(cpu_hdf5reader) + +gpu_filename = "experiments/AMIP/gpu_function_atmos_ρq_tot_1979-01-01T00-03-20.hdf5" +gpu_hdf5reader = InputOutput.HDF5Reader(gpu_filename, comms_ctx) +gpu_atmos_ρq_tot = InputOutput.read_field(gpu_hdf5reader, varname) +close(gpu_hdf5reader) + +cpu_atmos_ρq_tot == gpu_atmos_ρq_tot # false temporal map, true function +abs(mean(parent(cpu_atmos_ρq_tot)) - mean(parent(gpu_atmos_ρq_tot))) < eps(Float64) # true + +# land temp +varname = "land_T" +comms_ctx = ClimaComms.SingletonCommsContext() + +cpu_filename = "experiments/AMIP/cpu_function_land_T_1979-01-01T00-03-20.hdf5" +cpu_hdf5reader = InputOutput.HDF5Reader(cpu_filename, comms_ctx) +cpu_land_T = InputOutput.read_field(cpu_hdf5reader, varname) +close(cpu_hdf5reader) + +gpu_filename = "experiments/AMIP/gpu_function_land_T_1979-01-01T00-03-20.hdf5" +gpu_hdf5reader = InputOutput.HDF5Reader(gpu_filename, comms_ctx) +gpu_land_T = InputOutput.read_field(gpu_hdf5reader, varname) +close(gpu_hdf5reader) + +cpu_land_T == gpu_land_T # false +abs(mean(parent(cpu_land_T)) - mean(parent(gpu_land_T))) < eps(Float64) # true + +# land water +varname = "land_W" +comms_ctx = ClimaComms.SingletonCommsContext() + +cpu_filename = "experiments/AMIP/cpu_function_land_W_1979-01-01T00-03-20.hdf5" +cpu_hdf5reader = InputOutput.HDF5Reader(cpu_filename, comms_ctx) +cpu_land_W = InputOutput.read_field(cpu_hdf5reader, varname) +close(cpu_hdf5reader) + +gpu_filename = "experiments/AMIP/gpu_function_land_W_1979-01-01T00-03-20.hdf5" +gpu_hdf5reader = InputOutput.HDF5Reader(gpu_filename, comms_ctx) +gpu_land_W = InputOutput.read_field(gpu_hdf5reader, varname) +close(gpu_hdf5reader) + +cpu_land_W == gpu_land_W # false +abs(mean(parent(cpu_land_W)) - mean(parent(gpu_land_W))) < eps(Float64) # true + +# ocean temp +varname = "ocean_T_sfc" +comms_ctx = ClimaComms.SingletonCommsContext() + +cpu_filename = "experiments/AMIP/cpu_function_ocean_T_sfc_1979-01-01T00-03-20.hdf5" +cpu_hdf5reader = InputOutput.HDF5Reader(cpu_filename, comms_ctx) +cpu_ocean_T_sfc = InputOutput.read_field(cpu_hdf5reader, varname) +close(cpu_hdf5reader) + +gpu_filename = "experiments/AMIP/gpu_function_ocean_T_sfc_1979-01-01T00-03-20.hdf5" +gpu_hdf5reader = InputOutput.HDF5Reader(gpu_filename, comms_ctx) +gpu_ocean_T_sfc = InputOutput.read_field(gpu_hdf5reader, varname) +close(gpu_hdf5reader) + +cpu_ocean_T_sfc == gpu_ocean_T_sfc # false +abs(mean(parent(cpu_ocean_T_sfc)) - mean(parent(gpu_ocean_T_sfc))) < eps(Float64) # true temporal map, false function (1.13e-13) diff --git a/experiments/AMIP/user_io/debug_plots.jl b/experiments/AMIP/user_io/debug_plots.jl index c4f5f6b8c6..2dbd74c0cc 100644 --- a/experiments/AMIP/user_io/debug_plots.jl +++ b/experiments/AMIP/user_io/debug_plots.jl @@ -2,6 +2,7 @@ using Plots using ClimaCorePlots using Printf using ClimaCoupler.Interfacer: ComponentModelSimulation, SurfaceModelSimulation +using ClimaCoupler: TestHelper using ClimaCore # plotting functions for the coupled simulation @@ -11,8 +12,8 @@ using ClimaCore Plot the fields of a coupled simulation and save plots to a directory. """ function debug(cs::CoupledSimulation, dir = "debug", cs_fields_ref = nothing) - mkpath(dir) - @info "plotting debug in " * dir + # mkpath(dir) + # @info "plotting debug in " * dir for sim in cs.model_sims debug(sim, dir) end @@ -42,31 +43,89 @@ function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing) :z0m_S, ) all_plots = [] + cpu_comms_ctx = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded()) + for field_name in field_names field = getproperty(cs_fields, field_name) - push!(all_plots, Plots.plot(field, title = string(field_name) * print_extrema(field))) + + # Copy field onto cpu space + space = axes(field) + FT = ClimaCore.Spaces.undertype(space) + R = get_R(space.grid) + ne = get_ne(space.grid) + polynomial_degree = ClimaCore.Quadratures.polynomial_degree(ClimaCore.Spaces.quadrature_style(space.grid)) + nz = ClimaCore.Spaces.nlevels(space) + height = get_height(space.grid) + + cpu_space = TestHelper.create_space( + FT, + comms_ctx = cpu_comms_ctx, + R = R, + ne = ne, + polynomial_degree = polynomial_degree, + nz = nz, + height = height, + ) + cpu_field = ClimaCore.Fields.ones(cpu_space) + + parent(cpu_field) .= Array(parent(field)) + + push!(all_plots, Plots.plot(cpu_field, title = string(field_name) * print_extrema(field))) + if (field_name == :T_S) && (@isdefined debug_csf0) + push!( + all_plots, + Plots.plot( + cpu_field .- debug_csf0.T_S, + title = string(field_name) * "_anom" * print_extrema(field), + color = :viridis, + ), + ) + end end Plots.plot(all_plots..., size = (1500, 800)) - Plots.png(joinpath(dir, "debug_coupler")) + Plots.png(dir * "debug_coupler") # plot anomalies if a reference cs.fields, `cs_fields_ref`, are provided if !isnothing(cs_fields_ref) all_plots = [] for field_name in field_names field = getproperty(cs_fields, field_name) + # Copy field onto cpu space + parent(cpu_field) .= parent(field) + push!( all_plots, Plots.plot( - field .- getproperty(cs_fields_ref, field_name), + cpu_field .- getproperty(cs_fields_ref, field_name), title = string(field_name) * print_extrema(field), ), ) end Plots.plot(all_plots..., size = (1500, 800)) - Plots.png(joinpath(dir, "debug_coupler_amomalies")) + Plots.png(dir * "debug_coupler_amomalies") end end +function get_ne(grid::ClimaCore.Grids.SpectralElementGrid2D) + return grid.topology.mesh.ne +end +function get_ne(grid::ClimaCore.Grids.LevelGrid) + return get_ne(grid.full_grid.horizontal_grid) +end +function get_ne(grid::ClimaCore.Grids.ExtrudedFiniteDifferenceGrid) + return get_ne(grid.horizontal_grid) +end + +function get_height(grid::ClimaCore.Grids.ExtrudedFiniteDifferenceGrid) + return grid.vertical_grid.topology.mesh.domain.coord_max.z +end +function get_height(grid) + return nothing # 2d case +end + +function get_R(grid)#::ClimaCore.Grids.SpectralElementGrid2D) + return ClimaCore.Grids.global_geometry(grid).radius +end """ debug(sim::ComponentModelSimulation, dir) @@ -74,15 +133,37 @@ Plot the fields of a component model simulation and save plots to a directory. """ function debug(sim::ComponentModelSimulation, dir) + @show name(sim) field_names = plot_field_names(sim) + cpu_comms_ctx = ClimaComms.SingletonCommsContext(ClimaComms.CPUSingleThreaded()) all_plots = [] for field_name in field_names field = get_field(sim, Val(field_name)) - push!(all_plots, Plots.plot(field, title = string(field_name) * print_extrema(field))) + # Copy field onto cpu space + space = axes(field) + FT = ClimaCore.Spaces.undertype(space) + R = get_R(space.grid) + ne = get_ne(space.grid) + polynomial_degree = ClimaCore.Quadratures.polynomial_degree(ClimaCore.Spaces.quadrature_style(space.grid)) + nz = ClimaCore.Spaces.nlevels(space) + height = get_height(space.grid) + cpu_space = TestHelper.create_space( + FT, + comms_ctx = cpu_comms_ctx, + R = R, + ne = ne, + polynomial_degree = polynomial_degree, + nz = nz, + height = height, + ) + cpu_field = ClimaCore.Fields.ones(cpu_space) + parent(cpu_field) .= Array(parent(field)) + + push!(all_plots, Plots.plot(cpu_field, title = string(field_name) * print_extrema(field))) end fig = Plots.plot(all_plots..., size = (1500, 800)) - Plots.png(joinpath(dir, "debug_$(name(sim))")) + Plots.png(dir * "debug_$(name(sim))") end diff --git a/test/Project.toml b/test/Project.toml index cead746cae..81876808c2 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" ArtifactWrappers = "a14bc488-3040-4b00-9dc1-f6467924858a" CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" diff --git a/test/TestHelper.jl b/test/TestHelper.jl index 28852f6d91..43deada1fb 100644 --- a/test/TestHelper.jl +++ b/test/TestHelper.jl @@ -35,6 +35,7 @@ function create_space( ne = 4, polynomial_degree = 3, nz = 1, + height = FT(100), ) domain = Domains.SphereDomain(R) mesh = Meshes.EquiangularCubedSphere(domain, ne) @@ -50,10 +51,14 @@ function create_space( sphere_space = Spaces.SpectralElementSpace2D(topology, quad) if nz > 1 - vertdomain = - Domains.IntervalDomain(Geometry.ZPoint{FT}(0), Geometry.ZPoint{FT}(100); boundary_names = (:bottom, :top)) + vertdomain = Domains.IntervalDomain( + Geometry.ZPoint{FT}(0), + Geometry.ZPoint{FT}(height); + boundary_names = (:bottom, :top), + ) vertmesh = Meshes.IntervalMesh(vertdomain, nelems = nz) - vert_center_space = Spaces.CenterFiniteDifferenceSpace(vertmesh) + vert_topology = Topologies.IntervalTopology(comms_ctx, vertmesh) + vert_center_space = Spaces.CenterFiniteDifferenceSpace(vert_topology) return Spaces.ExtrudedFiniteDifferenceSpace(sphere_space, vert_center_space) else return sphere_space