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!