I am trying to run the development branch of cmdstan on a cluster (which runs Red Hat-based Linux), but I am getting errors when trying to compile the stan model into an executable.
The behavior is odd because I am able to clone, build, compile and run the bernoulli example model locally (Debian-based Linux) for the development branch as well as versions 2.18.0 and 2.18.1. On the cluster these two releases also work without problem, but development builds but then fails to compile the executable.
Some additional information/questions:
-
I think I got the same, or similar, error on a separate cluster (otherwise very similar to the problematic one), but I dismissed it as a mismatch in the -jN flag and the number of cores or something and tried again with a different number or without the flag altogether, I can’t recall precisely; it just went away.
Could some of that have fixed it anyhow, and will this affect the sampling performance? -
In the case of a cluster, where the number of cores/CPUs can change according to the job, should stan be built again each time with the corresponding -jN to match the number of cores?
Thanks in advance for the help.
The output of make examples/bernoulli/bernoulli
after building CmdStan with make build
(no -jN flag) is below:
--- CmdStan v2.18.1 built ---
$ make examples/bernoulli/bernoulli
--- Translating Stan model to C++ code ---
bin/stanc --o=examples/bernoulli/bernoulli.hpp examples/bernoulli/bernoulli.stan
Model name=bernoulli_model
Input file=examples/bernoulli/bernoulli.stan
Output file=examples/bernoulli/bernoulli.hpp
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -c -MT examples/bernoulli/bernoulli.o -MT examples/bernoulli/bernoulli -include examples/bernoulli/bernoulli.hpp -include src/cmdstan/main.cpp -MM -E -MG -MP -MF examples/bernoulli/bernoulli.d examples/bernoulli/bernoulli.hpp
--- Linking C++ model ---
g++ -std=c++1y -pthread -Wno-sign-compare -O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.66.0 -I stan/lib/stan_math/lib/sundials_3.1.0/include -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -include examples/bernoulli/bernoulli.hpp src/cmdstan/main.cpp stan/lib/stan_math/lib/sundials_3.1.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/sundials_3.1.0/lib/libsundials_cvodes.a stan/lib/stan_math/lib/sundials_3.1.0/lib/libsundials_idas.a -o examples/bernoulli/bernoulli
In file included from stan/lib/stan_math/stan/math/rev/mat/fun/ordered_constrain.hpp:6:0,
from stan/lib/stan_math/stan/math/rev/mat.hpp:41,
from stan/lib/stan_math/stan/math.hpp:4,
from stan/src/stan/model/model_header.hpp:4,
from ./examples/bernoulli/bernoulli.hpp:3,
from <command-line>:0:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:31:32: error: ‘std::index_sequence’ has not been declared
std::index_sequence<I...> i) {
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:31:46: error: expected ‘,’ or ‘...’ before ‘<’ token
std::index_sequence<I...> i) {
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp: In function ‘constexpr auto stan::math::internal::apply(const F&, const Tuple&)’:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:27: error: ‘make_index_sequence’ is not a member of ‘std’
return apply_impl(f, t, std::make_index_sequence<std::tuple_size<Tuple>{}>{});
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:27: note: suggested alternative:
In file included from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/container/vector/vector.hpp:28:0,
from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/container/vector/vector10.hpp:25,
from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/view/transform_view/transform_view.hpp:22,
from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/algorithm/transformation/transform.hpp:11,
from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/view/zip_view/detail/begin_impl.hpp:14,
from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/view/zip_view/zip_view.hpp:16,
from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/view/zip_view.hpp:12,
from stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/include/zip_view.hpp:11,
from stan/lib/stan_math/lib/boost_1.66.0/boost/numeric/odeint/util/resize.hpp:26,
from stan/lib/stan_math/lib/boost_1.66.0/boost/numeric/odeint/util/state_wrapper.hpp:26,
from stan/lib/stan_math/lib/boost_1.66.0/boost/numeric/odeint/util/ublas_wrapper.hpp:33,
from stan/lib/stan_math/lib/boost_1.66.0/boost/numeric/odeint.hpp:25,
from stan/lib/stan_math/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:17,
from stan/lib/stan_math/stan/math/prim/arr.hpp:43,
from stan/lib/stan_math/stan/math/prim/mat.hpp:325,
from stan/lib/stan_math/stan/math/rev/mat.hpp:12,
from stan/lib/stan_math/stan/math.hpp:4,
from stan/src/stan/model/model_header.hpp:4,
from ./examples/bernoulli/bernoulli.hpp:3,
from <command-line>:0:
stan/lib/stan_math/lib/boost_1.66.0/boost/fusion/support/detail/index_sequence.hpp:59:12: note: ‘boost::fusion::detail::make_index_sequence’
struct make_index_sequence
^
In file included from stan/lib/stan_math/stan/math/rev/mat/fun/ordered_constrain.hpp:6:0,
from stan/lib/stan_math/stan/math/rev/mat.hpp:41,
from stan/lib/stan_math/stan/math.hpp:4,
from stan/src/stan/model/model_header.hpp:4,
from ./examples/bernoulli/bernoulli.hpp:3,
from <command-line>:0:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:77: error: expected primary-expression before ‘{’ token
return apply_impl(f, t, std::make_index_sequence<std::tuple_size<Tuple>{}>{});
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:77: error: expected ‘)’ before ‘{’ token
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp: At global scope:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:151:9: error: expected type-specifier
= std::result_of_t<F(decltype(is_var_), decltype(value_of(Targs()))...)>;
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:156:42: error: ‘FReturnType’ was not declared in this scope
std::array<int, internal::compute_dims<FReturnType>::value> M_;
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:156:53: error: template argument 1 is invalid
std::array<int, internal::compute_dims<FReturnType>::value> M_;
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:156:61: error: template argument 2 is invalid
std::array<int, internal::compute_dims<FReturnType>::value> M_;
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp: In member function ‘std::vector<stan::math::var> stan::math::adj_jac_vari<F, Targs>::build_return_varis_and_vars(const std::vector<double>&)’:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:349:9: error: invalid types ‘int[int]’ for array subscript
M_[0] = val_y.size();
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:350:32: error: invalid types ‘int[int]’ for array subscript
std::vector<var> var_y(M_[0]);
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp: In member function ‘Eigen::Matrix<stan::math::var, R, C> stan::math::adj_jac_vari<F, Targs>::build_return_varis_and_vars(const Eigen::Matrix<double, R, C>&)’:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:375:9: error: invalid types ‘int[int]’ for array subscript
M_[0] = val_y.rows();
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:376:9: error: invalid types ‘int[int]’ for array subscript
M_[1] = val_y.cols();
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:377:40: error: invalid types ‘int[int]’ for array subscript
Eigen::Matrix<var, R, C> var_y(M_[0], M_[1]);
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:377:47: error: invalid types ‘int[int]’ for array subscript
Eigen::Matrix<var, R, C> var_y(M_[0], M_[1]);
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp: In member function ‘void stan::math::adj_jac_vari<F, Targs>::chain()’:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:530:5: error: ‘FReturnType’ was not declared in this scope
FReturnType y_adj;
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:530:17: error: expected ‘;’ before ‘y_adj’
FReturnType y_adj;
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:532:38: error: ‘y_adj’ was not declared in this scope
internal::build_y_adj(y_vi_, M_, y_adj);
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:536:26: error: expansion pattern ‘auto&&’ contains no argument packs
[this](auto&&... args) { this->accumulate_adjoints(args...); },
^
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp: In lambda function:
stan/lib/stan_math/stan/math/rev/mat/functor/adj_jac_apply.hpp:536:60: error: ‘args’ was not declared in this scope
[this](auto&&... args) { this->accumulate_adjoints(args...); },
^
make: *** [examples/bernoulli/bernoulli] Error 1