From 66c9bc3efd5e5df3f397648375d9931dbe5b2f0e Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 20 Dec 2024 03:00:31 +0000 Subject: [PATCH] Increase atol on specific tests for x86 --- test/mcmc/ess.jl | 6 +++++- test/mcmc/gibbs.jl | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/mcmc/ess.jl b/test/mcmc/ess.jl index 92fcaf7d9..6db469b76 100644 --- a/test/mcmc/ess.jl +++ b/test/mcmc/ess.jl @@ -71,7 +71,11 @@ using Turing @varname(mu2) => ESS(), ) chain = sample(StableRNG(seed), MoGtest_default, alg, 2000) - check_MoGtest_default(chain; atol=0.1) + # (penelopeysm) Note that the tolerance for x86 needs to be larger + # because CSMC (i.e. PG) is not reproducible across architectures. + # See https://github.com/TuringLang/Turing.jl/issues/2446. + atol = Sys.ARCH == :i686 ? 0.12 : 0.1 + check_MoGtest_default(chain; atol=atol) end @testset "TestModels" begin diff --git a/test/mcmc/gibbs.jl b/test/mcmc/gibbs.jl index 503bf16cb..34130f38f 100644 --- a/test/mcmc/gibbs.jl +++ b/test/mcmc/gibbs.jl @@ -481,7 +481,11 @@ end # the posterior is analytically known? Doing 10_000 samples to run the test suite # is not ideal # Issue ref: https://github.com/TuringLang/Turing.jl/issues/2402 - @test isapprox(mean(num_ms), 8.6087; atol=0.8) + + # (penelopeysm) Note also the larger atol on x86 runners. This is needed because PG + # is not fully reproducible across architectures, even when seeded as above. See https://github.com/TuringLang/Turing.jl/issues/2446 + mean_atol = Sys.ARCH == :i686 ? 1.3 : 0.8 + @test isapprox(mean(num_ms), 8.6087; atol=mean_atol) @test isapprox(std(num_ms), 1.8865; atol=0.02) end