File tree Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Expand file tree Collapse file tree 3 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1919LogDensityProblems = " 6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
2020MCMCChains = " c7f686f2-ff18-58e9-bc7b-31028e88f75d"
2121MacroTools = " 1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
22- Mooncake = " da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
2322OrderedCollections = " bac558e1-5e72-5ebc-8fee-abe8a469f55d"
2423Pkg = " 44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2524Random = " 9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
@@ -29,6 +28,9 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
2928Test = " 8dfed614-e22c-5e08-85e1-65c5234f0b40"
3029Zygote = " e88e6eb3-aa80-5325-afca-941959d7151f"
3130
31+ [weakdeps ]
32+ Mooncake = " da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
33+
3234[compat ]
3335ADTypes = " 1"
3436AbstractMCMC = " 5"
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ using DynamicPPL: LogDensityFunction
33@testset " Automatic differentiation" begin
44 # Used as the ground truth that others are compared against.
55 ref_adtype = AutoForwardDiff ()
6- test_adtypes = [
7- AutoReverseDiff (; compile = false ),
8- AutoReverseDiff (; compile = true ),
9- AutoMooncake (; config= nothing ),
10- ]
6+ test_adtypes = [AutoReverseDiff (; compile = false ), AutoReverseDiff (; compile = true )]
7+
8+ if USE_MOONCAKE
9+ push! (test_adtypes, AutoMooncake (; config= nothing ))
10+ end
1111
1212 @testset " Unsupported backends" begin
1313 @model demo () = x ~ Normal ()
@@ -16,7 +16,7 @@ using DynamicPPL: LogDensityFunction
1616 )
1717 end
1818
19- @testset " Correctness: ForwardDiff, ReverseDiff, and Mooncake " begin
19+ @testset " Correctness" begin
2020 @testset " $(m. f) " for m in DynamicPPL. TestUtils. DEMO_MODELS
2121 rand_param_values = DynamicPPL. TestUtils. rand_prior_true (m)
2222 vns = DynamicPPL. TestUtils. varnames (m)
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ using ForwardDiff
1212using LogDensityProblems
1313using MacroTools
1414using MCMCChains
15- using Mooncake: Mooncake
1615using StableRNGs
1716using ReverseDiff
1817using Zygote
@@ -40,6 +39,15 @@ Random.seed!(100)
4039
4140include (" test_util.jl" )
4241
42+ # Don't attempt to import Mooncake on 1.12
43+ # https://github.com/chalk-lab/Mooncake.jl/pull/545
44+ USE_MOONCAKE = VERSION >= v " 1.12"
45+
46+ if USE_MOONCAKE
47+ Pkg. add (" Mooncake" )
48+ using Mooncake: Mooncake
49+ end
50+
4351@testset verbose = true " DynamicPPL.jl" begin
4452 # The tests are split into two groups so that CI can run in parallel. The
4553 # groups are chosen to make both groups take roughly the same amount of
@@ -80,7 +88,9 @@ include("test_util.jl")
8088 end
8189 @testset " ad" begin
8290 include (" ext/DynamicPPLForwardDiffExt.jl" )
83- include (" ext/DynamicPPLMooncakeExt.jl" )
91+ if USE_MOONCAKE
92+ include (" ext/DynamicPPLMooncakeExt.jl" )
93+ end
8494 include (" ad.jl" )
8595 end
8696 @testset " prob and logprob macro" begin
You can’t perform that action at this time.
0 commit comments