Description Usage Arguments Details Value Warning Author(s) See Also
View source: R/registerParBackend.R
The function registerParBackend
sets up a parallel backend to be
used by several functions in the ppstat package.
1 2 3 4 5 | registerParBackend(backend = 'mc', cores = NULL)
lapplyParallel(...)
getRegisteredParBackend()
|
backend |
a |
cores |
a |
... |
arguments that are to be passed on to the actual
|
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.
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'
.
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.
Niels Richard Hansen, Niels.R.Hansen@math.ku.dk
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.