diff --git a/.github/workflows/JuliaPre.yml b/.github/workflows/JuliaPre.yml index 0c053faf1..c2442bf5c 100644 --- a/.github/workflows/JuliaPre.yml +++ b/.github/workflows/JuliaPre.yml @@ -14,6 +14,14 @@ permissions: jobs: test: runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + test_group: + - Group1 + - Group2 + steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 @@ -22,3 +30,6 @@ jobs: - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + env: + GROUP: ${{ matrix.test_group }} + IS_PRERELEASE: "true" diff --git a/HISTORY.md b/HISTORY.md index a5976f631..1e29dc272 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,10 @@ # DynamicPPL Changelog +## 0.36.3 + +Added a compatibility entry for JET.jl 0.10. +This should only affect you if you are using DynamicPPL on the Julia 1.12 pre-release. + ## 0.36.2 Improved docstrings for AD testing utilities. diff --git a/Project.toml b/Project.toml index 860ece8b3..90410c6b8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "DynamicPPL" uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8" -version = "0.36.2" +version = "0.36.3" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" @@ -60,7 +60,7 @@ DocStringExtensions = "0.9" EnzymeCore = "0.6 - 0.8" ForwardDiff = "0.10.12" InteractiveUtils = "1" -JET = "0.9" +JET = "0.9, 0.10" KernelAbstractions = "0.9.33" LinearAlgebra = "1.6" LogDensityProblems = "2" diff --git a/docs/Project.toml b/docs/Project.toml index fdf8ae1d3..e362361bf 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -23,7 +23,7 @@ DocumenterMermaid = "0.1, 0.2" DynamicPPL = "0.36" FillArrays = "0.13, 1" ForwardDiff = "0.10" -JET = "0.9" +JET = "0.9, 0.10" LogDensityProblems = "2" MCMCChains = "5, 6" StableRNGs = "1" diff --git a/test/Project.toml b/test/Project.toml index 79e6d129b..accaf7625 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -19,7 +19,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c" MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -29,6 +28,9 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" +[weakdeps] +Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" + [compat] ADTypes = "1" AbstractMCMC = "5" @@ -44,7 +46,7 @@ DistributionsAD = "0.6.3" Documenter = "1" EnzymeCore = "0.6 - 0.8" ForwardDiff = "0.10.12" -JET = "0.9" +JET = "0.9, 0.10" LogDensityProblems = "2" MCMCChains = "6.0.4" MacroTools = "0.5.6" diff --git a/test/ad.jl b/test/ad.jl index 69ab99e19..c34624f5b 100644 --- a/test/ad.jl +++ b/test/ad.jl @@ -3,11 +3,16 @@ using DynamicPPL: LogDensityFunction @testset "Automatic differentiation" begin # Used as the ground truth that others are compared against. ref_adtype = AutoForwardDiff() - test_adtypes = [ - AutoReverseDiff(; compile=false), - AutoReverseDiff(; compile=true), - AutoMooncake(; config=nothing), - ] + + test_adtypes = if IS_PRERELEASE + [AutoReverseDiff(; compile=false), AutoReverseDiff(; compile=true)] + else + [ + AutoReverseDiff(; compile=false), + AutoReverseDiff(; compile=true), + AutoMooncake(; config=nothing), + ] + end @testset "Unsupported backends" begin @model demo() = x ~ Normal() @@ -16,7 +21,7 @@ using DynamicPPL: LogDensityFunction ) end - @testset "Correctness: ForwardDiff, ReverseDiff, and Mooncake" begin + @testset "Correctness" begin @testset "$(m.f)" for m in DynamicPPL.TestUtils.DEMO_MODELS rand_param_values = DynamicPPL.TestUtils.rand_prior_true(m) vns = DynamicPPL.TestUtils.varnames(m) diff --git a/test/runtests.jl b/test/runtests.jl index 72f33f2d0..949dd9ee7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,7 +12,6 @@ using ForwardDiff using LogDensityProblems using MacroTools using MCMCChains -using Mooncake: Mooncake using StableRNGs using ReverseDiff using Zygote @@ -34,10 +33,17 @@ using OrderedCollections: OrderedSet using DynamicPPL: getargs_dottilde, getargs_tilde +# These flags are set in CI const GROUP = get(ENV, "GROUP", "All") const AQUA = get(ENV, "AQUA", "true") == "true" -Random.seed!(100) +const IS_PRERELEASE = get(ENV, "IS_PRERELEASE", "false") == "true" + +if !IS_PRERELEASE + Pkg.add("Mooncake") + using Mooncake: Mooncake +end +Random.seed!(100) include("test_util.jl") @testset verbose = true "DynamicPPL.jl" begin @@ -80,26 +86,31 @@ include("test_util.jl") end @testset "ad" begin include("ext/DynamicPPLForwardDiffExt.jl") - include("ext/DynamicPPLMooncakeExt.jl") + if !IS_PRERELEASE + include("ext/DynamicPPLMooncakeExt.jl") + end include("ad.jl") end @testset "prob and logprob macro" begin @test_throws ErrorException prob"..." @test_throws ErrorException logprob"..." end - @testset "doctests" begin - DocMeta.setdocmeta!( - DynamicPPL, - :DocTestSetup, - :(using DynamicPPL, Distributions); - recursive=true, - ) - doctestfilters = [ - # Ignore the source of a warning in the doctest output, since this is dependent on host. - # This is a line that starts with "└ @ " and ends with the line number. - r"└ @ .+:[0-9]+", - ] - doctest(DynamicPPL; manual=false, doctestfilters=doctestfilters) + if !IS_PRERELEASE + # Don't run doctests on prerelease as error messages etc. may vary + @testset "doctests" begin + DocMeta.setdocmeta!( + DynamicPPL, + :DocTestSetup, + :(using DynamicPPL, Distributions); + recursive=true, + ) + doctestfilters = [ + # Ignore the source of a warning in the doctest output, since this is dependent on host. + # This is a line that starts with "└ @ " and ends with the line number. + r"└ @ .+:[0-9]+", + ] + doctest(DynamicPPL; manual=false, doctestfilters=doctestfilters) + end end end end