Environmental default, parallelization method for cmdstanr

Some of the functions now included with cmdstanr have been a lifesaver (e.g., check_cmdstan_toolchain) for allowing scripts to run out of the box with different platforms and hardware. Thank you for adding them.

After reading through the documentation, although a user clearly has the option of using multi-threading versus OpenCL for sampling, it is not clear to me whether a user could set one or the other as an environmental default, and more importantly, whether it is possible to easily move back and forth between the two options if both are being evaluated.

I recognize we can specify in the model call what is desired if we are calling cmdstanr directly but it would be nice to “set it and forget it,” particularly if you want to use a front end like brms which already calls multi-threading quite effectively and presumably (hopefully?) could benefit from other parallelization schemes in cmdstanr also. In particular, it wasn’t clear to me if cmdstanr would have to be “remade” entirely each time you switched computation method or if cmdstanr is happy to go back and forth as long as you set the environmental variable properly each time before running your model so cmdstanr has an updated default.

Can anyone clarify? Thanks much.

1 Like

Hi,
cmdstanr uses CmdStan in the background, so all configuration options for CmdStan (14 Parallelization | CmdStan User’s Guide) apply - I think those should allow you to set the environmental defaults as you like.

Best of luck using the sweet raw silicon power.

Great, thanks very much Martin.