Actual source code: viennaclmatimpl.h

  1: #pragma once

  3: #define PETSC_SKIP_IMMINTRIN_H_CUDAWORKAROUND 1
  4: #include <../src/mat/impls/aij/seq/aij.h>

  6: /* Pulls in some ViennaCL includes as well as VIENNACL_WITH_OPENCL: */
  7: #include <../src/vec/vec/impls/seq/seqviennacl/viennaclvecimpl.h>

  9: /* for everything else */
 10: #include "viennacl/compressed_matrix.hpp"
 11: #include "viennacl/compressed_compressed_matrix.hpp"

 13: typedef viennacl::compressed_matrix<PetscScalar>            ViennaCLAIJMatrix;
 14: typedef viennacl::compressed_compressed_matrix<PetscScalar> ViennaCLCompressedAIJMatrix;

 16: struct Mat_SeqAIJViennaCL {
 17:   Mat_SeqAIJViennaCL() : tempvec(NULL), mat(NULL), compressed_mat(NULL) { }
 18:   ViennaCLVector              *tempvec;
 19:   ViennaCLAIJMatrix           *mat;            /* pointer to the matrix on the GPU */
 20:   ViennaCLCompressedAIJMatrix *compressed_mat; /* compressed CSR */
 21: };

 23: PETSC_INTERN PetscErrorCode MatViennaCLCopyToGPU(Mat);
 24: PETSC_INTERN PetscErrorCode MatViennaCLCopyFromGPU(Mat, ViennaCLAIJMatrix *);