diff --git a/perf/p0.jl b/perf/p0.jl index 81ce7fd..757d8b3 100644 --- a/perf/p0.jl +++ b/perf/p0.jl @@ -1,3 +1,4 @@ +using Random using Libtask using Turing, DynamicPPL, AdvancedPS using BenchmarkTools @@ -13,7 +14,8 @@ end # Case 1: Sample from the prior. -m = Turing.Core.TracedModel(gdemo(1.5, 2.), SampleFromPrior(), VarInfo()) +rng = MersenneTwister() +m = Turing.Core.TracedModel(gdemo(1.5, 2.), SampleFromPrior(), VarInfo(), rng) f = m.evaluator[1]; args = m.evaluator[2:end]; @@ -26,7 +28,7 @@ println("Run a tape...") @btime t.tf(args...) # Case 2: SMC sampler -m = Turing.Core.TracedModel(gdemo(1.5, 2.), Sampler(SMC(50)), VarInfo()); +m = Turing.Core.TracedModel(gdemo(1.5, 2.), Sampler(SMC(50)), VarInfo(), rng) f = m.evaluator[1]; args = m.evaluator[2:end]; diff --git a/perf/p2.jl b/perf/p2.jl index a95b3d3..bd904c3 100644 --- a/perf/p2.jl +++ b/perf/p2.jl @@ -41,18 +41,18 @@ using Turing, Test, AbstractMCMC, DynamicPPL, Random, Turing.RandomMeasures, Lib end # Generate some test data. -Random.seed!(1) +rng = Random.seed!(1) -data = vcat(randn(10), randn(10) .- 5, randn(10) .+ 10) +data = vcat(randn(rng, 10), randn(rng, 10) .- 5, randn(rng, 10) .+ 10) data .-= mean(data) data /= std(data) # MCMC sampling -Random.seed!(2) +Random.seed!(rng, 2) iterations = 500 model_fun = infiniteGMM(data) -m = Turing.Core.TracedModel(model_fun, Sampler(SMC(50)), VarInfo()) +m = Turing.Core.TracedModel(model_fun, Sampler(SMC(50)), VarInfo(), rng) f = m.evaluator[1] args = m.evaluator[2:end]