Specifying path to compiled Stan program with cmdstanpy

Hi - With cmdstanpy is it possible to specify the path in CmdStanModel to where compiled Stan program will be saved, similar to the way you can with the output_dir argument in CmdStanModel.sample()?

The following is stated in the cmdstan guide:

The generated C++ code ( bernoulli.hpp ), object file ( bernoulli.o ) and the compiled executable will be placed in the same directory as the Stan program.

which makes it sound like the path is fixed to wherever the Stan program lives. But I wanted to check here in case I might be missing something.

I’m not sure if CmdStanPy has this but in CmdStanR you can specify dir when compiling:

mod <- cmdstan_model(stan_file, dir = "path/to/directory/for/executable")

You could see if that works with CmdStanPy but if not then probably worth opening an issue on GitHub to add this feature.

1 Like

Unfortunately that doesn’t work. I’ll open up an issue.

1 Like