A wrap function to run parallel in different platforms

run_parallel(x, fun, cpus = parallel::detectCores() - 1, ...)

Arguments

x

A numeric vector for parallel

fun

A function

cpus

Number of CPUs for snowfall package

...

Other arguments passed to fun

Value

Result of parallel function.

Details

The supported platforms include * local computer through snowfall package (default) * MPI cluster through snow package * Windows HPC pack for parameter sweep job

Examples

if (FALSE) { # \dontrun{
fun <- function(i, a) {
  return(i * a)
}
run_parallel(seq(1, 10), fun, a = 2)
} # }