Description Usage Arguments Details Value Examples
A simplified interface to the distribute()
and redistribute()
functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  as.ddmatrix(x, ...)
distribute(x, bldim = .pbd_env$BLDIM, xCTXT = 0,
ICTXT = .pbd_env$ICTXT)
## S4 method for signature 'matrix'
as.ddmatrix(x, bldim = .pbd_env$BLDIM,
ICTXT = .pbd_env$ICTXT)
## S4 method for signature ''NULL''
as.ddmatrix(x, bldim = .pbd_env$BLDIM,
ICTXT = .pbd_env$ICTXT)
## S4 method for signature 'vector'
as.ddmatrix(x, bldim = .pbd_env$BLDIM,
ICTXT = .pbd_env$ICTXT)

x 
a numeric matrix 
... 
Additional arguments. 
bldim 
the blocking dimension for blockcyclically distributing the matrix across the process grid. 
xCTXT 
the BLACS context number for initial distribution of the matrix

ICTXT 
BLACS context number for return. 
A simplified wrapper for the distribute()
function, especially in the
case that the matrix x
is global (which you really should not ever
let happen outside of testing, but I won't stop you).
The function will only work if x
is stored on all processes, or
x
is stored on a single process (does not matter which) and every
other process has NULL stored for x.
If several processes own pieces of the matrix x
, then you can not use
this function. You will have to create an appropriate ddmatrix
on all
processes and redistriubte the data with the redistribute()
function.
As usual, the ICTXT
number is the BLACS context corresponding to the
process grid onto which the output distributed matrix will be distributed.
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  spmd.code = "
library(pbdDMAT, quiet = TRUE)
init.grid()
if (comm.rank()==0){
x < matrix(1:16, ncol=4)
} else {
x < NULL
}
dx < as.ddmatrix(x, bldim=2)
dx
### Can also be common to all ranks
y < matrix(1:25, 5, bldim=2)
dy < as.ddmatrix(y)
dy
finalize()
"
pbdMPI::execmpi(spmd.code = spmd.code, nranks = 2L)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.