1 #ifndef _MHYPRE_H 2 #define _MHYPRE_H 3 4 #include <petscsys.h> 5 #include <petscmat.h> 6 #include <../src/vec/vec/impls/hypre/vhyp.h> 7 #include <HYPRE_IJ_mv.h> 8 9 typedef struct { 10 HYPRE_IJMatrix ij; 11 VecHYPRE_IJVector x; 12 VecHYPRE_IJVector b; 13 MPI_Comm comm; 14 PetscBool inner_free; 15 16 /* MatGetArray_HYPRE */ 17 void *array; 18 PetscInt array_size; 19 PetscBool array_available; 20 21 /* MatSetOption_ support */ 22 PetscBool donotstash; 23 24 /* An agent matrix which does the MatSetValuesCOO() job for IJMatrix */ 25 Mat cooMat; 26 PetscBool cooMatAttached; 27 28 /* helper array storing row ids on device, used in MatZeroRows */ 29 PetscInt *rows_d; 30 } Mat_HYPRE; 31 32 PETSC_INTERN PetscErrorCode MatZeroRows_CUDA(PetscInt n, const PetscInt *rows, const HYPRE_Int *i, const HYPRE_Int *j, HYPRE_Complex *a, HYPRE_Complex diag); 33 PETSC_INTERN PetscErrorCode MatZeroRows_HIP(PetscInt n, const PetscInt *rows, const HYPRE_Int *i, const HYPRE_Int *j, HYPRE_Complex *a, HYPRE_Complex diag); 34 PETSC_INTERN PetscErrorCode MatZeroRows_Kokkos(PetscInt n, const PetscInt *rows, const HYPRE_Int *i, const HYPRE_Int *j, HYPRE_Complex *a, HYPRE_Complex diag); 35 36 #endif 37