The second release candidate for CmdStanPy 1.0 is now up on pypi: cmdstanpy · PyPI
It will be up on conda-forge by tomorrow
pip install cmdstanpy==1.0.0rc2
This version plays nicely with the CmdStan 2.28 sampler’s num_chains
feature, which lets you run multiple chains from within a single process, allowing for better parallelization, and lower memory overhead due to shared access to the input data across all chains.
In order to take advantage of this you must:
- install latest CmdStan (2.28.1)
- compile (or recompile) your models with argument
cpp_options={'STAN_THREADS'='true'}
.
Note: by default, CmdStanPy tries to avoid recompiling models when there’s an existing exe file that’s newer than the Stan file. There are two ways to force recompilation:
# force recompile on instantiation
mymodel = CmdStanModel(stan_file='mymodel.stan', cpp_options={'STAN_THREADS'='true'}, compile='force')
# call object's compile method
mymodel.compile(cpp_options={'STAN_THREADS'='true'}, force=True)