Page 1 of 1

Multi-Core Processing Strategy

PostPosted: Wed Jun 17, 2015 5:43 pm
by mjgould
Hi Murray,

I just received an opportunity to run my models with a 'supercomputer' system at my university. They've offered 36 GB RAM and 8 cores, but they're more than happy to adjust those specs depending on my needs.

I'm running single session models, and looking at the manual, my best bet is to use par.secr.fit to fit run multiple models at once. The code and logic seem pretty straight forward, but I'm cautious in assuming it's really that easy. Is there any advice or tips you can provide that might prevent me from trying to reinvent the wheel and/or speed up the fitting of the models? Currently, some of my models take 1-2 weeks to run, and it would be nice to reduce that time even a little bit.

Best,

Matt

Re: Multi-Core Processing Strategy

PostPosted: Thu Jun 18, 2015 4:01 am
by murray.efford
Hi Matt
I hesitate to offer advice because my own experience is limited. In programming the parallel options in 'secr' I have simply used the capability provided by the 'parallel' package of R, using sockets to communicate between worker processes as described in the vignette for package 'parallel' and on the 'secr' help page you can access with ?Parallel. It is possible that implementation will not suit your supercomputer, but your best bet is to try it and see, or seek local advice. On some systems I think the way 'parallel' has one master process spawn and wait for the worker processes does become a problem, but it works for me in Windows 7 (up to 8 processes on a quadcore machine) and on a Linux system with dozens of cores.

So long as the general mechanism works on your supercomputer everything else should be easy.

Using par.secr.fit will allow you to complete several model fits at once, but of course you are still limited by the slowest. I often find fitting can be sped up without loss of accuracy by trimming the mask or using coarser discretization, but maybe you've already tried that.

Whether you should ask for more cores depends on how many models you want to run (if we're talking about par.secr.fit, one per model) and how much memory is needed by each (take a look on the Performance tab of Windows Task manager next time you try running one, if you're using Windows).

Only generalities here, I'm sorry. I'll be interested to hear how you get on.
Murray

Re: Multi-Core Processing Strategy

PostPosted: Thu Jun 18, 2015 4:50 pm
by mjgould
Understood. I'll make sure to coordinate the with the onsite personnel on the issue, and gladly report back on the process.

I do have a question about coding. In the manual, the code reads as such:
Code: Select all
fit0 <- list(capthist = 'captdata', model = g0~1)
fitb <- list(capthist = 'captdata', model = g0~b)
fits <- par.secr.fit (c('fit0','fitb'), ncores = 2)


I'm assuming if these models were fitted individually, then the code would be exactly the same except secr.fit() would replace list()? I'm just double checking that I include all my secr.fit code as usual, e.g.
Code: Select all
(CH, mask = HabitatMask, model = list(D ~ 1, g0 ~ 1, sigma ~ 1), detectfn = 0, CL = FALSE, method = "Nelder-Mead",  control = list(maxit = 5000), trace = TRUE, verify = TRUE)
. Then as the manual shows concatenate the objects into par.secr.fit.

Just to double check, but discretization just refers to the spacing between points on the habitat mask, correct? If so then a coarser discretization would mean fewer points to estimate the likelihood for and thus quicker fitting. With that, what's your rule of thumb in turns of setting the mask spacing? Spacing between traps? Movement capabilities of the species?

Re: Multi-Core Processing Strategy

PostPosted: Fri Jun 26, 2015 5:57 pm
by murray.efford
Hi
I lost the plot here and didn't answer your last question on discretization. I think spacing should relate to scale of animal movement (sigma). Generally spacing in the range 0.2-0.6 sigma seems OK. Here is an empirical plot for the effect of varying spacing in the Waitarere possum dataset, halfnormal sigma about 50 m:

Image

Murray