rbchan / unmarked

R package for hierarchical models in ecological research
https://rbchan.github.io/unmarked/
36 stars 25 forks source link

Add parallel computation option for `parboot` function #86

Closed adamdsmith closed 8 years ago

adamdsmith commented 8 years ago

I've added the capability to generate bootstrapped test statistics on multiple cores using package parallel. Parallel computation is the default option so long as more than two cores are present on the machine (parboot uses nCores - 1) and the requested number of simulations is >= 100 (the approximate point at which parallel computation is advantageous).

I've tested it successfully on the following unmarkedFits: MPois and GMM (with and without a custom piFun), DS and GDS, PCount, GPC, and PCO, and Occu.

It does not work for unmarkedFits without a simulate method (e.g., OccuPEN) or with fitted or residuals methods (e.g., OccuFP).

I've changed the DESCRIPTION and NAMESPACE files to reflect the parallel package dependency.

I also updated parboot.Rd file to reflect the new arguments related to parallel computation.

rbchan commented 8 years ago

This is great. Can you also add some tests to inst/unitTests/?

adamdsmith commented 8 years ago

Sure. I've not done them before, so your patience is appreciated. Do you want one for each class of unmarkedFit?

rbchan commented 8 years ago

Just one test would be fine. Ideally, the test should only take a few seconds to run, so consider doing it on an occu fit. The entire suite of tests can be run using: source("runTests.R"). Thanks again.

adamdsmith commented 8 years ago

Hope this test is sufficient. I have not tested the parallel application on Mac/Linux, but it should work.

jaroyle commented 8 years ago

hi Adam, Thanks for this! I'll try to do the merge this week and then test it out myself (in meetings all day between now and Thursday morning, so probably end of the week) regards andy

On Mon, Nov 16, 2015 at 9:03 AM, Adam Smith notifications@github.com wrote:

Hope this test is sufficient. I have not tested the parallel application on Mac/Linux, but it should work.

— Reply to this email directly or view it on GitHub https://github.com/rbchan/unmarked/pull/86#issuecomment-157037909.

rbchan commented 8 years ago

Thanks Adam. Merged now.