From 9ec575c847b93d0e3feb2ac112055adb351df8ad Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 11 Oct 2024 12:42:51 +0100 Subject: [PATCH 1/4] Default float type to float(Real), not Real Closes #684 --- Project.toml | 2 +- src/utils.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 5830de123..8e2cb92e2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "DynamicPPL" uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8" -version = "0.28.4" +version = "0.28.5" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/src/utils.jl b/src/utils.jl index 4bf652363..4bf5d183b 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -811,9 +811,9 @@ end """ float_type_with_fallback(x) -Return type corresponding to `float(typeof(x))` if possible; otherwise return `Real`. +Return type corresponding to `float(typeof(x))` if possible; otherwise return `float(Real)`. """ -float_type_with_fallback(::Type) = Real +float_type_with_fallback(::Type) = float(Real) float_type_with_fallback(::Type{T}) where {T<:Real} = float(T) """ From e005ef34a3c2b3e93152cf305f46fb10db626611 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 11 Oct 2024 12:51:22 +0100 Subject: [PATCH 2/4] Trigger CI on backport branches/PRs --- .github/workflows/CI.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a54b850a1..a36e61b4f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,9 +4,11 @@ on: push: branches: - master + - backport-* pull_request: branches: - master + - backport-* merge_group: types: [checks_requested] From 16c54c91de73e96958ea04d113ee66b0cfe306c9 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 11 Oct 2024 13:45:07 +0100 Subject: [PATCH 3/4] Add integration test for #684 --- test/turing/varinfo.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/turing/varinfo.jl b/test/turing/varinfo.jl index 30408e598..0c6879186 100644 --- a/test/turing/varinfo.jl +++ b/test/turing/varinfo.jl @@ -342,4 +342,19 @@ model = state_space(y, length(t)) @test size(sample(model, NUTS(; adtype=AutoReverseDiff(true)), n), 1) == n end + + if Threads.nthreads() > 1 + @testset "DynamicPPL#684: OrderedDict with multiple types when multithreaded" begin + @model function f(x) + ns ~ filldist(Normal(0, 2.0), 3) + m ~ Uniform(0, 1) + x ~ Normal(m, 1) + end + model = f(1) + chain = sample(model, NUTS(), MCMCThreads(), 10, 2); + loglikelihood(model, chain) + logprior(model, chain) + logjoint(model, chain) + end + end end From e3f5b9f186f72b511ff8df411612ded8a6e7050a Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 11 Oct 2024 13:47:54 +0100 Subject: [PATCH 4/4] Bump Turing version to 0.34 in test subfolder --- test/turing/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/turing/Project.toml b/test/turing/Project.toml index 5dab655cb..798421c8a 100644 --- a/test/turing/Project.toml +++ b/test/turing/Project.toml @@ -15,5 +15,5 @@ DynamicPPL = "0.24, 0.25, 0.26, 0.27, 0.28" HypothesisTests = "0.11" MCMCChains = "6" ReverseDiff = "1.15" -Turing = "0.33" +Turing = "0.34" julia = "1.7"