xref: /petsc/src/mat/impls/aij/mpi/mpicusparse/mpicusparsematimpl.h (revision 158ec288e43a668c7d0638fc9121b5c255ad5de4)
1519f805aSKarl Rupp #if !defined(__MPICUSPARSEMATIMPL)
2bbf3fe20SPaul Mullowney #define __MPICUSPARSEMATIMPL
3bbf3fe20SPaul Mullowney 
4b06137fdSPaul Mullowney #include <cusparse_v2.h>
5303a667bSSatish Balay #include <petsc/private/cudavecimpl.h>
6b06137fdSPaul Mullowney 
7219fbbafSJunchao Zhang struct Mat_MPIAIJCUSPARSE {
8bbf3fe20SPaul Mullowney   /* The following are used by GPU capabilities to store matrix storage formats on the device */
9e057df02SPaul Mullowney   MatCUSPARSEStorageFormat   diagGPUMatFormat;
10e057df02SPaul Mullowney   MatCUSPARSEStorageFormat   offdiagGPUMatFormat;
11042217e8SBarry Smith   PetscSplitCSRDataStructure deviceMat;
12ddea5d60SJunchao Zhang   PetscInt                   coo_nd,coo_no; /* number of nonzero entries in coo for the diag/offdiag part */
13ddea5d60SJunchao Zhang   THRUSTINTARRAY             *coo_p; /* the permutation array that partitions the coo array into diag/offdiag parts */
14ddea5d60SJunchao Zhang   THRUSTARRAY                *coo_pw; /* the work array that stores the partitioned coo scalar values */
15219fbbafSJunchao Zhang 
16219fbbafSJunchao Zhang   /* Extended COO stuff */
17*158ec288SJunchao Zhang   PetscCount  *Ajmap1_d,*Aperm1_d; /* Local entries to diag */
18*158ec288SJunchao Zhang   PetscCount  *Bjmap1_d,*Bperm1_d; /* Local entries to offdiag */
19219fbbafSJunchao Zhang   PetscCount  *Aimap2_d,*Ajmap2_d,*Aperm2_d; /* Remote entries to diag */
20219fbbafSJunchao Zhang   PetscCount  *Bimap2_d,*Bjmap2_d,*Bperm2_d; /* Remote entries to offdiag */
21219fbbafSJunchao Zhang   PetscCount  *Cperm1_d; /* Permutation to fill send buffer. 'C' for communication */
22219fbbafSJunchao Zhang   PetscScalar *sendbuf_d,*recvbuf_d; /* Buffers for remote values in MatSetValuesCOO() */
23219fbbafSJunchao Zhang   PetscBool   use_extended_coo;
24219fbbafSJunchao Zhang 
25219fbbafSJunchao Zhang   Mat_MPIAIJCUSPARSE() {
26219fbbafSJunchao Zhang     diagGPUMatFormat    = MAT_CUSPARSE_CSR;
27219fbbafSJunchao Zhang     offdiagGPUMatFormat = MAT_CUSPARSE_CSR;
28219fbbafSJunchao Zhang     coo_p               = NULL;
29219fbbafSJunchao Zhang     coo_pw              = NULL;
30219fbbafSJunchao Zhang     deviceMat           = NULL;
31219fbbafSJunchao Zhang     use_extended_coo    = PETSC_FALSE;
32219fbbafSJunchao Zhang   }
33219fbbafSJunchao Zhang };
34bbf3fe20SPaul Mullowney #endif
35