Might be a silly question, but I am wondering if it is possible to run MCMC sampling from a Turing model using the multiple cores of the CPU without having to start Julia in a particular way / setting environment variables.
The reason is that I would like my script to be as reproducible as possible and not depend on other (env) files or starting parameters.
In R with rstanarm/brms, one can “seamlessly” use multiple cores just by setting cores=4
in the sampling functionb, but in Turing, when using:
sample(mymod, NUTS(), MCMCThreads(), 1000, 4)
It says Warning: Only a single thread available: MCMC chains are not sampled in parallel
After investigation, it seems like the amount of threads must be set from the start (multithreading official docs) using $ julia --threads 4
But is there a way to do that from the Julia REPL itself?