hsbadr
December 15, 2021, 3:19am
22
Install RcppParallel
first from CRAN, preferably from source code, and check its flags:
install.packages("RcppParallel")
Then, install StanHeaders v2.26.6
followed by rstan v2.26.6
(will be ready soon).
remove.packages(c("rstan", "StanHeaders"))
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", \repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
Please let me know when x.x.6 is available.
I have installed RcppParallel
> install.packages("RcppParallel")
Installing package into â/stornext/Home/data/allstaff/m/mangiola.s/R/library_for_cell_sig_with_new_rstan/rstudioâ
(as âlibâ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RcppParallel_5.1.4.tar.gz'
Content type 'application/x-gzip' length 1967752 bytes (1.9 MB)
hsbadr
December 15, 2021, 4:26am
24
Sure thing.
Have you checked the flags? Also, itâs worth updating your R packages, which might cause a problem if youâve upgraded major R version.
update.packages(checkBuilt = TRUE, ask = FALSE)
Sorry, I am unfamiliar with this vocabulary :) Could you be more explicit?
hsbadr
December 15, 2021, 4:54am
26
No problem :)
I mean:
RcppParallel::LdFlags()
RcppParallel::CxxFlags()
BTW. rstan
/StanHeaders
packages v2.26.6 are ready for testing. Good luck!
1 Like
for version 5.1.4 I get empty (before LdFlags returned a value before I deleted rstan 2.26.5)
> RcppParallel::LdFlags()
> RcppParallel::CxxFlags()
And if I try to compile my model it âbadlyâ fails.
(I appreciate the time you are spending)
hsbadr
December 15, 2021, 6:54am
28
You need to fix RcppParallel before installing or testing RStan.
Unset TBB environment variables:
Sys.unsetenv("TBB_LIB")
Sys.unsetenv("TBB_INC")
Then, install RcppParallel and check its compiler flags:
install.packages("RcppParallel", type = "source")
RcppParallel::LdFlags()
RcppParallel::CxxFlags()
Make sure that you have the latest Rtools (UCRT), if on Windows.
Then, proceed with RStan.
I am not sure why my RcppParallel is broken, and I canât get the flags back
> unloadNamespace( asNamespace("rstan"))
> unloadNamespace( asNamespace("StanHeaders"))
> unloadNamespace( asNamespace("RcppParallel"))
> # Parallel
> .libPaths("~/R/library_for_cell_sig_with_new_rstan/rstudio")
> Sys.unsetenv("TBB_LIB")
> Sys.unsetenv("TBB_INC")
> install.packages("RcppParallel", type = "source")
Installing package into â/stornext/Home/data/allstaff/m/mangiola.s/R/library_for_cell_sig_with_new_rstan/rstudioâ
(as âlibâ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RcppParallel_5.1.4.tar.gz'
Content type 'application/x-gzip' length 1967752 bytes (1.9 MB)
==================================================
downloaded 1.9 MB
* installing *source* package âRcppParallelâ ...
** package âRcppParallelâ successfully unpacked and MD5 sums checked
** using staged installation
** preparing to configure package 'RcppParallel' ...
*** configured file: 'src/Makevars.in' => 'src/Makevars'
** finished configure for package 'RcppParallel'
** libs
(tbb) Building TBB using bundled sources ...
make[1]: Entering directory `/stornext/HPCScratch/mangiola.s_HPC_scratch/.Rtemp/RtmptF7fgH/R.INSTALL2a8e47fc33bb/RcppParallel/src/tbb/src'
make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
OS: linux
arch=intel64
compiler=gcc
runtime=cc11.1.0_libc2.17_kernel3.10.0
tbb_build_prefix=linux_intel64_gcc_cc11.1.0_libc2.17_kernel3.10.0
work_dir=/stornext/HPCScratch/mangiola.s_HPC_scratch/.Rtemp/RtmptF7fgH/R.INSTALL2a8e47fc33bb/RcppParallel/src/build/linux_intel64_gcc_cc11.1.0_libc2.17_kernel3.10.0_release
make[1]: Leaving directory `/stornext/HPCScratch/mangiola.s_HPC_scratch/.Rtemp/RtmptF7fgH/R.INSTALL2a8e47fc33bb/RcppParallel/src/tbb/src'
(tbb) TBB compilation finished successfully.
/stornext/System/data/apps/gcc/gcc-11.1.0/bin/g++ -std=gnu++14 -I"/stornext/System/data/apps/R/R-4.1.2/lib64/R/include" -DNDEBUG -I../inst/include -I/usr/local/include -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic -g -O2 -c init.cpp -o init.o
/stornext/System/data/apps/gcc/gcc-11.1.0/bin/g++ -std=gnu++14 -I"/stornext/System/data/apps/R/R-4.1.2/lib64/R/include" -DNDEBUG -I../inst/include -I/usr/local/include -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic -g -O2 -c options.cpp -o options.o
/stornext/System/data/apps/gcc/gcc-11.1.0/bin/g++ -std=gnu++14 -shared -L/stornext/System/data/apps/R/R-4.1.2/lib64/R/lib -L/usr/local/lib64 -o RcppParallel.so init.o options.o -L/stornext/System/data/apps/R/R-4.1.2/lib64/R/lib -lR
installing via 'install.libs.R' to /stornext/Home/data/allstaff/m/mangiola.s/R/library_for_cell_sig_with_new_rstan/rstudio/00LOCK-RcppParallel/00new/RcppParallel
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (RcppParallel)
The downloaded source packages are in
â/stornext/HPCScratch/mangiola.s_HPC_scratch/.Rtemp/RtmpCevbQD/downloaded_packagesâ
> RcppParallel::LdFlags()
> RcppParallel::CxxFlags()
hsbadr
December 15, 2021, 12:42pm
30
Whatâs the output of:
RcppParallel::tbbLibraryPath()
We could switch to this in RStan too.
hsbadr
December 15, 2021, 1:02pm
31
@stemangiola You reported that one of your models worked with v2.26.5. Does it still work with v2.26.6? If so, we can skip RcppParallel
flags, since one of the models compiles successfully, and troubleshoot the failed model (which could be a different problem). Are you able to compile 8school model now?
I found the problem,
if the program has a comment starting with # it fails badly, not providing any error message and preventing the compilation of working models until the session is restarted.
hsbadr
December 16, 2021, 12:59am
33
Great! That fixes your model, but kind of different from the OP. You originally reported that the example fails to compile with v2.26.4, which is fixed by both v2.26.5 & v2.26.6; right? Iâm trying to evaluate the changes in those versions.
As for the parser error, we handle some of those comment-related errors for stanc3
, but it seems that we need to extend the preprocessor to handle more cases.
No.
I am 90% sure that the comment # crashes all three versions in the same way. I have eliminated the comment and the model works, but this does not depend on the versions.
Just to say - I came across this issue today. I think I have up to date versions of the packages mentioned: R version 4.1.0, RStan 2.26.3, Rcpp 1.0.8.3, StanHeaders 2.26.3. It would be great if there was an informative error message, rather than just failing with the unhelpful âparser failed badlyâ.
Can you try upgrading to the latest 2.26.X version and see if the issue persists? The current rstan experimental version is 2.26.11.
Run the following:
remove.packages(c("rstan", "StanHeaders"))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
Same issue - it may be worth mentioning Iâm using hBayesDM, which is a wrapper around RStan.
packageVersion(ârstanâ)
[1] â2.26.11â
packageVersion(âStanHeadersâ)
[1] â2.26.11â
hsbadr
June 24, 2022, 10:14pm
40
Thatâs a known issue that we need to fix when parsing the headers from the code. The haspound
conditional needs to be updated to distinguish between #include
& comments.