parallelWrapper: Parallelisation with external pointers

View source: R/parallelisingWrappers.R

parallelWrapperR Documentation

Parallelisation with external pointers

Description

Parallelising calls to R functions in this package while using the pointer-passing interface requires some care: the getPointerToJumpTransform and getPointerToGenerator functions have to be called on the cluster; a call such as parLapply(cl = myCluster, X = uMat.list, fun = affineCF, params.Q = params.Q, params.P = params.P, t.vec = 0.15, v.0 = matrix(0.025,1,1), N.factors = 1, mod.type ='standard', jumpTransform = getPointerToJumpTransform('kouExpJumpTransform')) will fail because of invalid pointers. This interface delays evaluation of the pointer functions by wrapping the call appropriately.

Usage

parallelWrapper(foo, ptrFoo, ptrArg, argName, ptrElem = NULL, ...)

Arguments

foo

function to be wrapped

ptrFoo

function that finds pointer, takes a single argument

ptrArg

argument to ptrFoo

argName

character, name of the pointer argument in foo; for example 'jumpTransform' if you want to call affineCF

ptrElem

character, if ptrFoo returns a named list, get pointer in field ptrFoo(ptrArg)$ptrElem.

Details

Further functions are ready parallel versions of the CF callers.

Value

Returns a function that which should be called with the same arguments as foo except for the pointer arguments.


piotrek-orlowski/affineModelR documentation built on July 11, 2022, 3:25 p.m.