Learn R Programming

pbdMPI (version 0.2-3)

global as.gb: Global As GBD Function

Description

This function redistributes a regular matrix existed in rank.soure and turns it in a gbd matrix in row blocks.

Usage

comm.as.gbd(X, balance.method = .SPMD.IO$balance.method,
              rank.source = .SPMD.CT$rank.source,
              comm = .SPMD.CT$comm)

Arguments

X
a regular matrix in rank.source and to be redistributed as a gbd.
balance.method
a balance method.
rank.source
a rank of source where elements of x scatter from.
comm
a communicator number.

Value

  • A X.gbd will be returned.

Details

X matrix in rank.source will be redistributed as a gbd matrix in row blocks.

This function will first set NULL to X if it is not located in rank.source, then called comm.load.balance() to redistributed the one located in rank.source to all other ranks.

References

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

See Also

comm.load.balance(), comm.read.table() and comm.write.table().

Examples

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

### Initial.
library(pbdMPI, quietly = TRUE)
init()

### Examples.
X <- matrix(1:15, ncol = 3)
X.gbd <- comm.as.gbd(X)
comm.print(X.gbd, all.rank = TRUE)

### Finish.
finalize()

Run the code above in your browser using DataLab