Learn R Programming

pbdDEMO (version 0.1-0)

spmd_dmat: SPMD Matrix to Distributed Dense Matrix and vice versa

Description

This function convert a SPMD matrix and a distributed dense matrix.

Usage

spmd2dmat(X.spmd, skip.balance = FALSE, comm = .SPMD.CT$comm,
            spmd.major = .DEMO.CT$spmd.major, bldim = .DEMO.CT$bldim, 
            ICTXT = .DEMO.CT$ictxt)
  dmat2spmd(X.dmat, bal.info = NULL, comm = .SPMD.CT$comm, 
            spmd.major = .DEMO.CT$spmd.major)

Arguments

X.spmd
a SPMD matrix.
skip.balance
if load.balance were skipped.
comm
a communicator number.
bldim
the blocking dimension for block-cyclically distributing the matrix across the process grid.
spmd.major
1 for row-major storage, 2 for column-major.
ICTXT
BLACS context number for return.
X.dmat
a ddmatrix matrix.
bal.info
a returned object from balance.info.

Value

  • spmd2dmat returns a ddmatrix object. dmat2spmd returns a (balanced) spmd matrix.

Details

X.spmd is a matrix with dimension N.spmd * p and exists on all processors. N.spmd may be vary across processors.

If skip.balance = TRUE, then load.balance will not be called and X.spmd is preassumed to be balanced.

For demonstration purpose, these objects should not contains weird values such as NA.

dmat2spmd is supposed returned a balanced spmd matrix if bal.info is not supplied.

References

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

Examples

Run this code
### Under command mode, run the demo with 4 processors by
### (Use Rscript.exe for windows system)
mpiexec -np 4 Rscript -e "demo(spmd_dmat,'pbdDEMO',ask=F,echo=F)"

Run the code above in your browser using DataLab