Problem with brms multithreading on mac

Short summary of the problem

> oa_base <- bf(Y ~  1 + HOA_adj +OOAtot_adj + BBOA_adj )
> brm(oa_base, data=data, family=lognormal(),threads=6, chains=1, iter=2000, backend="cmdstanr")
Syntax error in '/var/folders/dm/b79x42n96dl9s8jpb4t3_9lc0000gp/T/Rtmpylu12l/model_d7f2057555a38c5b86087ef97f381673.stan', line 10, column 5 to column 6, parsing error:
   -------------------------------------------------
     8:     *   an integer sequence from start to end
     9:     */
    10:    int[] sequence(int start, int end) {
              ^
    11:      array[end - start + 1] int seq;
    12:      for (n in 1:num_elements(seq)) {
   -------------------------------------------------

An identifier is expected as a function name.

Error: Syntax error found! See the message above for more information.

Some extra info

This is cmdstanr version 0.7.1

That function was updated in this commit, which it appears has not yet been released on CRAN but is available from github


remotes::install_github("paul-buerkner/brms")
)

> brm(oa_base, data=data, family=lognormal(),threads=6,  chains=1, iter=2000, backend="cmdstanr")
Syntax error in '/var/folders/dm/b79x42n96dl9s8jpb4t3_9lc0000gp/T/Rtmpylu12l/model_6734b1953b6473a7fd18c7eef66be4fd.stan', line 18, column 31 to column 32, parsing error:
   -------------------------------------------------
    16:    }
    17:    // compute partial sums of the log-likelihood
    18:    real partial_log_lik_lpmf(int[] seq, int start, int end, data vector Y, data matrix Xc, vector b, real Intercept, real sigma) {
                                        ^
    19:      real ptarget = 0;
    20:      int N = end - start + 1;
   -------------------------------------------------

An identifier is expected as a function argument name.

Error: Syntax error found! See the message above for more information.

[1] cmdstanr_0.7.1 brms_2.20.12 Rcpp_1.0.12

I think you need to restart R. The latest brms is almost surely fixing it.

1 Like

Yes indid, issue is fixed, thank you!

Hello @paul.buerkner , I am still having this issue even though restart R multiple times.

Syntax error in ‘/var/folders/0d/ct1y3jz13yq8r33b3ppm2bsh0000gq/T/RtmprSUkCS/model_0e750b5254c85aba9feebcffc1324d81.stan’, line 10, column 5 to column 6, parsing error:

 8:     *   an integer sequence from start to end
 9:     */
10:    int[] sequence(int start, int end) {
          ^
11:      array[end - start + 1] int seq;
12:      for (n in 1:num_elements(seq)) {

An identifier is expected as a function name.

Error: Syntax error found! See the message above for more information.

My R Session Info:
attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] cmdstanr_0.7.1 brms_2.20.4 Rcpp_1.0.12

loaded via a namespace (and not attached):
[1] tidyselect_1.2.0 dplyr_1.1.4 farver_2.1.1 loo_2.6.0 fastmap_1.1.1 tensorA_0.36.2.1
[7] shinystan_2.6.0 promises_1.2.1 shinyjs_2.1.0 digest_0.6.33 mime_0.12 lifecycle_1.0.4
[13] StanHeaders_2.32.5 ellipsis_0.3.2 processx_3.8.3 magrittr_2.0.3 posterior_1.5.0 compiler_4.3.1
[19] rlang_1.1.2 tools_4.3.1 igraph_1.6.0 utf8_1.2.4 knitr_1.45 bridgesampling_1.1-2
[25] htmlwidgets_1.6.4 pkgbuild_1.4.3 curl_5.1.0 plyr_1.8.9 dygraphs_1.1.1.6 abind_1.4-5
[31] miniUI_0.1.1.1 withr_2.5.2 grid_4.3.1 stats4_4.3.1 fansi_1.0.5 xts_0.13.1
[37] xtable_1.8-4 colorspace_2.1-0 inline_0.3.19 ggplot2_3.4.4 scales_1.3.0 gtools_3.9.5
[43] cli_3.6.1 mvtnorm_1.2-4 generics_0.1.3 RcppParallel_5.1.7 rstudioapi_0.15.0 tzdb_0.4.0
[49] reshape2_1.4.4 rstan_2.32.5 stringr_1.5.1 shinythemes_1.2.0 bayesplot_1.10.0 parallel_4.3.1
[55] matrixStats_1.2.0 base64enc_0.1-3 vctrs_0.6.5 V8_4.4.0 Matrix_1.5-4.1 jsonlite_1.8.7
[61] hms_1.1.3 crosstalk_1.2.1 glue_1.6.2 ps_1.7.6 codetools_0.2-19 DT_0.31
[67] distributional_0.3.2 stringi_1.8.3 gtable_0.3.4 later_1.3.2 QuickJSR_1.0.9 munsell_0.5.0
[73] tibble_3.2.1 colourpicker_1.3.0 pillar_1.9.0 htmltools_0.5.7 Brobdingnag_1.2-9 R6_2.5.1
[79] shiny_1.8.0 lattice_0.21-8 markdown_1.12 readr_2.1.5 backports_1.4.1 threejs_0.3.3
[85] httpuv_1.6.13 rstantools_2.3.1.1 coda_0.19-4 gridExtra_2.3 nlme_3.1-162 checkmate_2.3.1
[91] xfun_0.41 zoo_1.8-12 pkgconfig_2.0.3

As noted above, you need to install the latest development version from github where this is fixed