Nutpie and Stan functionality

Before I proceed with implementing nutpie in my workflows, are any of Stan’s functionalities lost when using it? For example, does it retain support for parallelization features such as reduce_sum and map_rect?

nutpie uses a project called BridgeStan to call Stan models, and it is built on the same C++ core as things like cmdstan. Anything that isn’t equivalent would be considered a bug we want to fix

Quick follow up would you recommend separating the my cmdstanpy virtual environments from nutpie virtual environments to avoid any issues?

Add i separated implementations and when i try to run the nutpie environment I get this error.

Traceback (most recent call last):
File “/home/harrison-curtis/Desktop/githubrepos/pymc_rba/cmdstanpy_implementation/rba_stan_nutpie.py”, line 34, in
compiled = nutpie.compile_stan_model(filename=“stanfiles/rba.stan”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/harrison-curtis/miniconda3/envs/nutpie_env/lib/python3.12/site-packages/nutpie/compile_stan.py”, line 162, in compile_stan_model
so_path = bridgestan.compile_model(
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/harrison-curtis/miniconda3/envs/nutpie_env/lib/python3.12/site-packages/bridgestan/compile.py”, line 142, in compile_model
raise RuntimeError(error)
RuntimeError: Command make STAN_THREADS=true STANCFLAGS=–include-paths=. /tmp/tmp5nz_nbch/model_model.so failed with code 2.
stdout:

stderr:
stan/lib/stan_math/make/compiler_flags:145: “Stan cannot detect if your compiler has the C++17 standard. If it does, please set STAN_HAS_CXX17=true in your make/local file. C++17 support is mandatory in the next release of Stan. Defaulting to C++14”
stan/lib/stan_math/make/libraries:114: *** “Need to set TBB_CXX_TYPE for non-standard compiler other than gcc or clang.”. Stop.

Any known fixes.

Is your compiler coming from conda? If so, you will probably need to add a local file to ~/.bridgestan/bridgestan-2.5.0 in a new directory called makeand set TBB_CXX_TYPE.

If you have cmdstan in the same environment, you could also try copying its make/local that conda sets up for you

Thank you Brian that has worked.

1 Like