Actual source code: cuspmatimpl.h

petsc-3.3-p7 2013-05-11
  1: #ifndef __CUSPMATIMPL 

  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: #ifdef PETSC_HAVE_TXPETSCGPU
 20: #include "tx_spmv_interface.h"
 21: #endif /* PETSC_HAVE_TXPETSCGPU */

 23: struct Mat_SeqAIJCUSP {
 24:   CUSPMATRIX*       mat; /* pointer to the matrix on the GPU */
 25:   CUSPINTARRAYGPU*  indices; /*pointer to an array containing the nonzero row indices, should usecprow be true*/
 26:   CUSPARRAY*        tempvec; /*pointer to a workvector to which we can copy the relevant indices of a vector we want to multiply */
 27:   PetscInt            nonzerorow; /* number of nonzero rows ... used in the flop calculations */
 28: };


 31: extern PetscErrorCode MatCUSPCopyToGPU(Mat);
 32: extern PetscErrorCode MatCUSPCopyFromGPU(Mat, CUSPMATRIX *);
 33: #endif