rstan 2.18.2/StanHeaders 2.18.0 works on RHEL 7.3, but not 2.19.*
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
Using 8 schools example, rstan works on version 2.18., but not on 2.19., even though both install fine.
Description:
Followed installation guide, as well as specific instructions for CentOS. Both rstan and StanHeaders install fine on version 2.18.* and 2.19*, but only former works.
Reproducible Steps:
rstan 2.18.2
> library(rstan)
Loading required package: ggplot2
Loading required package: StanHeaders
rstan (Version 2.18.2, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
>
> model_code <- "
+ data {
+ int<lower=0> J; // number of schools
+ real y[J]; // estimated treatment effects
+ real<lower=0> sigma[J]; // standard error of effect estimates
+ }
+ parameters {
+ real mu; // population treatment effect
+ real<lower=0> tau; // standard deviation in treatment effects
+ vector[J] eta; // unscaled deviation from mu by school
+ }
+ transformed parameters {
+ vector[J] theta = mu + tau * eta; // school treatment effects
+ }
+ model {
+ target += normal_lpdf(eta | 0, 1); // prior log-density
+ target += normal_lpdf(y | theta, sigma); // log-likelihood
+ }
+ "
>
> schools_dat <- list(J = 8,
+ y = c(28, 8, -3, 7, -1, 1, 18, 12),
+ sigma = c(15, 10, 16, 11, 9, 11, 10, 18))
>
> fit <- stan(model_code = model_code, data = schools_dat)
SAMPLING FOR MODEL '32af4e878d1455a0a170e2073248307e' NOW (CHAIN 1).
Chain 1:
Chain 1: Gradient evaluation took 0 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1:
Chain 1:
Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 0.04 seconds (Warm-up)
Chain 1: 0.05 seconds (Sampling)
Chain 1: 0.09 seconds (Total)
Chain 1:
SAMPLING FOR MODEL '32af4e878d1455a0a170e2073248307e' NOW (CHAIN 2).
Chain 2:
Chain 2: Gradient evaluation took 0 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2:
Chain 2:
Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2:
Chain 2: Elapsed Time: 0.04 seconds (Warm-up)
Chain 2: 0.06 seconds (Sampling)
Chain 2: 0.1 seconds (Total)
Chain 2:
SAMPLING FOR MODEL '32af4e878d1455a0a170e2073248307e' NOW (CHAIN 3).
Chain 3:
Chain 3: Gradient evaluation took 0 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3:
Chain 3:
Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 3: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 3:
Chain 3: Elapsed Time: 0.04 seconds (Warm-up)
Chain 3: 0.08 seconds (Sampling)
Chain 3: 0.12 seconds (Total)
Chain 3:
SAMPLING FOR MODEL '32af4e878d1455a0a170e2073248307e' NOW (CHAIN 4).
Chain 4:
Chain 4: Gradient evaluation took 0 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4:
Chain 4:
Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 4: Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 4: Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 4: Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 4: Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%] (Sampling)
Chain 4:
Chain 4: Elapsed Time: 0.04 seconds (Warm-up)
Chain 4: 0.04 seconds (Sampling)
Chain 4: 0.08 seconds (Total)
Chain 4:
Warning messages:
1: There were 1 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
2: Examine the pairs() plot to diagnose sampling problems
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.3 (Maipo)
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.18.2 ggplot2_3.2.1 StanHeaders_2.18.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 magrittr_1.5 tidyselect_0.2.5 munsell_0.5.0
[5] colorspace_1.4-1 R6_2.4.0 rlang_0.4.0 dplyr_0.8.3
[9] tools_3.6.0 parallel_3.6.0 pkgbuild_1.0.3 grid_3.6.0
[13] gtable_0.3.0 loo_2.1.0 cli_1.1.0 withr_2.1.2
[17] matrixStats_0.54.0 lazyeval_0.2.2 assertthat_0.2.1 tibble_2.1.3
[21] crayon_1.3.4 processx_3.3.0 gridExtra_2.3 purrr_0.3.2
[25] callr_3.2.0 ps_1.3.0 fs_1.2.7 inline_0.3.15
[29] glue_1.3.1 compiler_3.6.0 pillar_1.4.3 prettyunits_1.0.2
[33] scales_1.0.0 stats4_3.6.0 pkgconfig_2.0.2
rstan 2.19.*
> library(rstan)
>
> model_code <- "
+ data {
+ int<lower=0> J; // number of schools
+ real y[J]; // estimated treatment effects
+ real<lower=0> sigma[J]; // standard error of effect estimates
+ }
+ parameters {
+ real mu; // population treatment effect
+ real<lower=0> tau; // standard deviation in treatment effects
+ vector[J] eta; // unscaled deviation from mu by school
+ }
+ transformed parameters {
+ vector[J] theta = mu + tau * eta; // school treatment effects
+ }
+ model {
+ target += normal_lpdf(eta | 0, 1); // prior log-density
+ target += normal_lpdf(y | theta, sigma); // log-likelihood
+ }
+ "
>
> schools_dat <- list(J = 8,
+ y = c(28, 8, -3, 7, -1, 1, 18, 12),
+ sigma = c(15, 10, 16, 11, 9, 11, 10, 18))
>
> fit <- stan(model_code = model_code, data = schools_dat)
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! filec242167e6173.cpp:6:36: warning: ISO C99 requires whitespace after the macro name [enabled by default]
#define STAN__SERVICES__COMMAND_HPP#include <boost/integer/integer_log2.hpp>
^
In file included from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat/fun/ordered_constrain.hpp:6:0,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat.hpp:41,
from /usr/lib64/R/library/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/src/stan/model/test_gradients.hpp:7,
from /usr/lib64/R/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10,
from /usr/lib64/R/library/rstan/include/rstan/stan_fit.hpp:35,
from /usr/lib64/R/library/rstan/include/rstan/rstaninc.hpp:3,
from filec242167e6173.cpp:7:
/u
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command '/usr/lib64/R/bin/R CMD SHLIB filec242167e6173.cpp 2> filec242167e6173.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.3 (Maipo)
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.19.3 ggplot2_3.2.1 StanHeaders_2.19.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 magrittr_1.5 tidyselect_0.2.5 munsell_0.5.0
[5] colorspace_1.4-1 R6_2.4.0 rlang_0.4.0 dplyr_0.8.3
[9] tools_3.6.0 parallel_3.6.0 pkgbuild_1.0.3 grid_3.6.0
[13] gtable_0.3.0 loo_2.1.0 cli_1.1.0 withr_2.1.2
[17] matrixStats_0.54.0 lazyeval_0.2.2 assertthat_0.2.1 tibble_2.1.3
[21] crayon_1.3.4 processx_3.3.0 gridExtra_2.3 purrr_0.3.2
[25] callr_3.2.0 ps_1.3.0 fs_1.2.7 inline_0.3.15
[29] glue_1.3.1 compiler_3.6.0 pillar_1.4.3 prettyunits_1.0.2
[33] scales_1.0.0 stats4_3.6.0 pkgconfig_2.0.2
Current Output:
See section above.
Expected Output:
Expected both versions to to run, but only 2.18.* does.
RStan Version:
-
2.18.* running on 2.18.2
-
2.19.* running on 2.19.3
R Version:
3.6.0.
Operating System:
-bash-4.2$ gcc --version
gcc (GCC) 4.9.3
-bash-4.2$ uname -a
Linux ohylpyt1-d 3.10.0-514.6.1.el7.x86_64 #1 SMP Sat Dec 10 11:15:38 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the RStan Getting Started 8 schools example and reproduce the failure at stan(model_code = model_code, data = schools_dat), then inspect the compileCode output on RHEL 7.3 with R 3.6.0 and GCC 4.9.3. Compare the working 2.18.2/StanHeaders 2.18.0 setup with rstan 2.19.3/StanHeaders 2.19.2; done means the example compiles and runs on the reported platform.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100