1 2 #if !defined(__MPIAIJ_H) 3 #define __MPIAIJ_H 4 5 #include "src/mat/impls/aij/seq/aij.h" 6 #include "src/sys/ctable.h" 7 8 typedef struct { 9 Mat A,B; /* local submatrices: A (diag part), 10 B (off-diag part) */ 11 PetscMPIInt size; /* size of communicator */ 12 PetscMPIInt rank; /* rank of proc in communicator */ 13 14 /* The following variables are used for matrix assembly */ 15 16 PetscTruth donotstash; /* PETSC_TRUE if off processor entries dropped */ 17 MPI_Request *send_waits; /* array of send requests */ 18 MPI_Request *recv_waits; /* array of receive requests */ 19 PetscInt nsends,nrecvs; /* numbers of sends and receives */ 20 PetscScalar *svalues,*rvalues; /* sending and receiving data */ 21 PetscInt rmax; /* maximum message length */ 22 #if defined (PETSC_USE_CTABLE) 23 PetscTable colmap; 24 #else 25 PetscInt *colmap; /* local col number of off-diag col */ 26 #endif 27 PetscInt *garray; /* global index of all off-processor columns */ 28 29 /* The following variables are used for matrix-vector products */ 30 31 Vec lvec; /* local vector */ 32 VecScatter Mvctx; /* scatter context for vector */ 33 PetscTruth roworiented; /* if true, row-oriented input, default true */ 34 35 /* The following variables are for MatGetRow() */ 36 37 PetscInt *rowindices; /* column indices for row */ 38 PetscScalar *rowvalues; /* nonzero values in row */ 39 PetscTruth getrowactive; /* indicates MatGetRow(), not restored */ 40 41 /* Used by MatDistribute_MPIAIJ() to allow reuse of previous matrix allocation and nonzero pattern */ 42 PetscInt *ld; /* number of entries per row left of diagona block */ 43 } Mat_MPIAIJ; 44 45 typedef struct { /* used by MatMatMult_MPIAIJ_MPIAIJ and MatPtAP_MPIAIJ_MPIAIJ for reusing symbolic mat product */ 46 PetscInt *startsj; 47 PetscScalar *bufa; 48 IS isrowa,isrowb,iscolb; 49 Mat *aseq,*bseq,C_seq; /* A_seq=aseq[0], B_seq=bseq[0] */ 50 Mat A_loc,B_seq; 51 Mat B_loc,B_oth; /* partial B_seq -- intend to replace B_seq */ 52 PetscInt brstart; /* starting owned rows of B in matrix bseq[0]; brend = brstart+B->m */ 53 PetscInt *abi,*abj; /* symbolic i and j arrays of the local product A_loc*B_seq */ 54 PetscInt abnz_max; /* max(abi[i+1] - abi[i]), max num of nnz in a row of A_loc*B_seq */ 55 MatReuse reuse; 56 PetscErrorCode (*MatDestroy)(Mat); 57 PetscErrorCode (*MatDuplicate)(Mat,MatDuplicateOption,Mat*); 58 } Mat_MatMatMultMPI; 59 60 typedef struct { /* used by MatMerge_SeqsToMPI for reusing the merged matrix */ 61 PetscMap rowmap; 62 PetscInt **buf_ri,**buf_rj; 63 PetscMPIInt *len_s,*len_r,*id_r; /* array of length of comm->size, store send/recv matrix values */ 64 PetscMPIInt nsend,nrecv; 65 PetscInt *bi,*bj; /* i and j array of the local portion of mpi C=P^T*A*P */ 66 PetscInt *owners_co,*coi,*coj; /* i and j array of (p->B)^T*A*P - used in the communication */ 67 PetscErrorCode (*MatDestroy)(Mat); 68 PetscErrorCode (*MatDuplicate)(Mat,MatDuplicateOption,Mat*); 69 } Mat_Merge_SeqsToMPI; 70 71 EXTERN PetscErrorCode MatSetColoring_MPIAIJ(Mat,ISColoring); 72 EXTERN PetscErrorCode MatSetValuesAdic_MPIAIJ(Mat,void*); 73 EXTERN PetscErrorCode MatSetValuesAdifor_MPIAIJ(Mat,PetscInt,void*); 74 EXTERN PetscErrorCode MatSetUpMultiply_MPIAIJ(Mat); 75 EXTERN PetscErrorCode DisAssemble_MPIAIJ(Mat); 76 EXTERN PetscErrorCode MatDuplicate_MPIAIJ(Mat,MatDuplicateOption,Mat *); 77 EXTERN PetscErrorCode MatIncreaseOverlap_MPIAIJ(Mat,PetscInt,IS [],PetscInt); 78 EXTERN PetscErrorCode MatFDColoringCreate_MPIAIJ(Mat,ISColoring,MatFDColoring); 79 EXTERN PetscErrorCode MatGetSubMatrices_MPIAIJ (Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]); 80 EXTERN PetscErrorCode MatGetSubMatrix_MPIAIJ_All(Mat,MatGetSubMatrixOption,MatReuse,Mat *[]); 81 82 EXTERN PetscErrorCode MatGetSubMatrix_MPIAIJ (Mat,IS,IS,PetscInt,MatReuse,Mat *); 83 EXTERN PetscErrorCode MatLoad_MPIAIJ(PetscViewer, const MatType,Mat*); 84 EXTERN PetscErrorCode MatMatMult_MPIAIJ_MPIAIJ(Mat,Mat,MatReuse,PetscReal,Mat*); 85 EXTERN PetscErrorCode MatMatMultSymbolic_MPIAIJ_MPIAIJ(Mat,Mat,PetscReal,Mat*); 86 EXTERN PetscErrorCode MatMatMultNumeric_MPIAIJ_MPIAIJ(Mat,Mat,Mat); 87 EXTERN PetscErrorCode MatPtAPSymbolic_MPIAIJ(Mat,Mat,PetscReal,Mat*); 88 EXTERN PetscErrorCode MatPtAPNumeric_MPIAIJ(Mat,Mat,Mat); 89 EXTERN PetscErrorCode MatPtAPSymbolic_MPIAIJ_MPIAIJ(Mat,Mat,PetscReal,Mat*); 90 EXTERN PetscErrorCode MatPtAPNumeric_MPIAIJ_MPIAIJ(Mat,Mat,Mat); 91 EXTERN PetscErrorCode MatSetValues_MPIAIJ(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar [],InsertMode); 92 EXTERN PetscErrorCode MatDestroy_MPIAIJ_MatMatMult(Mat); 93 EXTERN PetscErrorCode PetscContainerDestroy_Mat_MatMatMultMPI(void*); 94 EXTERN PetscErrorCode MatGetRedundantMatrix_MPIAIJ(Mat,PetscInt,MPI_Comm,PetscInt,MatReuse,Mat*); 95 EXTERN PetscErrorCode MatGetSeqNonzeroStructure_MPIAIJ(Mat,Mat*); 96 97 EXTERN_C_BEGIN 98 EXTERN PetscErrorCode MatMPIAIJSetPreallocation_MPIAIJ(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[]); 99 EXTERN_C_END 100 101 #if !defined(PETSC_USE_COMPLEX) && !defined(PETSC_USE_SINGLE) && !defined(PETSC_USE_MAT_SINGLE) 102 EXTERN PetscErrorCode MatLUFactorSymbolic_MPIAIJ_TFS(Mat,IS,IS,MatFactorInfo*,Mat*); 103 #endif 104 EXTERN PetscErrorCode MatSolve_MPIAIJ(Mat,Vec,Vec); 105 EXTERN PetscErrorCode MatILUFactor_MPIAIJ(Mat,IS,IS,MatFactorInfo *); 106 107 EXTERN_C_BEGIN 108 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatGetDiagonalBlock_MPIAIJ(Mat,PetscTruth *,MatReuse,Mat *); 109 EXTERN PetscErrorCode PETSCMAT_DLLEXPORT MatDiagonalScaleLocal_MPIAIJ(Mat,Vec); 110 EXTERN_C_END 111 112 #endif 113