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:
12
12
os :
13
13
- linux
14
14
- 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
19
26
matrix :
20
27
allow_failures :
21
28
- julia : nightly
22
29
fast_finish : true
23
30
notifications :
24
31
email : false
25
32
after_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
27
34
julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())';
28
35
fi
Original file line number Diff line number Diff line change 215
215
global sampler_ = _sampler
216
216
global model_ = _model
217
217
global context_ = _context
218
+ global rng_ = _rng
218
219
global lp = getlogp (_varinfo)
219
220
return x
220
221
end
226
227
@test model_ === model
227
228
@test sampler_ === SampleFromPrior ()
228
229
@test context_ === DefaultContext ()
230
+ @test rng_ isa Random. AbstractRNG
229
231
230
232
# disable warnings
231
233
@model testmodel (x) = begin
234
236
global sampler_ = _sampler
235
237
global model_ = _model
236
238
global context_ = _context
239
+ global rng_ = _rng
237
240
global lp = getlogp (_varinfo)
238
241
return x
239
242
end false
Original file line number Diff line number Diff line change @@ -26,4 +26,22 @@ Random.seed!(1234)
26
26
@test ljoint ≈ lprior + llikelihood
27
27
@test ljoint ≈ lp
28
28
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
29
47
end
You can’t perform that action at this time.
0 commit comments