foreach: Utilities and Extensions for Foreach Loops

registerDoBackendR Documentation

Utilities and Extensions for Foreach Loops

Description

registerDoBackend is a unified register function for foreach backends.

getDoBackend returns the internal data of the currently registered foreach %dopar% backend.

setDoBackend is identical to setDoPar, but returns the internal of the previously registered backend.

register is a generic function that register objects. It is used to as a unified interface to register foreach backends.

ForeachBackend is a factory method for foreach backend objects.

getDoParHosts is a generic function that returns the hostname of the worker nodes used by a backend.

getDoParNHosts returns the number of hosts used by a backend.

Usage

  registerDoBackend(object, ...)

  getDoBackend()

  setDoBackend(data, cleanup = FALSE)

  register(x, ...)

  ForeachBackend(object, ...)

  ## S4 method for signature 'doParallel_backend'
ForeachBackend(object, cl,
    type = NULL)

  ## S4 method for signature 'doPSOCK_backend'
ForeachBackend(object, cl)

  ## S4 method for signature 'doMPI_backend'
ForeachBackend(object, cl)

  getDoParHosts(object, ...)

  getDoParNHosts(object)

Arguments

object

specification of a foreach backend, e.g. ‘SEQ’, ‘PAR’ (for doParallel), ‘MPI’, etc...

...

extra arguments passed to the backend own registration function.

data

internal data of a foreach %dopar% backend.

cleanup

logical that indicates if the previous backend's cleanup procedure should be run, before setting the new backend.

x

specification of a foreach backend

cl

cluster specification: a cluster object or a numeric that indicates the number of nodes to use.

type

type of cluster, See makeCluster.

Methods

ForeachBackend

signature(object = "ANY"): Default method defined to throw an informative error message, when no other method was found.

ForeachBackend

signature(object = "character"): Creates a foreach backend object based on its name.

ForeachBackend

signature(object = "missing"): Creates a foreach backend object for the currently registered backend.

ForeachBackend

signature(object = "NULL"): Dummy method that returns NULL, defined for correct dispatch.

ForeachBackend

signature(object = "cluster"): Creates a doParallel foreach backend that uses the cluster described in object.

ForeachBackend

signature(object = "numeric"): Creates a doParallel foreach backend with object processes.

ForeachBackend

signature(object = "doParallel_backend"): doParallel-specific backend factory

ForeachBackend

signature(object = "doParallelMC_backend"): doParallel-specific backend factory for multicore (fork) clusters

This method is needed since version 1.0.7 of doParallel, which removed internal function info and defined separate backend names for mc and snow clusters.

ForeachBackend

signature(object = "doParallelSNOW_backend"): doParallel-specific backend factory for SNOW clusters.

This method is needed since version 1.0.7 of doParallel, which removed internal function info and defined separate backend names for mc and snow clusters.

ForeachBackend

signature(object = "doPSOCK_backend"): doSNOW-specific backend factory

ForeachBackend

signature(object = "mpicluster"): Creates a doMPI foreach backend that uses the MPI cluster described in object.

ForeachBackend

signature(object = "doMPI_backend"): doMPI-specific backend factory

getDoParHosts

signature(object = "ANY"): Default method that tries to heuristaically infer the number of hosts and in last resort temporarly register the backend and performs a foreach loop, to retrieve the nodename from each worker.


NMF documentation built on Sept. 11, 2024, 8:34 p.m.