I am running into an issue while compiling a simple linear model via brms, but it appears to be a rstan issue. I googled around though I do not seem to find information on how to effective resolve it. I have tried installing both Rcpp and rstan from source but I still run in to this issue. Is there a workaround? is this a bug or something wrong with my setup? Here is the error I get:
Compiling the C++ model
Start sampling
starting worker pid=5249 on localhost:11481 at 15:33:46.552
starting worker pid=5272 on localhost:11481 at 15:33:46.834
starting worker pid=5295 on localhost:11481 at 15:33:47.145
starting worker pid=5319 on localhost:11481 at 15:33:47.428
SAMPLING FOR MODEL 'student(identity) brms-model' NOW (CHAIN 1).
Gradient evaluation took 0.00168 seconds
1000 transitions using 10 leapfrog steps per transition would take 16.8 seconds.
Adjust your expectations accordingly!
[1] "Error in sampler$call_sampler(args_list[[i]]) : "
[2] " c++ exception (unknown reason)"
error occurred during calling the sampler; sampling not done
Operating System: MacOS
Interface Version: Rstan
Output of writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”))):
The error still persists. Should I consider reinstalling rstan then? T
Edit:
I have reinstalled rstan. The Makevars contents is as follows.
CC=clang
CFLAGS= -g -O3 -Wall -pedantic -mtune=native -I/usr/local/opt/openssl/include
LDFLAGS= -L/usr/local/opt/openssl/lib -L/usr/local/clang4/lib
CXX=clang++ -arch x86_64 -ftemplate-depth-256
CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations
CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function
CXX=clang++ -arch x86_64 -ftemplate-depth-256
CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations
F77=/usr/local/bin/gfortran
I am getting the same error:
Gradient evaluation took 0.00261 seconds
1000 transitions using 10 leapfrog steps per transition would take 26.1 seconds.
Adjust your expectations accordingly!
[1] "Error in sampler$call_sampler(args_list[[i]]) : "
[2] " c++ exception (unknown reason)"
error occurred during calling the sampler; sampling not done
I am afraid I am running into the same error even after recompiling the model even after I started the R session and cleaned up the workspace. Renamed the variables and recompiled the model.
fit <- brm(bf(distance ~ status, sigma ~ status),
+ family = student,
+ data = dta,
+ iter = 2000,
+ chains = 4)
Compiling the C++ model
Start sampling
starting worker pid=24091 on localhost:11129 at 19:01:40.392
starting worker pid=24114 on localhost:11129 at 19:01:40.663
starting worker pid=24137 on localhost:11129 at 19:01:40.949
starting worker pid=24160 on localhost:11129 at 19:01:41.236
SAMPLING FOR MODEL 'student(identity) brms-model' NOW (CHAIN 1).
Gradient evaluation took 0.001779 seconds
1000 transitions using 10 leapfrog steps per transition would take 17.79 seconds.
Adjust your expectations accordingly!
[1] "Error in sampler$call_sampler(args_list[[i]]) : "
[2] " c++ exception (unknown reason)"
error occurred during calling the sampler; sampling not done
<truncated>
all: (SHLIB)
@if test -e "/usr/bin/install_name_tool" && test -e "/usr/local/clang4/lib/libc++.1.dylib" && test -e "/usr/lib/libc++.1.dylib"; then /usr/bin/install_name_tool -change /usr/local/clang4/lib/libc++.1.dylib /usr/lib/libc++.1.dylib (SHLIB); fi