auto_write=TRUE only works for cores > 1?

309 views
Skip to first unread message

Per Nielsen

unread,
Aug 4, 2015, 4:02:49 AM8/4/15
to Stan users mailing list
Hi all

Thank you the new release of stan, it brings some nice features! Especially rstan_options(auto_write = TRUE), was a welcome addition. However, I can only get it to work when the cores argument is larger than 1. Is this intentional?

I have attached a small script which shows the behavior.

Here is my system info and I have reproduced the behavior on an ubuntu virtual machine.

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shinyStan_1.0.0 shinyBS_0.50.1  shiny_0.12.1    ggplot2_1.0.1   RMySQL_0.10.3   DBI_0.3.1       rstan_2.7.0-1   inline_0.3.14   Rcpp_0.12.0    

loaded via a namespace (and not attached):
 [1] RColorBrewer_1.1-2 plyr_1.8.3         tools_3.2.1        digest_0.6.8       lubridate_1.3.3    memoise_0.2.1      gtable_0.1.2       parallel_3.2.1    
 [9] proto_0.3-10       gridExtra_0.9.1    dplyr_0.4.2        stringr_1.0.0      dabayes_1.0        stats4_3.2.1       grid_3.2.1         ellipse_0.3-8     
[17] R6_2.1.0           ISOweek_0.6-2      reshape2_1.4.1     magrittr_1.5       codetools_0.2-11   scales_0.2.5       htmltools_0.2.6    MASS_7.3-40       
[25] assertthat_0.1     mime_0.3           timeDate_3012.100  colorspace_1.2-6   xtable_1.7-4       httpuv_1.3.2       stringi_0.5-5      entropy_1.2.1     
[33] dautility_1.14     munsell_0.4.2 

rstan_auto_write.R

Ben Goodrich

unread,
Aug 4, 2015, 11:20:48 AM8/4/15
to Stan users mailing list
On Tuesday, August 4, 2015 at 4:02:49 AM UTC-4, Per Nielsen wrote:
Thank you the new release of stan, it brings some nice features! Especially rstan_options(auto_write = TRUE), was a welcome addition. However, I can only get it to work when the cores argument is larger than 1. Is this intentional?

I'm not sure what you mean. When I run it, it auto_writes a .rda model to tempdir() the first time it is called and reads it without recompiling the second time. If you do it in a new R session, the temporary directory is erased and it has to auto_write .rda model again the first time the first time it is called.

Ben


Per Nielsen

unread,
Aug 5, 2015, 2:30:40 AM8/5/15
to stan-...@googlegroups.com
I tried again with the modified script attached, and included outfrom the R console and tempdir. As the output shows, the code is compiled each time I loop, but something is changing in the temp (I did the ls command a few times during the loop). If I set cores = 2 in stan, I get the output from R_console_cores_2.txt, where it clearly does not compile.

Maybe I have some system setup issues?

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/23hsWoJ5hjU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

R_console_cores_2.txt
R_console.txt
script.R
tempdir.txt

Ben Goodrich

unread,
Aug 5, 2015, 7:10:21 AM8/5/15
to Stan users mailing list
On Wednesday, August 5, 2015 at 2:30:40 AM UTC-4, Per Nielsen wrote:
I tried again with the modified script attached, and included outfrom the R console and tempdir. As the output shows, the code is compiled each time I loop, but something is changing in the temp (I did the ls command a few times during the loop). If I set cores = 2 in stan, I get the output from R_console_cores_2.txt, where it clearly does not compile.

Maybe I have some system setup issues?

Can you try installing rstan from GitHub?

devtools::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan")

It is possible that some of the changes since v2.7.0-1 was released have fixed this behavior, which is why I am not seeing it.

Ben
 

On Tue, Aug 4, 2015 at 5:20 PM, Ben Goodrich <goodri...@gmail.com> wrote:
On Tuesday, August 4, 2015 at 4:02:49 AM UTC-4, Per Nielsen wrote:
Thank you the new release of stan, it brings some nice features! Especially rstan_options(auto_write = TRUE), was a welcome addition. However, I can only get it to work when the cores argument is larger than 1. Is this intentional?

I'm not sure what you mean. When I run it, it auto_writes a .rda model to tempdir() the first time it is called and reads it without recompiling the second time. If you do it in a new R session, the temporary directory is erased and it has to auto_write .rda model again the first time the first time it is called.

Ben


--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/23hsWoJ5hjU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.

Per Nielsen

unread,
Aug 10, 2015, 4:13:17 AM8/10/15
to stan-...@googlegroups.com
Hi Ben

Sorry for my long response time, I tried the dev release and now everyting works as expected :)

Per

To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/23hsWoJ5hjU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages