Learn R Programming

pbdMPI (version 0.2-3)

isend-method: A Rank Send (Nonblocking) an Object to the Other Rank

Description

This method lets a rank send (nonblocking) a object to the other rank in the same communicator. The default return is NULL.

Usage

isend(x, rank.dest = .SPMD.CT$rank.dest, tag = .SPMD.CT$tag,
        comm = .SPMD.CT$comm, request = .SPMD.CT$request)

Arguments

x
an object to be sent from a rank.
rank.dest
a rank of destination where x send to.
tag
a tag number.
comm
a communicator number.
request
a request number.

Value

  • A NULL is returned by default.

Details

A corresponding recv() or irecv() should be evoked at the corresponding rank rank.dest.

References

Programming with Big Data in R Website: http://r-pbd.org/

See Also

send(), recv(), irecv().

Examples

Run this code
### Save code in a file "demo.r" and run with 2 processors by
### SHELL> mpiexec -np 2 Rscript demo.r

### Initial.
library(pbdMPI, quietly = TRUE)
init()
.comm.size <- comm.size()
.comm.rank <- comm.rank()

### Examples.
N <- 5
x <- (1:N) + N * .comm.rank
if(.comm.rank == 0){
  y <- isend(matrix(x, nrow = 1))
} else if(.comm.rank == 1){
  y <- recv()
}
comm.print(y, rank.print = 1)

### Finish.
finalize()

Run the code above in your browser using DataLab