NMF (version 0.21.0)

parallel-NMF: Utilities for Parallel Computations

Description

Utilities for Parallel Computations

ts_eval generates a thread safe version of eval. It uses boost mutexes provided by the synchronicity package. The generated function has arguments expr and envir, which are passed to eval.

ts_tempfile generates a unique temporary filename that includes the name of the host machine and/or the caller's process id, so that it is thread safe.

hostfile generates a temporary filename composed with the name of the host machine and/or the current process id.

gVariable generates a function that access a global static variable, possibly in shared memory (only for numeric matrix-coercible data in this case). It is used primarily in parallel computations, to preserve data accross computations that are performed by the same process.

Usage

ts_eval(mutex = synchronicity::boost.mutex(),
    verbose = FALSE)

ts_tempfile(pattern = "file", ..., host = TRUE, pid = TRUE)

hostfile(pattern = "file", tmpdir = tempdir(), fileext = "", host = TRUE, pid = TRUE)

gVariable(init, shared = FALSE)

Arguments

mutex

a mutex or a mutex descriptor. If missing, a new mutex is created via the function boost.mutex from the synchronicity package.

verbose

a logical that indicates if messages should be printed when locking and unlocking the mutex.

...

extra arguments passed to tempfile.

host

logical that indicates if the host machine name should be appear in the filename.

pid

logical that indicates if the current process id be appear in the filename.

init

initial value

shared

a logical that indicates if the variable should be stored in shared memory or in a local environment.

pattern

a non-empty character vector giving the initial part of the name.

tmpdir

a non-empty character vector giving the directory name

fileext

a non-empty character vector giving the file extension