Skip to content

Commit 9339cbb

Browse files
committed
Disable Mooncake on prerelease
1 parent 1a70627 commit 9339cbb

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

test/ad.jl

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ using Random: Random
88
using StableRNGs: StableRNG
99
using Test
1010
using ..Models: gdemo_default
11-
import ForwardDiff, ReverseDiff, Mooncake
11+
import ForwardDiff, ReverseDiff
12+
13+
# Detect if prerelease version, if so, we skip some tests
14+
const IS_PRERELEASE = !isempty(VERSION.prerelease)
15+
if !IS_PRERELEASE
16+
Pkg.add("Mooncake")
17+
using Mooncake: Mooncake
18+
end
1219

1320
"""Element types that are always valid for a VarInfo regardless of ADType."""
1421
const always_valid_eltypes = (AbstractFloat, AbstractIrrational, Integer, Rational)
1522

1623
"""A dictionary mapping ADTypes to the element types they use."""
17-
const eltypes_by_adtype = Dict(
24+
eltypes_by_adtype = Dict(
1825
Turing.AutoForwardDiff => (ForwardDiff.Dual,),
1926
Turing.AutoReverseDiff => (
2027
ReverseDiff.TrackedArray,
@@ -25,8 +32,10 @@ const eltypes_by_adtype = Dict(
2532
ReverseDiff.TrackedVecOrMat,
2633
ReverseDiff.TrackedVector,
2734
),
28-
Turing.AutoMooncake => (Mooncake.CoDual,),
2935
)
36+
if !IS_PRERELEASE
37+
eltypes_by_adtype[Turing.AutoMooncake] = (Mooncake.CoDual,)
38+
end
3039

3140
"""
3241
AbstractWrongADBackendError
@@ -177,11 +186,10 @@ end
177186
"""
178187
All the ADTypes on which we want to run the tests.
179188
"""
180-
ADTYPES = [
181-
Turing.AutoForwardDiff(),
182-
Turing.AutoReverseDiff(; compile=false),
183-
Turing.AutoMooncake(; config=nothing),
184-
]
189+
ADTYPES = [Turing.AutoForwardDiff(), Turing.AutoReverseDiff(; compile=false)]
190+
if !IS_PRERELEASE
191+
push!(ADTYPES, Turing.AutoMooncake(; config=nothing))
192+
end
185193

186194
# Check that ADTypeCheckContext itself works as expected.
187195
@testset "ADTypeCheckContext" begin

0 commit comments

Comments
 (0)