Compilation Error when running on Linux Cluster


Hi All,
I am using a linux cluster at my university to try to run a particularly large model. I have however been getting intermittent compiler errors. It first started occurring when I tried to modify the adapt_delta parameter when calling the NUTS sampler. Strangely, I didn’t get these issues when I just used the default.

More recently, I edited my stan file and started getting another compiler error (I included the output in the attached file - sorry I can’t upload as I am a new user).
All of these models run fine on my laptop. I really am not sure where to begin debugging and updating on the cluster. Any advice would be greatly appreciated.

Thank you,


I don’t see an attached file. If Discourse doesn’t let you attach, just paste it.

Edit: Now I do. Maybe it just takes a second to appear.


What version of g++ do you have on the server and what is in your ~/.R/Makevars file?


Thanks for the quick reply!

On Server:

My Makevars file:

CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function

CXXFLAGS+=-flto -ffat-lto-objects -Wno-unused-local-typedefs

g++ version: 4.9.3 (I am guessing this could be the problem :))


Acctually, I am not sure if that is the problem after reading this (


Try again after deleting -flto -ffat-lto-objects from CXXFLAGS.


Unfortunately I am still getting an error.


Try again without -mtune=native -march=native in CXXFLAGS.


I am still getting the same error:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /gpfs/fs0/home/jds110/R/x86_64-unknown-linux-gnu-library/3.2.2/BH/include/boost/config.hpp:39:0,
from /gpfs/fs0/home/jds110/R/x86_64-unknown-linux-gnu-library/3.2.2/BH/include/boost/math/tools/config.hpp:13,
from /gpfs/fs0/home/jds110/R/x86_64-unknown-linux-gnu-library/3.2.2/StanHeaders/include/stan/math/rev/core/var.hpp:7,
from /gpfs/fs0/home/jds110/R/x86_64-unknown-linux-gnu-library/3.2.2/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
from /gpfs/fs0/home/jds110/R/x86_64-unknown-linux-gnu-library/3.2.2/StanHeaders/include/stan/math/rev/core.hpp:12,
from /gpfs/fs0/home/jds110/R/x86_64-unknown-linux-gnu-library/3.2.2/StanHeaders/include/stan/math/rev/mat.hpp:4,
from /gpfs/fs0/home/jds110/R/x86_64-unknown-linux-gnu-library/3.2.2/StanHeaders/include/stan/math.hpp:4,
from /gp
Calls: stan_model -> cxxfunctionplus -> cxxfunction -> compileCode
In addition: Warning message:
running command ‘/nfs/software/helmod/apps/Core/R_core/3.2.2-fasrc03/lib64/R/bin/R CMD SHLIB file138c32e57062e.cpp 2> file138c32e57062e.cpp.err.txt’ had status 1
Execution halted

Just to confirm here is how my Makevars file looks now.

CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function

CXXFLAGS+=-Wno-unused-local-typedefs -mtune=native -march=native


Makevars should be

CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function -Wno-unused-local-typedefs

as in without the stuff about -mtune=native -march=native.


Hey it worked!!! Thank you so much!


So… Turns out I am acctually still getting the error. It ran once, but when I tried changing the adapt_delta parameter I ended up getting the same error.


If you specify adapt_delta to be the default value of 0.8, does it error?


I am sorry. I was mistaken, even if I don’t specify adapt_delta at all I have problems.

I had the same problem when I tried to compile the code as follows:

model <-stanc_builder("csme_indepdent_multivariate_dlm_nofilter, isystem=paths[[machine]]$results)
write(model$model_code, file=“tmp.stan”)
m <- stan_model(model_code = model$model_code, verbose = FALSE)


Is there a possibility of setting TEMPDIR to something that is not on a NFS drive?