as.block(dx, square.bldim = TRUE)
as.rowblock(dx)
as.colblock(dx)
as.rowcyclic(dx, bldim = .BLDIM)
as.colcyclic(dx, bldim = .BLDIM)
as.blockcyclic(dx, bldim = .BLDIM)
redistribute()
funciton (see Distribute). Different distributed matrix distributions
of note can be classified into three categories: block, cyclic, and
block-cyclic.
as.block()
will convert ddmatrix
into one which is merely
"block" distributed, i.e., the blocking factor is chosen in such a way
that there will be no cycling. By default, this new blocking factor
will be square. This can result in some raggedness (some processors
owning less than others --- or nothing) if the matrix is far from square
itself. However, the methods of factoring ddmatrix
objects, and
therefore anything that relies on (distributed) matrix factorizations
such as computing an inverse, least squares solution, etc., require that
blocking factors be square. The matrix will not change BLACS contexts.
as.rowblock()
will convert a distributed matrix into one which
is distributed by row into a block distributed matrix. That is, the
rows are stored contiguously, and different processors will own different
rows, but with no cycling. In other words, it block redistributes the data
across context 2.
as.colblock()
is the column-wise analogue of as.rowblock()
.
In other words, it block redistributes the data across context 1.
as.rowcyclic()
is a slightly more general version of as.rowblock()
,
in that the data will be distributed row-wise, but with the possibility
of cycling, as determined by the blocking factor. In other words it
block-cyclically redistributes the data across context 2.
as.colcyclic()
is a the column-wise analogue of as.rowcyclic()
.
In other words, it block-cyclically redistributes the data across context 1.
as.blockcyclic()
moves the distributed matrix into a general block-cyclic
distribution across a 2-dimensional process grid. In other words, it
block-cyclically redistributes the data across context 0.as.ddmatrix, Distribute
# Save code in a file "demo.r" and run with 2 processors by
# > mpiexec -np 2 Rscript demo.r
library(pbdDMAT, quiet = TRUE)
init.grid()
dx <- ddmatrix(1:30, nrow=10)
x <- as.block(dx)
x
x <- as.rowblock(dx)
x
x <- as.colblock(dx)
x
x <- as.rowcyclic(dx)
x
x <- as.colcyclic(dx)
x
x <- as.blockcyclic(dx)
x
finalize()
Run the code above in your browser using DataLab