File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -606,7 +606,7 @@ module Issue537 end
606606 @model demo () = return __varinfo__
607607 retval, svi = DynamicPPL. init!! (demo (), SimpleVarInfo ())
608608 @test svi == SimpleVarInfo ()
609- if Threads . nthreads () > 1
609+ if DynamicPPL . USE_THREADSAFE_EVAL[]
610610 @test retval isa DynamicPPL. ThreadSafeVarInfo{<: SimpleVarInfo }
611611 @test retval. varinfo == svi
612612 else
Original file line number Diff line number Diff line change 9696end
9797
9898@testset " FastLDF: performance" begin
99- if Threads . nthreads () == 1
99+ if ! (DynamicPPL . USE_THREADSAFE_EVAL[])
100100 # Evaluating these three models should not lead to any allocations (but only when
101101 # not using TSVI).
102102 @model function f ()
Original file line number Diff line number Diff line change 6464
6565 @testset " model" begin
6666 println (" Peforming threading tests with $(Threads. nthreads ()) threads" )
67+ @show DynamicPPL. USE_THREADSAFE_EVAL[]
6768
6869 x = rand (10_000 )
6970
7980 vi = VarInfo ()
8081 model (vi)
8182 lp_w_threads = getlogjoint (vi)
82- if Threads. nthreads () == 1
83- @test vi_ isa VarInfo
84- else
83+ if DynamicPPL. USE_THREADSAFE_EVAL[]
8584 @test vi_ isa DynamicPPL. ThreadSafeVarInfo
85+ else
86+ @test vi_ isa VarInfo
8687 end
8788
8889 println (" With `@threads`:" )
112113 vi = VarInfo ()
113114 model (vi)
114115 lp_wo_threads = getlogjoint (vi)
115- if Threads. nthreads () == 1
116- @test vi_ isa VarInfo
117- else
116+ if DynamicPPL. USE_THREADSAFE_EVAL[]
118117 @test vi_ isa DynamicPPL. ThreadSafeVarInfo
118+ else
119+ @test vi_ isa VarInfo
119120 end
120121
121122 println (" Without `@threads`:" )
You can’t perform that action at this time.
0 commit comments