Skip to content

Commit f625d7a

Browse files
committed
Improve setthreadsafe docstring
1 parent 2f2b0f0 commit f625d7a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/model.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,19 @@ end
130130
131131
Returns a new `Model` with its threadsafe flag set to `threadsafe`.
132132
133-
Threadsafe evaluation allows for parallel execution of model statements that mutate the
134-
internal `VarInfo` object. For example, this is needed if tilde-statements are nested inside
135-
`Threads.@threads` or similar constructs.
133+
Threadsafe evaluation ensures correctness when executing model statements that mutate the
134+
internal `VarInfo` object in parallel. For example, this is needed if tilde-statements are
135+
nested inside `Threads.@threads` or similar constructs.
136136
137137
It is not needed for generic multithreaded operations that don't involve VarInfo. For
138138
example, calculating a log-likelihood term in parallel and then calling `@addlogprob!`
139139
outside of the parallel region is safe without needing to set `threadsafe=true`.
140140
141141
It is also not needed for multithreaded sampling with AbstractMCMC's `MCMCThreads()`.
142+
143+
Setting `threadsafe` to `true` increases the overhead in evaluating the model. See
144+
(https://turinglang.org/docs/THIS_DOESNT_EXIST_YET)[https://turinglang.org/docs/THIS_DOESNT_EXIST_YET]
145+
for more details.
142146
"""
143147
function setthreadsafe(model::Model{F,A,D,M}, threadsafe::Bool) where {F,A,D,M}
144148
return if _requires_threadsafe(model) == threadsafe

0 commit comments

Comments
 (0)