yy_api_task_pull: Functions for Task Pull Parallelism

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

These functions are designed in SPMD but assuming rank 0 is a master and rests are workers.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
task.pull(jids, FUN, ..., rank.master = .pbd_env$SPMD.CT$rank.root,
          comm = .pbd_env$SPMD.CT$comm, bcast = .pbd_env$SPMD.TP$bcast,
          barrier = .pbd_env$SPMD.TP$barrier,
          try = .pbd_env$SPMD.TP$try,
          try.silent = .pbd_env$SPMD.TP$try.silent)

task.pull.workers(FUN = function(jid, ...){ return(jid) }, ...,
                  rank.master = .pbd_env$SPMD.CT$rank.root,
                  comm = .pbd_env$SPMD.CT$comm,
                  try = .pbd_env$SPMD.TP$try,
                  try.silent = .pbd_env$SPMD.TP$try.silent)
task.pull.master(jids, rank.master = .pbd_env$SPMD.CT$rank.root,
                 comm = .pbd_env$SPMD.CT$comm)

Arguments

jids

all job ids (a vector of positive integers).

FUN

a function to be evaluated in workers.

...

extra variables for FUN.

rank.master

a rank of master where jid sent from.

comm

a communicator number.

bcast

if bcast to all ranks.

barrier

if barrier for all ranks.

try

if use try() to avoid breaks. CAUTION: try = FALSE is not safe and can stop all MPI/R jobs.

try.silent

if turn off the error message from try().

Details

All of these functions are for SPMD, NOT for master/workers.

FUN is a user defined function which has jid as the first argument and other variables are given in ....

The jids will be asked by workers when jobs are available and workers are no job in hand.

Value

A list with length comm.size() - 1 will be returned for mater, but NULL for workers. Each element of the list contains returns ret of the FUN call.

Author(s)

Wei-Chen Chen wccsnow@gmail.com, George Ostrouchov, Drew Schmidt, Pragneshkumar Patel, and Hao Yu.

References

Programming with Big Data in R Website: https://pbdr.org/

See Also

get.jid().

Examples

1
2
3
4
5
6
7
8
## Not run: 
### Under command mode, run the demo with 2 processors by
### (Use Rscript.exe for windows system)
# mpiexec -np 2 Rscript -e "demo(task_pull,'pbdMPI',ask=F,echo=F)"
### Or
# execmpi("demo(task_pull,'pbdMPI',ask=F,echo=F)", nranks = 2L)

## End(Not run)

pbdMPI documentation built on Nov. 6, 2021, 9:07 a.m.