Skip to content

Commit 0299d7d

Browse files
authored
Enable Mooncake on 1.12 (#2724)
1 parent c4a98a5 commit 0299d7d

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2121
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
2222
LogDensityProblemsAD = "996a588d-648d-4e1f-a8f0-a84b347e47b1"
2323
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
24+
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
2425
NamedArrays = "86f7a689-2022-50b4-a561-43c23ac3c673"
2526
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
2627
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"

test/ad.jl

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ using Random: Random
88
using StableRNGs: StableRNG
99
using Test
1010
using ..Models: gdemo_default
11-
import ForwardDiff, ReverseDiff
12-
13-
# Skip Mooncake on 1.12 as it is not compatible yet
14-
const INCLUDE_MOONCAKE = VERSION < v"1.12"
15-
if INCLUDE_MOONCAKE
16-
import Pkg
17-
Pkg.add("Mooncake")
18-
using Mooncake: Mooncake
19-
end
11+
import ForwardDiff, ReverseDiff, Mooncake
2012

2113
"""Element types that are always valid for a VarInfo regardless of ADType."""
2214
const always_valid_eltypes = (AbstractFloat, AbstractIrrational, Integer, Rational)
@@ -33,10 +25,8 @@ eltypes_by_adtype = Dict(
3325
ReverseDiff.TrackedVecOrMat,
3426
ReverseDiff.TrackedVector,
3527
),
28+
AutoMooncake => (Mooncake.CoDual,),
3629
)
37-
if INCLUDE_MOONCAKE
38-
eltypes_by_adtype[AutoMooncake] = (Mooncake.CoDual,)
39-
end
4030

4131
"""
4232
AbstractWrongADBackendError
@@ -177,10 +167,7 @@ end
177167
"""
178168
All the ADTypes on which we want to run the tests.
179169
"""
180-
ADTYPES = [AutoForwardDiff(), AutoReverseDiff(; compile=false)]
181-
if INCLUDE_MOONCAKE
182-
push!(ADTYPES, AutoMooncake(; config=nothing))
183-
end
170+
ADTYPES = [AutoForwardDiff(), AutoReverseDiff(; compile=false), AutoMooncake()]
184171

185172
# Check that ADTypeCheckContext itself works as expected.
186173
@testset "ADTypeCheckContext" begin

0 commit comments

Comments
 (0)