Commit c4a98a5
authored
make MCMCThreads etc. respect
Prior to this PR, if you called
```julia
sample(model, spl, MCMCThreads(), N, n; check_model=false)
```
the model checking here
https://github.com/TuringLang/Turing.jl/blob/ed7f76c7221a756a390d3168ed6e1fcb6f95d263/src/mcmc/abstractmcmc.jl#L121
would be correctly skipped. The problem is that this calls
`AbstractMCMC.mcmcsample`, which then calls the single-threaded
`sample`, but the `check_model` argument is not passed down, so it
defaults to `true` which then checks the model(!!)
This PR fixes it by simply passing `check_model=false` through. (The
point of explicitly setting it to false is that if the user wanted the
check, it would be done on the line above already, there's no need to
check the model `N+1` times.)
The added test fails on main and passes on this PR.check_model=false (#2721)1 parent ed7f76c commit c4a98a5
File tree
4 files changed
+23
-1
lines changed- src/mcmc
- test/mcmc
4 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
9 | 26 | | |
10 | 27 | | |
11 | 28 | | |
| |||
0 commit comments