xref: /petsc/src/mat/impls/aij/seq/seqcusparse/cusparsematimpl.h (revision 784ad74dfe8240901f89316a5dd0cd307000ed2b)
1 #ifndef __CUSPARSEMATIMPL
2 #define __CUSPARSEMATIMPL
3 
4 #include <../src/vec/vec/impls/seq/seqcusp/cuspvecimpl.h>
5 
6 #include <cusparse_v2.h>
7 
8 /* New Way */
9 #include "tx_sparse_interface.h"
10 
11 #include <algorithm>
12 #include <vector>
13 #include <string>
14 #include <thrust/sort.h>
15 #include <thrust/fill.h>
16 
17 // Single instance of the cusparse handle for the class.
18 cusparseHandle_t MAT_cusparseHandle=0;
19 
20 struct Mat_SeqAIJCUSPARSETriFactors {
21   GPU_Matrix_Ifc* loTriFactorPtr; /* pointer for lower triangular (factored matrix) on GPU */
22   GPU_Matrix_Ifc* upTriFactorPtr; /* pointer for upper triangular (factored matrix) on GPU */
23   CUSPARRAY* tempvec;
24   GPUStorageFormat  format;  /* the storage format for the matrix on the device */
25 };
26 
27 struct Mat_SeqAIJCUSPARSE {
28   GPU_Matrix_Ifc*   mat; /* pointer to the matrix on the GPU */
29   CUSPARRAY*        tempvec; /*pointer to a workvector to which we can copy the relevant indices of a vector we want to multiply */
30   PetscInt          nonzerorow; /* number of nonzero rows ... used in the flop calculations */
31   GPUStorageFormat  format;   /* the storage format for the matrix on the device */
32 };
33 
34 extern PetscErrorCode MatCUSPARSECopyToGPU(Mat);
35 //extern PetscErrorCode MatGetFactor_seqaij_cusparse(Mat,MatFactorType,Mat*);
36 //extern PetscErrorCode MatFactorGetSolverPackage_seqaij_cusparse(Mat,const MatSolverPackage *);
37 //extern PetscErrorCode MatCUSPARSECopyFromGPU(Mat, CUSPMATRIX *);
38 #endif
39