From fc8cfa666eee1230298c2dec6d970c594c98e49d Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 4 Oct 2024 22:40:02 +0200 Subject: [PATCH] Use `copy` instead of `deepcopy` for RNGs (#147) --- src/sample.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sample.jl b/src/sample.jl index 6e21f18..0559876 100644 --- a/src/sample.jl +++ b/src/sample.jl @@ -391,7 +391,8 @@ function mcmcsample( nchunks = min(nchains, Threads.nthreads()) chunksize = cld(nchains, nchunks) interval = 1:nchunks - rngs = [deepcopy(rng) for _ in interval] + # `copy` instead of `deepcopy` for RNGs: https://github.com/JuliaLang/julia/issues/42899 + rngs = [copy(rng) for _ in interval] models = [deepcopy(model) for _ in interval] samplers = [deepcopy(sampler) for _ in interval]