seqParallelSetup {SeqArray} | R Documentation

## Setup/Get a Parallel Environment

### Description

Setups a parallel environment in R for the current session.

### Usage

    seqParallelSetup(cluster=TRUE, verbose=TRUE)
    seqGetParallel()

### Arguments

`cluster` | `NULL` or `FALSE`: serial processing; `TRUE`: parallel processing with the maximum number of cores minor one; a numeric value: the number of cores to be used; a cluster object for parallel processing, created by the functions in the package `parallel`, like `makeCluster`. See details
`verbose` | if `TRUE`, show information

### Details

When `cl` is `TRUE` or a numeric value, forking techniques are used to create a new child process as a copy of the current R process, see `?parallel::mcfork`. However, forking is not available on Windows, so multiple processes created by `makeCluster` are used instead. The R environment option `seqarray.parallel` will be set according to the value of `cluster`. Using `seqParallelSetup(FALSE)` removes the registered cluster, as does stopping the registered cluster.

### Value

`seqParallelSetup()` has no return, and `seqGetParallel()` returns `getOption("seqarray.parallel", FALSE)`.

### Author(s)

Xiuwen Zheng

### See Also

`seqParallel`, `seqApply`

### Examples

    library(parallel)

    seqParallelSetup(2L)

    # the GDS file
    (gds.fn <- seqExampleFileName("gds"))

    # display
    (f <- seqOpen(gds.fn))

    # run in parallel
    summary(seqMissing(f))

    # close the GDS file
    seqClose(f)

    seqParallelSetup(FALSE)

[Package SeqArray version 1.28.1 Index]