Skip to Content

doSMP-package {doSMP}

The doSMP Package
Package: 
doSMP
Version: 
1.0-1

Description

The doSMP package provides a parallel backend for the foreach/%dopar% function. It executes tasks on a single, multiprocess/multicore machine.

Details

The following options are supported by the doSMP backend. They are specified with a list via the foreach .options.smp argument:

chunkSize specifies the number of tasks to be sent to the workers at a time.

info is a logical value indicating that extra information should be displayed.

initEnvir is a function to be executed by each worker before any tasks are executed associated with a foreach. Its purpose is to initialize the execution environment, or the worker in general. It is only executed by a worker if that worker executes at least one task associated with the foreach. The first argument passed to the function is the execution environment. The remaining arguments are specified via the initArgs argument.

initArgs specifies a list of arguments to be passed to the initEnvir function after the environment argument.

finalEnvir is a function to be executed by each worker after all tasks are executed associated with a foreach. Its purpose is to clean up the execution environment environment, or the worker in general. It is only executed by a worker if that worker executed at least one task associated with the foreach. The first argument is the execution environment. The remaining arguments are specified via the finalArgs argument.

finalArgs specifies a list of arguments to be passed to the finalEnvir function after the environment argument.

Further information is available in the following help topics:

startWorkers start worker processes
stopWorkers shutdown worker processes
registerDoSMP register doSMP to be used by foreach/%dopar%
rmSessions cleanup orphaned doSMP sessions

To see a tutorial introduction to the doSMP package, use vignette("gettingstartedSMP"). To see a tutorial introduction to the foreach package, use vignette("foreach").

To see a demo of doSMP computing the sinc function, use demo(sincSMP).

Some examples (in addition to those in the help pages) are included in the “examples” directory of the doSMP package. To list the files in the examples directory, use list.files(system.file("examples", package="doSMP")). To run the bootstrap example, use source(system.file("examples", "bootSMP.R", package="doSMP")). This is a simple benchmark, executing both sequentally and in parallel. There are many more examples that come with the foreach package, which will work with the doSMP package if it is registered as the parallel backend.

For a complete list of functions with individual help pages, use library(help="doSMP").

Documentation reproduced from package doSMP, version 1.0-1. License: GPL-2