File tree Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Expand file tree Collapse file tree 3 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -12,17 +12,24 @@ branches:
1212os :
1313 - linux
1414 - osx
15- julia :
16- - 1.0
17- - 1
18- - nightly
15+ matrix :
16+ include :
17+ - julia : 1.0
18+ - julia : 1
19+ env : JULIA_NUM_THREADS=1
20+ - julia : 1
21+ env : JULIA_NUM_THREADS=2
22+ - julia : nightly
23+ env : JULIA_NUM_THREADS=1
24+ - julia : nightly
25+ env : JULIA_NUM_THREADS=2
1926matrix :
2027 allow_failures :
2128 - julia : nightly
2229 fast_finish : true
2330notifications :
2431 email : false
2532after_success :
26- - if [[ $TRAVIS_JULIA_VERSION = 1 ]] && [[ $TRAVIS_OS_NAME = linux ]]; then
33+ - if [[ $TRAVIS_JULIA_VERSION = 1 ]] && [[ $JULIA_NUM_THREADS = 1 ]] && [[ $ TRAVIS_OS_NAME = linux ]]; then
2734 julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())';
2835 fi
Original file line number Diff line number Diff line change 215215 global sampler_ = _sampler
216216 global model_ = _model
217217 global context_ = _context
218+ global rng_ = _rng
218219 global lp = getlogp (_varinfo)
219220 return x
220221 end
226227 @test model_ === model
227228 @test sampler_ === SampleFromPrior ()
228229 @test context_ === DefaultContext ()
230+ @test rng_ isa Random. AbstractRNG
229231
230232 # disable warnings
231233 @model testmodel (x) = begin
234236 global sampler_ = _sampler
235237 global model_ = _model
236238 global context_ = _context
239+ global rng_ = _rng
237240 global lp = getlogp (_varinfo)
238241 return x
239242 end false
Original file line number Diff line number Diff line change @@ -26,4 +26,22 @@ Random.seed!(1234)
2626 @test ljoint ≈ lprior + llikelihood
2727 @test ljoint ≈ lp
2828 end
29+
30+ @testset " rng" begin
31+ model = gdemo_default
32+
33+ for sampler in (SampleFromPrior (), SampleFromUniform ())
34+ for i in 1 : 10
35+ Random. seed! (100 + i)
36+ vi = VarInfo ()
37+ model (Random. GLOBAL_RNG, vi, sampler)
38+ vals = DynamicPPL. getall (vi)
39+
40+ Random. seed! (100 + i)
41+ vi = VarInfo ()
42+ model (Random. GLOBAL_RNG, vi, sampler)
43+ @test DynamicPPL. getall (vi) == vals
44+ end
45+ end
46+ end
2947end
You can’t perform that action at this time.
0 commit comments