stan-dev / cmdstanpy

CmdStanPy is a lightweight interface to Stan for Python users which provides the necessary objects and functions to compile a Stan program and fit the model to data using CmdStan.
BSD 3-Clause "New" or "Revised" License
149 stars 67 forks source link

add parallel options for multi-path pathfinder #738

Closed bob-carpenter closed 3 months ago

bob-carpenter commented 3 months ago

Summary:

It wold be nice to be able to run multi-path Pathfinder in parallel using multiple threads.

Current Version:

CmdStanPy 1.2.1

WardBrian commented 3 months ago

One can do this now, but it is a bit manual:

  1. Compile the model with {'STAN_THREADS':1} as a cpp_option
  2. Set os.environ['STAN_NUM_THREADS'] = number_of_desired_threads

Then, running pathfinder as normal should work as intended.

What would the desired API be here? A num_threads argument to pathfinder()? Would we want it to error if the model wasn't compiled with threading?

bob-carpenter commented 3 months ago

I think we just need to add that to the Pathfinder doc. If it were there, I would've found it.