From 2a68956c22b5abef8d97d36364ee5b632e2a0712 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 | 8 +++++++- 2 files changed, 12 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..43bdcdbb8 100644 --- a/test/mcmc/gibbs.jl +++ b/test/mcmc/gibbs.jl @@ -481,7 +481,13 @@ 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