From 159e0b493c0ad142818458bb0cfd025543d8d5e1 Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Tue, 5 Sep 2023 14:46:18 -0700 Subject: [PATCH 1/6] Add aqua tests, small fixes for tests --- docs/Project.toml | 1 + src/Common.jl | 2 -- test/Project.toml | 1 + test/aqua.jl | 49 +++++++++++++++++++++++++++++++++++++++++++++++ test/runtests.jl | 1 + 5 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/aqua.jl diff --git a/docs/Project.toml b/docs/Project.toml index 0968481063..58889ca0d3 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -7,5 +7,6 @@ DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c" + [compat] CLIMAParameters = "0.7.12" diff --git a/src/Common.jl b/src/Common.jl index 25d51265eb..a5cf2c8ae8 100644 --- a/src/Common.jl +++ b/src/Common.jl @@ -14,8 +14,6 @@ import ..CommonTypes as CT export G_func export H2SO4_soln_saturation_vapor_pressure -export ABIFM_Delta_a_w -export Chen_snow_ice_coeffs export Chen2022_vel_add export Chen2022_vel_coeffs diff --git a/test/Project.toml b/test/Project.toml index 9564e11ce3..55f935ea11 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" CLIMAParameters = "6eacf6c3-8458-43b9-ae03-caf5306d3d53" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" diff --git a/test/aqua.jl b/test/aqua.jl new file mode 100644 index 0000000000..adea042206 --- /dev/null +++ b/test/aqua.jl @@ -0,0 +1,49 @@ +using Test +using CloudMicrophysics +using Aqua +@testset "Quality assurance - Aqua" begin + + @testset "Aqua tests (performance)" begin + # This tests that we don't accidentally run into + # https://github.com/JuliaLang/julia/issues/29393 + ua = Aqua.detect_unbound_args_recursively(CloudMicrophysics) + # Uncomment for debugging: + # for unbound_arg in ua + # @show unbound_arg + # end + + # There are unbound ambiguities in CM that match this pattern: + # https://github.com/JuliaTesting/Aqua.jl/issues/86 + @test length(ua) <= 4 + + # See: https://github.com/SciML/OrdinaryDiffEq.jl/issues/1750 + # Test that we're not introducing method ambiguities across deps + ambs = Aqua.detect_ambiguities(CloudMicrophysics; recursive = true) + pkg_match(pkgname, pkdir::Nothing) = false + pkg_match(pkgname, pkdir::AbstractString) = occursin(pkgname, pkdir) + filter!( + x -> pkg_match("CloudMicrophysics", pkgdir(last(x).module)), + ambs, + ) + + # If the number of ambiguities is less than the limit below, + # then please lower the limit based on the new number of ambiguities. + # We're trying to drive this number down to zero to reduce latency. + # Uncomment for debugging: + # for method_ambiguity in ambs + # @show method_ambiguity + # end + @test length(ambs) ≤ 0 + end + + @testset "Aqua tests (additional)" begin + Aqua.test_undefined_exports(CloudMicrophysics) + Aqua.test_stale_deps(CloudMicrophysics) + Aqua.test_deps_compat(CloudMicrophysics) + Aqua.test_project_extras(CloudMicrophysics) + Aqua.test_project_toml_formatting(CloudMicrophysics) + Aqua.test_piracy(CloudMicrophysics) + end + +end +nothing diff --git a/test/runtests.jl b/test/runtests.jl index 7dcf56d852..aca45c0dcd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,3 +9,4 @@ include("common_types_tests.jl") include("nucleation_unit_tests.jl") include("precipitation_susceptibility_tests.jl") include("p3_tests.jl") +include("aqua.jl") From b6d87445fc75ad9c8b34177538a56788bdbe4900 Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Wed, 6 Sep 2023 10:20:43 -0700 Subject: [PATCH 2/6] fix CUDA being added and failing Aqua --- .buildkite/pipeline.yml | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c3cf0f8e8b..bade643bbd 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -15,23 +15,6 @@ steps: queue: central slurm_ntasks: 1 - - label: "init :flower_playing_cards:" - key: "init_gpu_env" - command: - - "julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true)'" - - "julia --project -e 'using Pkg; Pkg.precompile()'" - - # force the initialization of the CUDA runtime as it is lazily loaded by default - - "julia --project -e 'using Pkg; Pkg.add(name=\"CUDA\")'" - - "julia --project -e 'using CUDA; CUDA.versioninfo()'" - - "julia --project -e 'using CUDA; CUDA.precompile_runtime()'" - - "julia --project -e 'using Pkg; Pkg.status()'" - agents: - config: gpu - queue: central - slurm_ntasks: 1 - slurm_gres: "gpu:1" - - wait - label: ":computer: unit tests" @@ -44,6 +27,27 @@ steps: queue: central slurm_ntasks: 1 + - wait + + - label: "init :flower_playing_cards:" + key: "init_gpu_env" + command: + - "julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true)'" + - "julia --project -e 'using Pkg; Pkg.precompile()'" + + # force the initialization of the CUDA runtime as it is lazily loaded by default + - "julia --project -e 'using Pkg; Pkg.add(name=\"CUDA\")'" + - "julia --project -e 'using CUDA; CUDA.versioninfo()'" + - "julia --project -e 'using CUDA; CUDA.precompile_runtime()'" + - "julia --project -e 'using Pkg; Pkg.status()'" + agents: + config: gpu + queue: central + slurm_ntasks: 1 + slurm_gres: "gpu:1" + + - wait + - label: ":flower_playing_cards: unit tests" key: "gpu_unittests" command: From 5b8f8dcb5e517d228bf97a4f757dd7632c0fe4fb Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Wed, 6 Sep 2023 10:26:57 -0700 Subject: [PATCH 3/6] update pipeline --- .buildkite/pipeline.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index bade643bbd..291707bb26 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -30,22 +30,22 @@ steps: - wait - label: "init :flower_playing_cards:" - key: "init_gpu_env" - command: - - "julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true)'" - - "julia --project -e 'using Pkg; Pkg.precompile()'" - - # force the initialization of the CUDA runtime as it is lazily loaded by default - - "julia --project -e 'using Pkg; Pkg.add(name=\"CUDA\")'" - - "julia --project -e 'using CUDA; CUDA.versioninfo()'" - - "julia --project -e 'using CUDA; CUDA.precompile_runtime()'" - - "julia --project -e 'using Pkg; Pkg.status()'" - agents: - config: gpu - queue: central - slurm_ntasks: 1 - slurm_gres: "gpu:1" + key: "init_gpu_env" + command: + - "julia --project -e 'using Pkg; Pkg.instantiate(;verbose=true)'" + - "julia --project -e 'using Pkg; Pkg.precompile()'" + # force the initialization of the CUDA runtime as it is lazily loaded by default + - "julia --project -e 'using Pkg; Pkg.add(name=\"CUDA\")'" + - "julia --project -e 'using CUDA; CUDA.versioninfo()'" + - "julia --project -e 'using CUDA; CUDA.precompile_runtime()'" + - "julia --project -e 'using Pkg; Pkg.status()'" + agents: + config: gpu + queue: central + slurm_ntasks: 1 + slurm_gres: "gpu:1" + - wait - label: ":flower_playing_cards: unit tests" From 8886bcceff449c4299aca0f593e84c8b41e95bfe Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Wed, 6 Sep 2023 10:54:28 -0700 Subject: [PATCH 4/6] one more try --- .buildkite/pipeline.yml | 26 +++++++++++--------------- test/aqua.jl | 3 ++- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 291707bb26..c3cf0f8e8b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -15,20 +15,6 @@ steps: queue: central slurm_ntasks: 1 - - wait - - - label: ":computer: unit tests" - key: "cpu_unittests" - command: - - "julia --project=test -e 'using Pkg; Pkg.develop(path=\".\"); Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'" - - "julia --project=test --color=yes test/runtests.jl" - agents: - config: cpu - queue: central - slurm_ntasks: 1 - - - wait - - label: "init :flower_playing_cards:" key: "init_gpu_env" command: @@ -45,9 +31,19 @@ steps: queue: central slurm_ntasks: 1 slurm_gres: "gpu:1" - + - wait + - label: ":computer: unit tests" + key: "cpu_unittests" + command: + - "julia --project=test -e 'using Pkg; Pkg.develop(path=\".\"); Pkg.instantiate(;verbose=true); Pkg.precompile(;strict=true)'" + - "julia --project=test --color=yes test/runtests.jl" + agents: + config: cpu + queue: central + slurm_ntasks: 1 + - label: ":flower_playing_cards: unit tests" key: "gpu_unittests" command: diff --git a/test/aqua.jl b/test/aqua.jl index adea042206..7daba71919 100644 --- a/test/aqua.jl +++ b/test/aqua.jl @@ -1,6 +1,7 @@ using Test using CloudMicrophysics using Aqua + @testset "Quality assurance - Aqua" begin @testset "Aqua tests (performance)" begin @@ -38,7 +39,7 @@ using Aqua @testset "Aqua tests (additional)" begin Aqua.test_undefined_exports(CloudMicrophysics) - Aqua.test_stale_deps(CloudMicrophysics) + Aqua.test_stale_deps(CloudMicrophysics; ignore = [:CUDA]) Aqua.test_deps_compat(CloudMicrophysics) Aqua.test_project_extras(CloudMicrophysics) Aqua.test_project_toml_formatting(CloudMicrophysics) From edcaf3da678648559736a9b2d040458c9e588402 Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Wed, 6 Sep 2023 11:31:30 -0700 Subject: [PATCH 5/6] wip --- test/aqua.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/aqua.jl b/test/aqua.jl index 7daba71919..24ed9c963b 100644 --- a/test/aqua.jl +++ b/test/aqua.jl @@ -36,11 +36,11 @@ using Aqua # end @test length(ambs) ≤ 0 end - + ignore = [:CUDA] @testset "Aqua tests (additional)" begin Aqua.test_undefined_exports(CloudMicrophysics) - Aqua.test_stale_deps(CloudMicrophysics; ignore = [:CUDA]) - Aqua.test_deps_compat(CloudMicrophysics) + Aqua.test_stale_deps(CloudMicrophysics; ignore) + Aqua.test_deps_compat(CloudMicrophysics; ignore) Aqua.test_project_extras(CloudMicrophysics) Aqua.test_project_toml_formatting(CloudMicrophysics) Aqua.test_piracy(CloudMicrophysics) From faf2ede0b3eb017ae2693b89d8449666c71657f8 Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Wed, 6 Sep 2023 11:56:16 -0700 Subject: [PATCH 6/6] remove CUDA addition from pipelien --- .buildkite/pipeline.yml | 7 +++---- test/aqua.jl | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c3cf0f8e8b..2302e5b758 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -22,10 +22,9 @@ steps: - "julia --project -e 'using Pkg; Pkg.precompile()'" # force the initialization of the CUDA runtime as it is lazily loaded by default - - "julia --project -e 'using Pkg; Pkg.add(name=\"CUDA\")'" - - "julia --project -e 'using CUDA; CUDA.versioninfo()'" - - "julia --project -e 'using CUDA; CUDA.precompile_runtime()'" - - "julia --project -e 'using Pkg; Pkg.status()'" + - "julia --project=test -e 'using CUDA; CUDA.versioninfo()'" + - "julia --project=test -e 'using CUDA; CUDA.precompile_runtime()'" + - "julia --project=test -e 'using Pkg; Pkg.status()'" agents: config: gpu queue: central diff --git a/test/aqua.jl b/test/aqua.jl index 24ed9c963b..f62363498c 100644 --- a/test/aqua.jl +++ b/test/aqua.jl @@ -36,11 +36,10 @@ using Aqua # end @test length(ambs) ≤ 0 end - ignore = [:CUDA] @testset "Aqua tests (additional)" begin Aqua.test_undefined_exports(CloudMicrophysics) - Aqua.test_stale_deps(CloudMicrophysics; ignore) - Aqua.test_deps_compat(CloudMicrophysics; ignore) + Aqua.test_stale_deps(CloudMicrophysics) + Aqua.test_deps_compat(CloudMicrophysics) Aqua.test_project_extras(CloudMicrophysics) Aqua.test_project_toml_formatting(CloudMicrophysics) Aqua.test_piracy(CloudMicrophysics)