xref: /petsc/src/mat/impls/aij/mpi/mpicusparse/mpicusparsematimpl.h (revision 2acb67f1683595f1f6a28673b20e092fb7e60070)
1 #ifndef PETSC_MPICUSPARSEMATIMPL_H
2 #define PETSC_MPICUSPARSEMATIMPL_H
3 
4 #include <cusparse_v2.h>
5 #include <petsc/private/veccupmimpl.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   PetscInt                 coo_nd, coo_no; /* number of nonzero entries in coo for the diag/offdiag part */
12   THRUSTINTARRAY          *coo_p;          /* the permutation array that partitions the coo array into diag/offdiag parts */
13   THRUSTARRAY             *coo_pw;         /* the work array that stores the partitioned coo scalar values */
14 
15   /* Extended COO stuff */
16   PetscCount  *Ajmap1_d, *Aperm1_d;            /* Local entries to diag */
17   PetscCount  *Bjmap1_d, *Bperm1_d;            /* Local entries to offdiag */
18   PetscCount  *Aimap2_d, *Ajmap2_d, *Aperm2_d; /* Remote entries to diag */
19   PetscCount  *Bimap2_d, *Bjmap2_d, *Bperm2_d; /* Remote entries to offdiag */
20   PetscCount  *Cperm1_d;                       /* Permutation to fill send buffer. 'C' for communication */
21   PetscScalar *sendbuf_d, *recvbuf_d;          /* Buffers for remote values in MatSetValuesCOO() */
22   PetscBool    use_extended_coo;
23 
24   Mat_MPIAIJCUSPARSE()
25   {
26     diagGPUMatFormat    = MAT_CUSPARSE_CSR;
27     offdiagGPUMatFormat = MAT_CUSPARSE_CSR;
28     coo_p               = NULL;
29     coo_pw              = NULL;
30     use_extended_coo    = PETSC_FALSE;
31   }
32 };
33 #endif // PETSC_MPICUSPARSEMATIMPL_H
34