4: #include <../src/vec/vec/impls/seq/seqcusp/cuspvecimpl.h>
6: /*for MatCreateSeqAIJCUSPFromTriple*/
7: #include <cusp/coo_matrix.h>
8: /* for everything else */
9: #include <cusp/csr_matrix.h>
10: #include <cusp/multiply.h>
12: /* need the thrust version */
13: #include <thrust/version.h>
15: /* Old way */
16: #define CUSPMATRIX cusp::csr_matrix<PetscInt,PetscScalar,cusp::device_memory> 18: /* New Way */
19: #if defined(PETSC_HAVE_TXPETSCGPU)
20: #include "tx_sparse_interface.h"
22: struct Mat_SeqAIJCUSP {
23: GPU_Matrix_Ifc *mat; /* pointer to the matrix on the GPU */
24: CUSPARRAY *tempvec; /*pointer to a workvector to which we can copy the relevant indices of a vector we want to multiply */
25: PetscInt nonzerorow; /* number of nonzero rows ... used in the flop calculations */
26: MatCUSPStorageFormat format; /* the storage format for the matrix on the device */
27: };
29: #else /* PETSC_HAVE_TXPETSCGPU not defined! */
31: struct Mat_SeqAIJCUSP {
32: CUSPMATRIX *mat; /* pointer to the matrix on the GPU */
33: CUSPINTARRAYGPU *indices; /*pointer to an array containing the nonzero row indices, should usecprow be true*/
34: CUSPARRAY *tempvec; /*pointer to a workvector to which we can copy the relevant indices of a vector we want to multiply */
35: PetscInt nonzerorow; /* number of nonzero rows ... used in the flop calculations */
36: };
37: #endif
40: PETSC_INTERN PetscErrorCode MatCUSPCopyToGPU(Mat);
41: PETSC_INTERN PetscErrorCode MatCUSPCopyFromGPU(Mat, CUSPMATRIX*);
42: #endif