Error in unserialize, rstan 2.18, problems with native mtune and march


OK, it is probably not related to -mtune=native -march=native then. The next thing to verify is that there are no errors when you call sampling with cores = 1.


Model compiles but trying sampling() now results in a fatal error, R session aborted. I tried cores = 1 with and without the -mtune=native -march=native in the Makevars file.

It may be worth noting that with my machine, parallel::detectCores(logical=TRUE) gives 8 while parallel::detectCores(logical=FALSE) gives 4

Edit: On a whim I decided to try switching the ODE solver in my model from integrate_ode_bdf() to integrare_ode_rk45. Now I don’t get a fatal error or an “Error in (un)serialize” but the sampling is not done and I get this error:

[1] "Error in sampler$call_sampler(args_list[[i]]) : "                                                   
[2] "  Exception: Max number of iterations exceeded (1000000).  (in 'model468f90242a_stage2' at line 88)"
[1] "error occurred during calling the sampler; sampling not done"

This looks like the program actually started to run but had some problem with the ode solver, which is a problem I can play around with on my own to try to fix. So maybe there’s some kind of issue with the parallelization in integrate_ode_bdf() ?

Algebraic Solver Problems on Windows?

I don’t think it has much to do with parallelization but integrate_ode_bdf has been problematic on Windows.


Hello @bgoodri @ScottAlder ,
I am also receiving the same error. A simpler version of my model runs ok but when it gets complicated the error appears. I tried to run with/without -march=native -mtune=native but the problem persists.
When I tried cores=1 the Rstudio crashed and the session aborted.

Any new suggestion how to fix this??


Since this is being brought up again, I do want to point out that I did encounter this error again, even while using the rk4 solver, when I tried to introduce a few more parameters to the ODE system. I was able to work without those extra parameters in the end though.


Just run the same piece of code on the uni’s linux server and works fine!. Still don’t know if it is a windows issue or an issue of my hardware.


I think it is a weird Windows issue


Thanks a lot. Just installed a virtual machine with ubundu and works fine!