MatGetMultPetscSF#

Returns the PetscSF that communicates to each MPI process the values held on other MPI processes that are coupled to it by the Mat

Synopsis#

#include "petscmat.h" 
PetscErrorCode MatGetMultPetscSF(Mat A, PetscSF *sf)

Not Collective

Input Parameter#

  • A - the matrix

Output Parameter#

Notes#

The returned PetscSF is owned by the matrix; do not destroy it.

It is only valid if this function is called after the matrix has been assembled (and for MATMPIDENSE after a MatMult() has been additionally called).

This is only implemented for the matrix types listed below; calling it on a sequential matrix or a type that does not build such a PetscSF raises an error.

For MATMPIAIJ, MATMPIBAIJ, MATMPIDENSE, and MATMPISELL, this PetscSF is used within MatMult() to provide the contribution of vector entries that are not local to each MPI process to the matrix-vector product. For MATMPISBAIJ the returned PetscSF is instead the off-process column gather used by operations such as MatDiagonalScale(); MatMult_MPISBAIJ() uses a separate, augmented scatter context. In all cases the PetscSF maps the global vector layout (the matrix column layout) onto the off-process columns that the local rows couple to, so it can be reused to communicate any per-column data, for example with PetscSFBcastBegin().

For MATMPIDENSE this PetscSF is an allgather: every process gathers all columns, including its own, in the natural global order rather than a sparse garray order. The leaf set and ordering therefore differ across matrix types, so callers should use PetscSFGetGraph() rather than assume a particular leaf layout.

See Also#

Matrices, Mat, PetscSF, MatGetDiagonalBlock(), MatMPIAIJGetSeqAIJ(), PetscSFBcastBegin(), MatMult()

Level#

advanced

Location#

src/mat/interface/matrix.c

Implementations#

MatGetMultPetscSF_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatGetMultPetscSF_MPIBAIJ() in src/mat/impls/baij/mpi/mpibaij.c
MatGetMultPetscSF_MPIDense() in src/mat/impls/dense/mpi/mpidense.c
MatGetMultPetscSF_MPISBAIJ() in src/mat/impls/sbaij/mpi/mpisbaij.c
MatGetMultPetscSF_MPISELL() in src/mat/impls/sell/mpi/mpisell.c


Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages