everywhere | R Documentation |
Evaluate an expression 'everywhere' on all connected daemons for the specified compute profile. Designed for performing setup operations across daemons, resultant changes to the global environment, loaded packages or options are persisted regardless of a daemon's 'cleanup' setting.
everywhere(.expr, ..., .args = list(), .compute = "default")
.expr |
an expression to evaluate asynchronously (of arbitrary length, wrapped in {} if necessary), or a language object passed by name. |
... |
(optional) named arguments (name = value pairs) specifying objects referenced in '.expr'. Used in addition to, and taking precedence over, any arguments specified via '.args'. |
.args |
(optional) either a list of objects to be passed by name (found in the current scope), or else a list of name = value pairs, as in '...'. |
.compute |
[default 'default'] character value for the compute profile to use when sending the mirai. |
Invisible NULL.
if (interactive()) {
# Only run examples in interactive R sessions
daemons(1)
everywhere(list2env(x, envir = .GlobalEnv), x = list(a = 1, b = 2))
m <- mirai(a + b)
call_mirai(m)$data
daemons(0)
daemons(1, dispatcher = FALSE)
everywhere(library(parallel))
m <- mirai("package:parallel" %in% search())
call_mirai(m)$data
daemons(0)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.