Dear unmarked users,
I am curious if any among you have experience or tips you might be
able to share with respect to parsing a parboot() run to multiple
processor cores, particularly on a Windows based machine?
I have a double-observer pcount() model with 13 primary occasions in
which approximately 150 locations were sampled each time. The 150
sites are delineated into 7 stream segments, and by modeling abundance
as time dependent (primary occasion) with an interaction between
stream segment plus four additional habitat covariates, I end up with
more than 100 parameter estimates for the full model. The data are
overdispersed, and I'm wanting to use parboot() to estimate the
dispersion, so I can then rank models by QAIC.
The problem is that the full pcount() model takes about 10 hrs to fit
on my Core2Duo desktop (3.2GB RAM), and experience has shown (with
simpler models) that the length of time to complete a single parboot()
iteration can vary considerably depending on the particular dataset
generated for a given simulation run. I've benchmarked some pcount()
model fitting run times on various machines, including one in my
laboratory with dual Xeon processors and 16GB of RAM, as will was a 20
core (7GB RAM) Amazon EC2 machine on the "cloud", which both decreased
the processing time by about 20%.
I've tested the "boot()" example from the "parallel" R package and I
am able to generate 1000 runs by bootstrapping 500 simulations to each
of the two processors on my desktop. The example I used from the
documentation is this:
> run1 <- function(...) {
+ library(boot)
+ cd4.rg <- function(data, mle) MASS::mvrnorm(nrow(data), mle$m, mle
$v)
+ cd4.mle <- list(m = colMeans(cd4), v = var(cd4))
+ boot(cd4, corr, R = 500, sim = "parametric",
+ ran.gen = cd4.rg, mle = cd4.mle)
+ }
>mc<- 2
> cl <- makeCluster(mc)
> ## make this reproducible
> clusterSetRNGStream(cl, 123)
> library(boot) # needed for c() method on master
> cd4.boot <- do.call(c, parLapply(cl, seq_len(mc), run1) )
>
boot.ci(cd4.boot, type = c("norm", "basic", "perc"),
+ conf = 0.9, h = atanh, hinv = tanh)
> stopCluster(cl)
I've tried to expand upon this example to get parboot() to run
similarly on multiple cores. Ideally, for example, I'd like to send
one parboot simulation run for my full model to each of 20 cores on an
Amazon EC2 machine which might then yield 20 parboot() simulation runs
in about 10 hours (plus or minus). If I repeated this on n machines I
could theoretically obtain 20n parboot() runs in about a 10 hour
period.
Thus far, none of my implementations have worked. I think I was close
on a recent attempt, but I believe the two cores on my desktop might
have been stomping on eachother with simultaneous requests to access
the stored pcount() model object.
Apologies in advance for my lack of tech savvy computer lingo, or my
poor modeling jargon-- I am still learning much in both departments.
That said, I am grateful for the informative discussions I've learned
from here.
Any ideas greatly appreciated.
Kind regards, Ted Jones