xref: /petsc/src/mat/impls/aij/mpi/mpicusparse/mpicusparsematimpl.h (revision d5b43468fb8780a8feea140ccd6fa3e6a50411cc)
1 #ifndef PETSC_MPICUSPARSEMATIMPL_H
2 #define PETSC_MPICUSPARSEMATIMPL_H
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   {
27     diagGPUMatFormat    = MAT_CUSPARSE_CSR;
28     offdiagGPUMatFormat = MAT_CUSPARSE_CSR;
29     coo_p               = NULL;
30     coo_pw              = NULL;
31     deviceMat           = NULL;
32     use_extended_coo    = PETSC_FALSE;
33   }
34 };
35 #endif // PETSC_MPICUSPARSEMATIMPL_H
36