xref: /petsc/src/mat/impls/aij/mpi/mpicusparse/mpicusparsematimpl.h (revision 0ea77eda237b1068ff0d8bfa28c3463dc2087695)
1 #if !defined(__MPICUSPARSEMATIMPL)
2 #define __MPICUSPARSEMATIMPL
3 
4 #include <cusparse_v2.h>
5 #include <petsc/private/cudavecimpl.h>
6 
7 struct Mat_MPIAIJCUSPARSE {
8   /* The following are used by GPU capabilities to store matrix storage formats on the device */
9   MatCUSPARSEStorageFormat   diagGPUMatFormat;
10   MatCUSPARSEStorageFormat   offdiagGPUMatFormat;
11   PetscSplitCSRDataStructure deviceMat;
12   PetscInt                   coo_nd, coo_no; /* number of nonzero entries in coo for the diag/offdiag part */
13   THRUSTINTARRAY            *coo_p;          /* the permutation array that partitions the coo array into diag/offdiag parts */
14   THRUSTARRAY               *coo_pw;         /* the work array that stores the partitioned coo scalar values */
15 
16   /* Extended COO stuff */
17   PetscCount  *Ajmap1_d, *Aperm1_d;            /* Local entries to diag */
18   PetscCount  *Bjmap1_d, *Bperm1_d;            /* Local entries to offdiag */
19   PetscCount  *Aimap2_d, *Ajmap2_d, *Aperm2_d; /* Remote entries to diag */
20   PetscCount  *Bimap2_d, *Bjmap2_d, *Bperm2_d; /* Remote entries to offdiag */
21   PetscCount  *Cperm1_d;                       /* Permutation to fill send buffer. 'C' for communication */
22   PetscScalar *sendbuf_d, *recvbuf_d;          /* Buffers for remote values in MatSetValuesCOO() */
23   PetscBool    use_extended_coo;
24 
25   Mat_MPIAIJCUSPARSE() {
26     diagGPUMatFormat    = MAT_CUSPARSE_CSR;
27     offdiagGPUMatFormat = MAT_CUSPARSE_CSR;
28     coo_p               = NULL;
29     coo_pw              = NULL;
30     deviceMat           = NULL;
31     use_extended_coo    = PETSC_FALSE;
32   }
33 };
34 #endif
35