Hi,
I’m trying to run a multithreaded model (using reduce_sum) but whenever I try running it use cmdstanr::sample
I get the below error
Running MCMC with 16 parallel chains, with 2 thread(s) per chain...
Chain 1 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 2 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 3 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 4 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 5 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 6 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 7 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 8 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 9 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 10 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 11 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 12 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 13 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 14 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 15 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
Chain 16 ./ts_model: symbol lookup error: ./ts_model: undefined symbol: _ZN3tbb10interface78internal20isolate_within_arenaERNS1_13delegate_baseEl
I’m using cmdstanr
0.4.0.9001 and CmdStan version 2.29. I’m running on Ubuntu Linux.
This is the output from compiling my model (notice that I don’t find a *_threads version of my model being compiled).
ts_model <- cmdstan_model("ts_model.stan", include_paths = here::here(), force = T, quiet = FALSE, cpp_options = list(stan_threads = TRUE))
Compiling Stan program...
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes -DSTAN_THREADS -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.0.0/include -I stan/lib/stan_math/lib/sundials_6.0.0/src/sundials -DBOOST_DISABLE_ASSERTS -c -MT stan/src/stan/model/model_header_threads.hpp.gch -MT stan/src/stan/model/model_header_threads.d -MM -E -MG -MP -MF stan/src/stan/model/model_header_threads.d stan/src/stan/model/model_header.hpp
--- Compiling the main object file. This might take up to a minute. ---
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes -DSTAN_THREADS -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.0.0/include -I stan/lib/stan_math/lib/sundials_6.0.0/src/sundials -DBOOST_DISABLE_ASSERTS -c -o src/cmdstan/main_threads.o src/cmdstan/main.cpp
--- Compiling pre-compiled header. This might take a few seconds. ---
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes -DSTAN_THREADS -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.0.0/include -I stan/lib/stan_math/lib/sundials_6.0.0/src/sundials -DBOOST_DISABLE_ASSERTS -c stan/src/stan/model/model_header.hpp -o stan/src/stan/model/model_header_threads.hpp.gch
--- Translating Stan model to C++ code ---
bin/stanc --include-paths=/home/karim/Code/science/cont-net-cash-elasticity --name='ts_model_model' --o=/tmp/RtmpXo4x9z/model-10b631f469e0.hpp /tmp/RtmpXo4x9z/model-10b631f469e0.stan
--- Compiling, linking C++ code ---
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes -DSTAN_THREADS -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.0.0/include -I stan/lib/stan_math/lib/sundials_6.0.0/src/sundials -DBOOST_DISABLE_ASSERTS -c -Wno-ignored-attributes -x c++ -o /tmp/RtmpXo4x9z/model-10b631f469e0.o /tmp/RtmpXo4x9z/model-10b631f469e0.hpp
g++ -std=c++1y -pthread -D_REENTRANT -Wno-sign-compare -Wno-ignored-attributes -DSTAN_THREADS -I stan/lib/stan_math/lib/tbb_2020.3/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I lib/CLI11-1.9.1/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.9 -I stan/lib/stan_math/lib/boost_1.75.0 -I stan/lib/stan_math/lib/sundials_6.0.0/include -I stan/lib/stan_math/lib/sundials_6.0.0/src/sundials -DBOOST_DISABLE_ASSERTS -Wl,-L,"/home/karim/.cmdstan/cmdstan-2.29.0/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/home/karim/.cmdstan/cmdstan-2.29.0/stan/lib/stan_math/lib/tbb" /tmp/RtmpXo4x9z/model-10b631f469e0.o src/cmdstan/main_threads.o -Wl,-L,"/home/karim/.cmdstan/cmdstan-2.29.0/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"/home/karim/.cmdstan/cmdstan-2.29.0/stan/lib/stan_math/lib/tbb" stan/lib/stan_math/lib/sundials_6.0.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_6.0.0/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_6.0.0/lib/libsundials_idas.a stan/lib/stan_math/lib/sundials_6.0.0/lib/libsundials_kinsol.a stan/lib/stan_math/lib/tbb/libtbb.so.2 -o /tmp/RtmpXo4x9z/model-10b631f469e0
rm -f /tmp/RtmpXo4x9z/model-10b631f469e0.o
The very same configuration and model compiled and runs normally on my Mac laptop.