Actual source code: cusparsematimpl.h

petsc-3.4.2 2013-07-02
4: #include <../src/vec/vec/impls/seq/seqcusp/cuspvecimpl.h> 6: #include <cusparse_v2.h> 8: /* New Way */ 9: #include "tx_sparse_interface.h" 11: #include <algorithm> 12: #include <vector> 13: #include <thrust/sort.h> 14: #include <thrust/fill.h> 16: /* Single instance of the cusparse handle for the class. */ 17: cusparseHandle_t MAT_cusparseHandle=0; 19: MatCUSPARSEStorageFormat cusparseMatSolveStorageFormat=MAT_CUSPARSE_CSR; 21: struct Mat_SeqAIJCUSPARSETriFactors { 22: GPU_Matrix_Ifc *loTriFactorPtr; /* pointer for lower triangular (factored matrix) on GPU */ 23: GPU_Matrix_Ifc *upTriFactorPtr; /* pointer for upper triangular (factored matrix) on GPU */ 24: CUSPARRAY *tempvec; 25: MatCUSPARSEStorageFormat format; /* the storage format for the matrix on the device */ 26: PetscBool hasTranspose; /* boolean describing whether a transpose has been built or not */ 27: PetscBool isSymmOrHerm; /* boolean describing whether the matrix is symmetric (hermitian) or not. This is used mostly for performance logging purposes. */ 28: }; 30: struct Mat_SeqAIJCUSPARSE { 31: GPU_Matrix_Ifc *mat; /* pointer to the matrix on the GPU */ 32: CUSPARRAY *tempvec; /*pointer to a workvector to which we can copy the relevant indices of a vector we want to multiply */ 33: PetscInt nonzerorow; /* number of nonzero rows ... used in the flop calculations */ 34: MatCUSPARSEStorageFormat format; /* the storage format for the matrix on the device */ 35: PetscBool hasTranspose; /* boolean describing whether a transpose has been built or not */ 36: PetscBool isSymmOrHerm; /* boolean describing whether the matrix is symmetric (hermitian) or not. This is used mostly for performance logging purposes. */ 37: }; 39: PETSC_INTERN PetscErrorCode MatCUSPARSECopyToGPU(Mat); 40: #endif