mcparallel
(Dummy Non-Parallel) Evaluate an Expression Asynchronously
Description
These functions are provided for compatibility with open-source R.
mcparallel immediately evaluates and saves an expression value.
mccollect collects the previously-evaluated values.
Usage
mcparallel(expr, name, mc.set.seed = TRUE, silent = FALSE,
mc.affinity = NULL, mc.interactive = FALSE)
mccollect(jobs, wait = TRUE, timeout = 0, intermediate = FALSE)
mcaffinity(affinity = NULL)
mc.reset.stream()
Arguments
expr |
an expression to evaluate.
|
name |
an optional character string giving the job name.
If it is given and not NULL, it is set as the "name"
component of the return list.
|
mc.set.seed |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
silent |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
mc.affinity |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
mc.interactive |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
jobs |
a list of job objects returned from mcparallel,
specifying the jobs whose results to collect.
It can also be a single job object or
an integer vector of process IDs extracted from these job objects.
If it is missing, then all known jobs are collected.
|
wait |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
timeout |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
intermediate |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
affinity |
This argument is ignored by Spotfire Enterprise Runtime for R.
|
Details
Open-source R implements mcparallel by evaluating expr
in parallel on a separate process, using forking on Unix/Linux.
mccollect collects the values of these expressions evaluated on
these separate processes.
To support existing code, Spotfire Enterprise Runtime for R defines these functions to provide
similar (non-parallel) functionality. mcparallel immediately
evaluates and saves the value of expr, and mccollect
collects the previously-evaluated values.
In open-source R, mcaffinity sets the CPU affinity where the
spawned processes should run. In Spotfire Enterprise Runtime for R, this function does nothing.
In open-source R, mc.reset.stream resets the
"L'Ecuyer-CMRG" random number generator. In Spotfire Enterprise Runtime for R, this
function is defined for compatibility, but it does not reset the
random number generators.
Value
mcparallel | returns an object of class "parallelJob",
which inherits from classes "childProcess" and
"process". A "name" component is added to this object if the
name argument is given and not NULL. |
mccollect | returns a list of the values evaluated by the
specified jobs. The name of each element of the list is the process
ID of the job. If the jobs argument is a list of job objects,
and they have "name" components, these names are used instead. |
mcaffinity | returns the value affinity. |
mc.reset.stream | invisibly returns either the seed for the
"L'Ecuyer-CMRG" random number generator if it is the current
RNG, or it returns NULL. |
Differences between Spotfire Enterprise Runtime for R and Open-source R
Spotfire Enterprise Runtime for R defines mcparallel and mccollect for compatibility
with open-source R, but these functions don't evaluate expressions in
separate processes.
Spotfire Enterprise Runtime for R defines mc.reset.stream for compatibility with
open-source R, but this function doesn't reset or affect the random
number generators.
See Also
Examples
## Not run:
x <- mcparallel(runif(10), name = "uniformJob")
y <- mcparallel(rnorm(10))
vals <- mccollect(list(x, y))
## End(Not run)