irecv-method | R Documentation |
This method lets a rank receive (nonblocking) an object from the other rank in the same communicator. The default return is the object sent from the other rank.
irecv(x.buffer = NULL, rank.source = .pbd_env$SPMD.CT$rank.source,
tag = .pbd_env$SPMD.CT$tag, comm = .pbd_env$SPMD.CT$comm,
request = .pbd_env$SPMD.CT$request,
status = .pbd_env$SPMD.CT$status)
x.buffer |
a buffer to store |
rank.source |
a source rank where |
tag |
a tag number. |
comm |
a communicator number. |
request |
a request number. |
status |
a status number. |
A corresponding send()
/isend()
should be evoked at the
corresponding rank rank.source
.
Warning: irecv()
is not safe for R since R is not a thread
safe package that a dynamic returning object requires certain blocking or
barrier at some where. Current, the default method is equivalent to the
default method of recv()
.
An object is returned by default.
For calling spmd.irecv.*()
:
signature(x = "ANY")
signature(x = "integer")
signature(x = "numeric")
signature(x = "raw")
Wei-Chen Chen wccsnow@gmail.com, George Ostrouchov, Drew Schmidt, Pragneshkumar Patel, and Hao Yu.
Programming with Big Data in R Website: https://pbdr.org/
recv()
, send()
, isend()
.
## Not run:
### Save code in a file "demo.r" and run with 2 processors by
### SHELL> mpiexec -np 2 Rscript demo.r
spmd.code <- "
### Initialize
suppressMessages(library(pbdMPI, quietly = TRUE))
.comm.size <- comm.size()
.comm.rank <- comm.rank()
### Examples.
N <- 5
x <- (1:N) + N * .comm.rank
if(.comm.rank == 0){
y <- send(matrix(x, nrow = 1))
} else if(.comm.rank == 1){
y <- irecv()
}
comm.print(y, rank.print = 1)
### Finish.
finalize()
"
# execmpi(spmd.code, nranks = 2L)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.