From 9a79f0355021367a8fd3356709b202761db9f34d Mon Sep 17 00:00:00 2001 From: John Omotani <john.omotani@ukaea.uk> Date: Tue, 8 Oct 2024 14:36:16 +0100 Subject: [PATCH 1/7] Remove HDF5_jll pinning Now that NCDatasets is an optional dependency (coupled using an 'extension'), we do not need to use an old version of the HDF5 library provided by Julia, `HDF5_jll` (cf issue #148). Using the latest version will allow us to activate parallel I/O in the Github Actions CI jobs. --- moment_kinetics/Project.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/moment_kinetics/Project.toml b/moment_kinetics/Project.toml index fc61043c9a..be7d4b7a42 100644 --- a/moment_kinetics/Project.toml +++ b/moment_kinetics/Project.toml @@ -11,7 +11,6 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838" Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" -HDF5_jll = "0234f1f7-429e-5d53-9886-15a909be8d59" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" LegendrePolynomials = "3db4a2ba-fc88-11e8-3e01-49c72059a882" LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" @@ -50,7 +49,6 @@ file_io_netcdf = "NCDatasets" manufactured_solns_ext = ["Symbolics", "IfElse"] [compat] -HDF5_jll = "<1.14, >=1.15" julia = "1.9.0" [extras] From 04015c1ab50b651d159389411f2aa9f0bc6c8223 Mon Sep 17 00:00:00 2001 From: John Omotani <john.omotani@ukaea.uk> Date: Tue, 8 Oct 2024 14:40:49 +0100 Subject: [PATCH 2/7] Disable "parallel_io" in Harrison-Thompson test Is good to have a couple of tests that us `parallel_io=false` (the restart interpolation already did), so that even when parallel I/O is available, the branch that does not use it gets tested. --- moment_kinetics/test/harrisonthompson.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moment_kinetics/test/harrisonthompson.jl b/moment_kinetics/test/harrisonthompson.jl index 990db4c9d6..d0ec7f31bb 100644 --- a/moment_kinetics/test/harrisonthompson.jl +++ b/moment_kinetics/test/harrisonthompson.jl @@ -83,7 +83,8 @@ test_input_finite_difference = Dict("composition" => OptionsDict("n_ion_species" "upar_phase" => 0.0, "temperature_amplitude" => 0.0, "temperature_phase" => 0.0), - "output" => OptionsDict("run_name" => "finite_difference"), + "output" => OptionsDict("run_name" => "finite_difference", + "parallel_io" => false), "evolve_moments" => OptionsDict("density" => false, "parallel_flow" => false, "parallel_pressure" => false, From 331b9fa81e59de02e63094bc2287d96ab8e0cfc2 Mon Sep 17 00:00:00 2001 From: John Omotani <john.omotani@ukaea.uk> Date: Tue, 8 Oct 2024 14:54:01 +0100 Subject: [PATCH 3/7] Install NCDatasets for the Github Actions CI parallel checks NCDatasets was already included for the serial tests. Now that we use the Julia-provided MPI for the parallel tests, it is also possible to install NCDatasets for the parallel tests. --- .github/workflows/debug_checks.yml | 2 +- .github/workflows/parallel_test.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/debug_checks.yml b/.github/workflows/debug_checks.yml index 451c08502f..53c06decf2 100644 --- a/.github/workflows/debug_checks.yml +++ b/.github/workflows/debug_checks.yml @@ -28,7 +28,7 @@ jobs: sed -i -e "s/_debug_level = get_options.*/_debug_level = 2/" moment_kinetics/src/debugging.jl touch Project.toml - julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences", "PackageCompiler", "Symbolics"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' + julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences", "PackageCompiler", "NCDatasets", "Symbolics"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' julia --project -O3 --check-bounds=no -e 'using MPI; MPI.install_mpiexecjl(; destdir=".")' julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.develop(path="moment_kinetics/"); Pkg.precompile()' julia --project -O3 --check-bounds=yes precompile-with-check-bounds.jl --debug 2 diff --git a/.github/workflows/parallel_test.yml b/.github/workflows/parallel_test.yml index b3eed45e6b..5441dcc82f 100644 --- a/.github/workflows/parallel_test.yml +++ b/.github/workflows/parallel_test.yml @@ -23,7 +23,7 @@ jobs: touch Project.toml julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.add(["MPI", "MPIPreferences"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' julia --project -O3 --check-bounds=no -e 'using MPI; MPI.install_mpiexecjl(; destdir=".")' - julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.add(["Random", "SpecialFunctions", "StatsBase", "Test"]); Pkg.develop(path="moment_kinetics/")' + julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.add(["NCDatasets", "Random", "SpecialFunctions", "StatsBase", "Test"]); Pkg.develop(path="moment_kinetics/")' julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.precompile()' # Need to use openmpi so that we can use `--oversubscribe` to allow using more MPI ranks than physical cores ./mpiexecjl -np 3 --oversubscribe julia --project -O3 --check-bounds=no moment_kinetics/test/runtests.jl --ci --debug 1 @@ -48,7 +48,7 @@ jobs: touch Project.toml julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.add(["MPI", "MPIPreferences"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' julia --project -O3 --check-bounds=no -e 'using MPI; MPI.install_mpiexecjl(; destdir=".")' - julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.add(["Random", "SpecialFunctions", "StatsBase", "Test"]); Pkg.develop(path="moment_kinetics/")' + julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.add(["NCDatasets", "Random", "SpecialFunctions", "StatsBase", "Test"]); Pkg.develop(path="moment_kinetics/")' julia --project -O3 --check-bounds=no -e 'import Pkg; Pkg.precompile()' # Need to use openmpi so that we can use `--oversubscribe` to allow using more MPI ranks than physical cores ./mpiexecjl -np 4 --oversubscribe julia --project -O3 --check-bounds=no moment_kinetics/test/runtests.jl --ci --debug 1 From 2bc99e475d9c2e4a63dc1591cbe0e30a10dc6bcc Mon Sep 17 00:00:00 2001 From: John Omotani <john.omotani@ukaea.uk> Date: Tue, 8 Oct 2024 14:55:56 +0100 Subject: [PATCH 4/7] Set `parallel_io=false` for a few debug checks It is good to still test this option even when parallel I/O is available. --- moment_kinetics/debug_test/sound_wave_inputs.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moment_kinetics/debug_test/sound_wave_inputs.jl b/moment_kinetics/debug_test/sound_wave_inputs.jl index 9f91fa239c..eb1ee45177 100644 --- a/moment_kinetics/debug_test/sound_wave_inputs.jl +++ b/moment_kinetics/debug_test/sound_wave_inputs.jl @@ -210,7 +210,8 @@ recursive_merge(test_input_finite_difference_1D1V, test_input_chebyshev_1D1V_split_1_moment = recursive_merge(test_input_chebyshev_1D1V, - OptionsDict("output" => OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V_split_1_moment"), + OptionsDict("output" => OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V_split_1_moment", + "parallel_io" => false), "evolve_moments" => OptionsDict("density" => true))) test_input_chebyshev_1D1V_split_2_moments = From 219f9bd9a2c1b8797768a3d482d5e7d659e179fd Mon Sep 17 00:00:00 2001 From: John Omotani <john.omotani@ukaea.uk> Date: Tue, 8 Oct 2024 14:56:38 +0100 Subject: [PATCH 5/7] Test NetCDF I/O in a few debug checks, if available If NCDatasets is installed (so the NetCDF I/O extension is activated), then use NetCDF for a few of the debug checks, to test that it is working properly. --- moment_kinetics/debug_test/sound_wave_inputs.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/moment_kinetics/debug_test/sound_wave_inputs.jl b/moment_kinetics/debug_test/sound_wave_inputs.jl index eb1ee45177..3fc8654451 100644 --- a/moment_kinetics/debug_test/sound_wave_inputs.jl +++ b/moment_kinetics/debug_test/sound_wave_inputs.jl @@ -1,6 +1,8 @@ test_type = "sound_wave" using moment_kinetics.type_definitions: OptionsDict using moment_kinetics.utils: recursive_merge +using moment_kinetics.file_io: io_has_implementation +using moment_kinetics.input_structs: netcdf # default inputs for tests test_input_finite_difference_1D1V = OptionsDict("output" => OptionsDict("run_name" => "finite_difference_1D1V", @@ -224,9 +226,13 @@ recursive_merge(test_input_chebyshev_1D1V_split_2_moments, OptionsDict("output" => OptionsDict("run_name" => "chebyshev_pseudospectral_1D1V_split_3_moments"), "evolve_moments" => OptionsDict("parallel_pressure" => true))) +# Use "netcdf" for a few tests to test the NetCDF I/O if it is available. +const binary_format = io_has_implementation(netcdf) ? "netcdf" : "hdf5" + test_input_chebyshev_cx0_1D1V = recursive_merge(test_input_chebyshev_1D1V, - OptionsDict("output" => OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_1D1V"), + OptionsDict("output" => OptionsDict("run_name" => "chebyshev_pseudospectral_cx0_1D1V", + "binary_format" => binary_format), "reactions" => OptionsDict("charge_exchange_frequency" => 0.0))) test_input_chebyshev_cx0_1D1V_split_1_moment = From 399c0941a0d9c600e24a23eb9c3f9eefe0309a88 Mon Sep 17 00:00:00 2001 From: John Omotani <john.omotani@ukaea.uk> Date: Tue, 8 Oct 2024 17:58:45 +0100 Subject: [PATCH 6/7] Use `--check-bounds=yes` for all commands in debug_checks.yml By mistake, one command (creating the `mpiexecjl` executable) was run with `--check-bounds=no`. This might trigger re-precompilation of packages, so is inefficient at best. --- .github/workflows/debug_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/debug_checks.yml b/.github/workflows/debug_checks.yml index 53c06decf2..e1f4b1f046 100644 --- a/.github/workflows/debug_checks.yml +++ b/.github/workflows/debug_checks.yml @@ -29,7 +29,7 @@ jobs: touch Project.toml julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences", "PackageCompiler", "NCDatasets", "Symbolics"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' - julia --project -O3 --check-bounds=no -e 'using MPI; MPI.install_mpiexecjl(; destdir=".")' + julia --project -O3 --check-bounds=yes -e 'using MPI; MPI.install_mpiexecjl(; destdir=".")' julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.develop(path="moment_kinetics/"); Pkg.precompile()' julia --project -O3 --check-bounds=yes precompile-with-check-bounds.jl --debug 2 From 69faf430be12c2473f2be8cc9d76935a493d572b Mon Sep 17 00:00:00 2001 From: John Omotani <john.omotani@ukaea.uk> Date: Tue, 8 Oct 2024 18:05:00 +0100 Subject: [PATCH 7/7] Don't install NCDatasets in debug CI job At the moment installing NCDatasets (and therefore activating the NetCDF I/O extension) causes precompilation to hang in the debug checks CI job. Not sure why this is, but skip NCDatasets for now to avoid it. --- .github/workflows/debug_checks.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/debug_checks.yml b/.github/workflows/debug_checks.yml index e1f4b1f046..087407d9b2 100644 --- a/.github/workflows/debug_checks.yml +++ b/.github/workflows/debug_checks.yml @@ -28,7 +28,9 @@ jobs: sed -i -e "s/_debug_level = get_options.*/_debug_level = 2/" moment_kinetics/src/debugging.jl touch Project.toml - julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences", "PackageCompiler", "NCDatasets", "Symbolics"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' + # Not sure why installing "NCDatasets" fails at the moment (8/10/2024), but precompilation hangs for this job if it is included, so skip for now. + #julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences", "NCDatasets", "PackageCompiler", "Symbolics"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' + julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.add(["MPI", "MPIPreferences", "PackageCompiler", "Symbolics"]); using MPIPreferences; MPIPreferences.use_jll_binary("OpenMPI_jll")' julia --project -O3 --check-bounds=yes -e 'using MPI; MPI.install_mpiexecjl(; destdir=".")' julia --project -O3 --check-bounds=yes -e 'using Pkg; Pkg.develop(path="moment_kinetics/"); Pkg.precompile()' julia --project -O3 --check-bounds=yes precompile-with-check-bounds.jl --debug 2