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 // this is such a hack ... but I don't know of another way to pass this variable 12 // from one GPU_Matrix_Ifc class to another. This is necessary for the parallel 13 // SpMV. Essentially, I need to use the same stream variable in two different 14 // data structures. I do this by creating a single instance of that stream 15 // and reuse it. 16 cudaStream_t theBodyStream=0; 17 18 #include <algorithm> 19 #include <vector> 20 #include <string> 21 #include <thrust/sort.h> 22 #include <thrust/fill.h> 23 24 // Single instance of the cusparse handle for the class. 25 cusparseHandle_t MAT_cusparseHandle=0; 26 27 struct Mat_SeqAIJCUSPARSETriFactors { 28 GPU_Matrix_Ifc* loTriFactorPtr; /* pointer for lower triangular (factored matrix) on GPU */ 29 GPU_Matrix_Ifc* upTriFactorPtr; /* pointer for upper triangular (factored matrix) on GPU */ 30 CUSPARRAY* tempvec; 31 const GPUStorageFormat format; /* the storage format for the matrix on the device */ 32 }; 33 34 struct Mat_SeqAIJCUSPARSE { 35 GPU_Matrix_Ifc* mat; /* pointer to the matrix on the GPU */ 36 CUSPARRAY* tempvec; /*pointer to a workvector to which we can copy the relevant indices of a vector we want to multiply */ 37 PetscInt nonzerorow; /* number of nonzero rows ... used in the flop calculations */ 38 const GPUStorageFormat format; /* the storage format for the matrix on the device */ 39 }; 40 41 extern PetscErrorCode MatCUSPARSECopyToGPU(Mat); 42 //extern PetscErrorCode MatGetFactor_seqaij_cusparse(Mat,MatFactorType,Mat*); 43 //extern PetscErrorCode MatFactorGetSolverPackage_seqaij_cusparse(Mat,const MatSolverPackage *); 44 //extern PetscErrorCode MatCUSPARSECopyFromGPU(Mat, CUSPMATRIX *); 45 #endif 46