Learn R Programming

pbdBASE (version 0.5-3)

base.redist: base.redist

Description

Redistribute a matrix from rank 0 to all ranks in block cyclic fashion.

Usage

base.redist(desc, A)

Arguments

desc

ScaLAPACK descriptor array.

A

Matrix.

Value

A block cyclic matrix of the input matrix A from rank 0.

Examples

Run this code
# NOT RUN {
spmd.code <- "
  suppressMessages(library(pbdMPI))
  suppressMessages(library(pbdBASE))
  init.grid()

  ### Set data matrix A and desc.
  A <- matrix(as.double(1:30), nrow = 6, ncol = 5)
  if (comm.rank() != 0)
    A <- matrix(as.double(0), nrow = 6, ncol = 5)
  dim <- dim(A)
  bldim <- c(3L, 3L)
  ldim <- base.numroc(dim = dim, bldim = bldim)
  desc <- base.descinit(dim = dim, bldim = bldim, ldim = ldim)

  ### Redistribute from rank 0.
  dA <- base.redist(desc, A)
  comm.print(dA, all.rank = TRUE)

  finalize()
"
pbdMPI::execmpi(spmd.code = spmd.code, nranks = 2L)

# }

Run the code above in your browser using DataLab