Search code examples
rglmrjava

glmulti - multicore options?


I am using the 'R' library "glmulti" and performing an exhaustive search.

relevant code:

local1.model <- glmulti(est, # use the model with built as a starting point
                        level = 1,  #  just look at main effects
                        method = "h",
                        crit="aicc") # use AICc because it works better than AIC for small sample sizes

The variable "est" is a fitted GLM that informs glmulti.

If I were a Java-based program that had to do the same thing several hundred thousand times, then I would use more than one core.

My glmulti is not using my cores efficiently.

enter image description here

Is there a way to switch it to make use of more of my system?

Note: when I use 'h2o' it can max out the CPU and make a strong hit on the memory.


Solution

  • R is single-threaded (unless the function is built on a library with its own threading). You can manually add parallelization to your code, using the rparallel library (which is part of core R): http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf

    I would class it as non-trivial to use. It is a bit of a hack on top of R, so it does lots of memory copying, and you need to think about what is going on if you care about efficiency.

    glmulti looks like it ought to be parallel (i.e. each combination of parameters could be done in parallel, even if using a genetic algorithm). My guess is they intended to add it, but development stopped (no updates since Sep 2009).