Takes either an R matrix and distributes it as a distributed matrix, or takes a distributed matrix and redistributes it across a (possibly) new BLACS context, using a (possibly) new blocking dimension.
1 2 3 4 5 6 7 8 9 10 11
numeric distributed matrix
the blocking dimension for block-cyclically distributing the matrix across the process grid.
logical. Determines whether or not the blocking factor for the resulting redistributed matrix will be square or not.
These functions are simple wrappers of the very general
redistribute() funciton. 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
as.colblock() is the column-wise analogue of
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.
Returns a distributed matrix.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
## Not run: # 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() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.