Search code examples
linuxstanrstan

Stan code works on Windows but not Linux


I have the following Stan code working perfectly fine when used with rstan on Windows. However, when running on a cluster with Linux (CentOS 6), it throws out a very long error which includes ~500 lines of, I guess, Rcpp code and the last chunk is as follows:

Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! In file included from /scratch/user/siamak/R_libs/StanHeaders/include/stan/math/rev/mat.hpp(15), from /scratch/user/siamak/R_libs/StanHeaders/include/stan/math.hpp(4), from /scratch/user/siamak/R_libs/StanHeaders/include/src/stan/model/model_header.hpp(4), from file6ff02c925624.cpp(8): /general/software/x86_64/tamusc/R_tamu/R_LIBS/3.3.2-iomkl-2017A-Python-2.7.12-default-mt/RcppEigen/include/Eigen/src/Cholesky/LLT.h(57): error: class "Eigen::Ref>" has no member "Options" Options = MatrixType::Options, ^ detected during instantiation of class "Eigen::LLT<_MatrixType, _UpLo> [with _MatrixType=Eigen::Ref>, _UpLo=1]" at line 247 of "/scratch/user/siamak/R_libs/StanHeaders/include/stan/math/rev/mat/fun/cholesky_decompose.hpp" In file included fro In addition: Warning message: running command '/sw/eb/software/R/3.3.2-iomkl-2017A-Python-2.7.12-default-mt/lib64/R/bin/R CMD SHLIB file6ff02c925624.cpp 2> file6ff02c925624.cpp.err.txt' had status 1

Any opinions?

data{
int<lower=0> n;          //number of points
int<lower=1> d;          //dimension
int<lower=1> G;          //number of groups
int<lower=0> M;
int<lower=1> Jg[M];
int<lower=1> Start[G];
int<lower=1> End[G];
int<lower=1,upper=G> Ig[n];
matrix[d,n] X;
cov_matrix[d] Lambda;
real<lower=d-1> nu;
cov_matrix[d] B;
vector[d] m;
}

parameters{
vector[d] mu;            //mean
cov_matrix[d] Sigma;   //covariance
}


model{
//prior
Sigma ~ inv_wishart(nu,Lambda);
mu ~ multi_normal(m,B);
//likelihood
for (i in 1:n){
    X[Jg[Start[Ig[i]]:End[Ig[i]]],i] ~ 
 multi_normal(mu[Jg[Start[Ig[i]]:End[Ig[i]]]],
    Sigma[Jg[Start[Ig[i]]:End[Ig[i]]],Jg[Start[Ig[i]]:End[Ig[i]]]]);
    }
 }

Solution

  • The problem was the gcc6 compiler. I reinstalled rstan and Rcpp packages from the source and problem resolved!