Description Usage Arguments Value Note Examples
SLURM Apply
1 2 3 | slurm_apply(f, params, jobname, nodes = 2, cpus_per_node = 2,
add_objects = NULL, pkgs = rev(attached_packages()),
libPaths = NULL, slurm_options = list(), submit = FALSE)
|
f |
a function that accepts one or many single values as parameters and may return any type of R object |
params |
a data frame of parameter values to apply f to. Each column corresponds to a parameter of f (Note: names must match) and each row corresponds to a separate function call |
jobname |
the name of the slurm job |
nodes |
the (maximum) number of cluster nodes to spread the calculation over. slurm_apply automatically divides params in chunks of approximately equal size to send to each node. Less nodes are allocated if the parameter set is too small to use all CPUs on the requested nodes |
cpus_per_node |
the number of CPUs per node on the cluster; determines how many processes are run in parallel per node |
add_objects |
a character vector containing the name of R objects to be saved in a .RData file and loaded on each cluster node prior to calling f. |
pkgs |
a character vector containing the names of packages that must be loaded on each cluster node. By default, it includes all packages loaded by the user when slurm_apply is called with the exception of the sluhpc package. |
libPaths |
a character vector describing the location of additional R library trees to search through, or NULL. The default value of NULL corresponds to libraries returned by .libPaths() on a cluster node. Non-existent library trees are silently ignored. |
slurm_options |
a named list of options recognized by sbatch; see Details below for more information. |
submit |
whether or not to submit the job to the cluster with sbatch. See |
a slurm_job object containing the job name and the number of nodes effectively used
this function overrides slurm_apply
to add a command in the submission script to load R on APEX and call RScript with a relative path
1 2 3 4 5 6 7 8 | ## Not run:
do_search <- function(x, y) x + y
slurm_job <- slurm_apply(do_search,
data.frame(x = seq( 0, 42, 21),
y = seq(42, 0, -21)),
"find_meaning")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.