Cmdstanr installation finishes, but does not run on Red Hat Enterprise Linux 7.8

I’ve been using brms and with the cmdstanr successfully on a separate cluster, and I’m trying to help a colleague get set up on his cluster at another university. I must have gotten lucky when I installed it on my university’s cluster… Installation on his cluster has proven very difficult (for me). Any help is much appreciated.

Here we go.

I’m unable to get cmdstanr to install cmdstan on a computer cluster that uses Red Hat 7.8. I’ve tried following advice I’ve found in other posts and solicited help from the cluster administrator. But, I’m not sure what the issue is. I’ll try to provide all information I can below, because I’m entirely not sure what is relevant.

I set up the modules.

module purge
module load r/4.0 gcc/9 udunits/2.2 mpi/openmpi-1.10.7_gnu4.8.5
export UDUNITS2_INCLUDE=/apps/udunits/2.2.26_gcc9.2/include
export UDUNITS2_LIBS=/apps/udunits/2.2.26_gcc9.2/lib
export DOWNLOAD_STATIC_LIBV8=1

Here is my g++ version.

-bash-4.2$ g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here is my make version.

GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

g++ and make are compatible versions based on here. ( g++ version >= 4.9.3 and make version >= 3.81).

Here is everything in my .R/Makevars file

CXX14 = g++ -std=c++1y -Wno-unused-variable -Wno-unused-function -fPIC

I open R and run the following to install cmdstan 2.26.1.

install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

library(cmdstanr)

install_cmdstan(dir = '/fslhome/fslcollab40/cmdstanr_cmdstan',
                version = "2.26.1",
                overwrite = TRUE,
                cpp_option = list("CXX"="g++",
                                  "TBB_CXX_TYPE"="gcc"))

As far as I can tell, everything terminates succesfully.

Then when I load brms and try to use the cmdstanr the following model fails. It runs sucessfully when I do no use the cmdstanr backend.

fit_parallel <- brm(
+   count ~ zAge + zBase * Trt + (1|patient),
+   data = epilepsy, family = poisson(),
+   chains = 4, cores = 4, backend = "cmdstanr",
+   threads = threading(2)
+ )
Compiling Stan program...
Start sampling
Running MCMC with 4 parallel chains, with 2 thread(s) per chain...

Warning: Chain 1 finished unexpectedly!

Warning: Chain 2 finished unexpectedly!

Warning: Chain 3 finished unexpectedly!

Warning: Chain 4 finished unexpectedly!

Warning: Use read_cmdstan_csv() to read the results of the failed chains.
Error in rstan::read_stan_csv(out$output_files()) :
  csvfiles does not contain any CSV file name
In addition: Warning messages:
1: All chains finished unexpectedly! Use the $output(chain_id) method for more information.

2: No chains finished successfully. Unable to retrieve the fit.

If I navigate to the cmdstan-2.26.1 directory and try the bernouli example, it fails. I get the following…

-bash-4.2$ ./examples/bernoulli/bernoulli sample data file=examples/bernoulli/bernoulli.data.json
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)

It looks (to me) like cmdstan has been incorrectly built. Am I possibly using the wrong cpp_option for the modules I have loaded?

Where have I gone wrong? Any advice?

Thank you!!
Peter

Hi,

your g++ is not compatible.

The output form g++ --version states that you have g++ 4.8.5, but you should have 4.9.3.
I would strongly encourage at least g++ 8 if possible as the difference in compile time and speed is noticeable.

Yikes. After I even said that I checked that…

Thanks for the quick reply. I’ll give it a shot and let you know.

Thanks!

1 Like

I purged all modules and loaded the new relevant ones .I deleted the previous installation of cmdstanr.

I’m using a compatible g++ version.

g++ (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I re-installed cmdstan using the same commands above. I got the same issue within R that produced the same output as above.

I tried running the bernoulli example in the terminal, and I have the same issue as above.

-bash-4.2$ ./examples/bernoulli/bernoulli sample data file=examples/bernoulli/bernoulli.data.json
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./examples/bernoulli/bernoulli)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)
./examples/bernoulli/bernoulli: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /zhome/fslcollab40/cmdstanr_cmdstan/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.so.2)

Hmmm… Any other suggestions?

Thanks.

Hmm, not sure anymore now.

Can you try running:

sudo apt-get update
sudo apt-get install libstdc++6

or equivalent in red hat (sorry, never actually used red hat, its yum right?

I’m following up with the admin person to help with this piece, because linux is largely beyond me. I’ll let you know what happens.

Thanks.

1 Like

My admin person had me use a more recent mpi that is compatible with gcc 10, instead of running the sudo commands.

(for posterity’s sake…)

I loaded the following modules…

module add r/4.0 gcc/10 openmpi/4.0

Fixed my environmental variable with the appropriate paths using…

export LDFLAGS="-Wl,--enable-new-dtags,-rpath,$LD_RUN_PATH"

Then I was able to use cmdstanr without any problems.

Thanks for your help, @rok_cesnovar!

2 Likes

Thank you! Hopefully this helps anyone facing the same issue in the future. Appreciate the follow up.

1 Like