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