rstanmulticore, rtan 2.7.0, and output of the progress of each chain

174 views
Skip to first unread message

Linas Mockus

unread,
Sep 3, 2015, 6:36:23 PM9/3/15
to Stan users mailing list
Hi,

Rstan allows to run chains in parallel using
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())

rstanmulticore allows running chains in parallel using pstan() instead of stan().

Is there a possibility to redirect the progress of each chain into some file
when chains run in parallel? By default progress goes to Rgui when number of
chains is 1.

I have used my own function to run chains in parallel but then decided to use
stan function in rstan 2.7.0 and now can't see the progress when running several
chains in parallel. (I am happy though because problem with neg_binomial_2_log_rng
was fixed and I can use generated quantities instad of estimating predictive
posterior in R).

Thanks,
Linas


Ben Goodrich

unread,
Sep 3, 2015, 9:34:30 PM9/3/15
to Stan users mailing list
Call stan() with open_progress = TRUE to see the progress in Internet Explorer, but we still don't know why the progress does not appear under RStudio for Windows.

Linas Mockus

unread,
Sep 4, 2015, 7:34:03 AM9/4/15
to stan-...@googlegroups.com
Many thanks.  Is this still not official - I did help(stan) and open_progress doesn't show up.  Will it work on FireFox or Chrome?

Thank you,
Linas
--
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/Ius8VWWR3M4/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.



--
Thank you,
Linas

Ben Goodrich

unread,
Sep 4, 2015, 8:53:08 AM9/4/15
to Stan users mailing list
On Friday, September 4, 2015 at 7:34:03 AM UTC-4, Linas Mockus wrote:
Many thanks.  Is this still not official - I did help(stan) and open_progress doesn't show up.  Will it work on FireFox or Chrome?

It is at the top of page 33 of

https://cran.r-project.org/web/packages/rstan/rstan.pdf

It is hardcoded for Internet Explorer on Windows (and Safari for Mac) because browseURL() doesn't always do the right thing with a .txt file.

Ben
 
On Thu, 03 Sep 2015 21:34:30 -0400, Ben Goodrich <goodri...@gmail.com> wrote:

Call stan() with open_progress = TRUE to see the progress in Internet Explorer, but we still don't know why the progress does not appear under RStudio for Windows.

On Thursday, September 3, 2015 at 6:36:23 PM UTC-4, Linas Mockus wrote:
Hi,

Rstan allows to run chains in parallel using
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())

rstanmulticore allows running chains in parallel using pstan() instead of stan().

Is there a possibility to redirect the progress of each chain into some file
when chains run in parallel? By default progress goes to Rgui when number of
chains is 1.

I have used my own function to run chains in parallel but then decided to use
stan function in rstan 2.7.0 and now can't see the progress when running several
chains in parallel. (I am happy though because problem with neg_binomial_2_log_rng
was fixed and I can use generated quantities instad of estimating predictive
posterior in R).

Thanks,
Linas


--
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/Ius8VWWR3M4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.

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



--
Thank you,
Linas

Linas Mockus

unread,
Sep 4, 2015, 12:14:50 PM9/4/15
to stan-...@googlegroups.com
My experience with redirecting output of parallel chains to text file was rather satisfactory.  I have used the following code (chain output was redirected to outfile so I was able to follow the progress of all chains):

par.stan <- function (file, code, data, warmup, n.draws, chains, pars,
init, outfile)
{
# compile C++ code
sm <- stan (file = file, model_code = code, data = data, chains = 1,
iter = 0)
CL <- makeCluster (chains, outfile = outfile)
clusterExport (cl = CL, c ("data", "pars", "n.draws", "warmup", "init"))
sflist <- parLapply (CL, 1 : chains, fun = function (cid) {
require (rstan)
if (length (init) == 1) {
if (init == "random") {
init <- "random"
} else {
init <- list (init [[cid]])
}
} else {
init <- list (init [[cid]])
}
stan (fit = sm, data = data, chains = 1, warmup = warmup,
iter = n.draws + warmup, pars = pars, init = init,
chain_id = cid)
})
stopCluster (CL)
if (chains == 1) {
return (sflist [[1]])
} else {
return (sflist2stanfit (sflist))
}
}

Thank you,
Linas
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.



--
Thank you,
Linas
--
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/Ius8VWWR3M4/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