Using R version 4.3.0 for mac [R-4.3.0-arm64.pkg] and brms 2.17.0, I get various problems when I try to build a brms model on a macbook air M2 (MacOS Monterey). The same thing happens with brms 2.19.0
First, the following is what happens when I specify to use more than one core (n.b. simple example just to illustrate the problem).
model <- brm(dist ~ speed, data=cars, cores=2)
Compiling Stan program...
Start sampling
SAMPLING
FOR MODEL '70132a8135bce8c931d49bdfcfc12cae' NOW (CHAIN 1SAMPLING).
FOR MODEL '70132a8135bce8c931d49bdfcfc12cae' NOW (CHAIN 2).
SAMPLING FOR MODEL '70132a8135bce8c931d49bdfcfc12cae' NOW (CHAIN 4).
SAMPLING FOR MODEL '70132a8135bce8c931d49bdfcfc12cae' NOW (CHAIN 3).
Error in x@mode :
no applicable method for `@` applied to an object of class "NULL"
In addition: Warning messages:
1: In parallel::mclapply(1:chains, FUN = callFun, mc.preschedule = FALSE, :
2 parallel function calls did not deliver results
2: In parallel::mclapply(1:chains, FUN = callFun, mc.preschedule = FALSE, :
2 function calls resulted in an error
Second, if I specify to use only one core, then something like a user prompt appears saying "Selection: " and it doesn’t progress from there:
model <- brm(dist ~ speed, data=cars, cores=1)
Compiling Stan program...
Start sampling
SAMPLING FOR MODEL '70132a8135bce8c931d49bdfcfc12cae' NOW (CHAIN 1).
Selection:
If I try to type something (for example “1”) at the user prompt and hit return, then R crashes with a segmentation fault.
Did anybody else have this problem? If so, how did you solve it?
You need to either reinstall rstan 2.21 from source, or update to 2.26 via install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
@pbcl Can you report back on general performance of your Macbook Air? I need to buy myself a new laptop and the MB Air is very interesting but I am concerned that it may become too hot when I run more complex models and thus that it then becomes too slow. Any recommendations? I am coming from MBP 2016. The 14 inch and 16 seem either too small or big, which is why I am eyeing the Air.
Hi, I’m using the 13 inch Macbook air M2, and I haven’t noticed any big problems. I can run models about 4 times faster than on my previous machine (e.g. 4 hours on the M2 vs. 16 hours on the old machine; however, that was a 2013 macbook air, with only 2 cores).