run_parallel: A wrap function to run parallel in different platforms

View source: R/parallel.R

run_parallelR Documentation

A wrap function to run parallel in different platforms

Description

A wrap function to run parallel in different platforms

Usage

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

Details

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

Value

Result of parallel function.

Examples

## Not run: 
fun <- function(i, a) {
  return(i * a)
}
run_parallel(seq(1, 10), fun, a = 2)

## End(Not run)

byzheng/myutils documentation built on Oct. 3, 2024, 1:35 a.m.