parallel: Utilities for Parallel Computations

Description Usage Arguments

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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.

verbose

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

pattern

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

...

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.

tmpdir

a non-empty character vector giving the directory name

fileext

a non-empty character vector giving the file extension

init

initial value

shared

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


renozao/NMF documentation built on June 14, 2020, 9:35 p.m.