#include "petscmat.h" PetscErrorCode MatMPISBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[])Collective on Mat Many br
B | - the matrix Many br | |
bs | - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row Many brblocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() Many br | |
d_nz | - number of block nonzeros per block row in diagonal portion of local Many brsubmatrix (same for all local rows) Many br | |
d_nnz | - array containing the number of block nonzeros in the various block rows Many brin the upper triangular and diagonal part of the in diagonal portion of the local Many br(possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room Many brfor the diagonal entry and set a value even if it is zero. Many br | |
o_nz | - number of block nonzeros per block row in the off-diagonal portion of local Many brsubmatrix (same for all local rows). Many br | |
o_nnz | - array containing the number of nonzeros in the various block rows of the Many broff-diagonal portion of the local submatrix that is right of the diagonal Many br(possibly different for each block row) or NULL. Many br |
If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor Many brthan it must be used on all processors that share the object for that argument. Many br
If the *_nnz parameter is given then the *_nz parameter is ignored Many br
The user can specify preallocated storage for the diagonal part of Many brthe local submatrix with either d_nz or d_nnz (not both). Set Many brd_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic Many brmemory allocation. Likewise, specify preallocated storage for the Many broff-diagonal part of the local submatrix with o_nz or o_nnz (not both). Many br
You can call MatGetInfo() to get information on how effective the preallocation was; Many brfor example the fields mallocs,nz_allocated,nz_used,nz_unneeded; Many brYou can also run with the option -info and look for messages with the string Many brmalloc in them to see if additional memory allocation was needed. Many br
Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In Many brthe figure below we depict these three local rows and all columns (0-11). Many br
0 1 2 3 4 5 6 7 8 9 10 11 -------------------------- row 3 |. . . d d d o o o o o o row 4 |. . . d d d o o o o o o row 5 |. . . d d d o o o o o o --------------------------Many br
Thus, any entries in the d locations are stored in the d (diagonal) Many brsubmatrix, and any entries in the o locations are stored in the Many bro (off-diagonal) submatrix. Note that the d matrix is stored in Many brMatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format. Many br
Now d_nz should indicate the number of block nonzeros per row in the upper triangular Many brplus the diagonal part of the d matrix, Many brand o_nz should indicate the number of block nonzeros per row in the o matrix Many br
In general, for PDE problems in which most nonzeros are near the diagonal, Many brone expects d_nz >> o_nz. For large problems you MUST preallocate memory Many bror you will get TERRIBLE performance; see the users' manual chapter on Many brmatrices. Many br
Many br
Level:intermediate
Location:src/mat/impls/sbaij/mpi/mpisbaij.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages