registerParBackend: Parallel backend for the 'ppstat' package.

Description Usage Arguments Details Value Warning Author(s) See Also

View source: R/registerParBackend.R

Description

The function registerParBackend sets up a parallel backend to be used by several functions in the ppstat package.

Usage

1
2
3
4
5

Arguments

backend

a character. The default value, 'mc', relies on the parallel package. Use 'sequential' to reset the registration for sequential execution.

cores

a numeric. The number of cores to use. If NULL, the default, the number of cores is determined automatically.

...

arguments that are to be passed on to the actual lapply function used in the parallel execution of the lapply function.

Details

The effect of calling registerParBackend() is to substitute the call to the lapply function at various places in the code by a call to a function that can execute the lapply call in parallel. Currently the only supported backend is based on the parallel package and uses the mclapply function from that package. The registration function checks if the R session is appropriate for using parallel, i.e. that R does not run in a GUI. See the parallel and mclapply documentation for details.

When the package ppstat loads it checks if a global option ppstatParallel is found and is equal to TRUE. If it is, registerParBackend() is called at load time. Otherwise it has to be called in the session before ppstat can take advantage of multiple cores. The global option can be set using options(ppstatParallel = TRUE) e.g. in the .Rprofile file for automatic registration of the parallel backend at package load time.

The function lapplyParallel is a wrapper responsible for calling the appropriate, registered lapply function, which does the actual parallel execution of the lapply call. The function is not exported and intended for internal use only.

Value

registerParBackend returns NULL invisibly. The function is invoked for its side effects.

lapplyParallel returns a list.

getRegisteredParBackend returns a character specifying the current registered parallel backend. Currently either 'sequential' or 'mc'.

Warning

The parallel execution of computations in ppstat are experimental and the mclapply function from the parallel package does not work on Windows.

Some unstable behaviour has also been encountered on Mac OS X whenever the parallel computations are run in a session where the quartz device for plotting has been used previously. Though non of the parallel parts uses on screen devices, the unstable behaviour has only been encountered when the quartz device has been used in the session, and a note is printed when the parallel backend is registered and the quartz device is the current device.

Author(s)

Niels Richard Hansen, Niels.R.Hansen@math.ku.dk

See Also

parallel, mclapply, options.


ppstat documentation built on May 2, 2019, 5:26 p.m.