Date: 2021-03-03T22:25:53+00:00

Actual source code: viennaclvecimpl.h
petsc-3.14.5 2021-03-03
Report Typos and Errors

      4: #include <petscviennacl.h>
      5: #include <petsc/private/vecimpl.h>

      7: #include <algorithm>
      8: #include <vector>
      9: #include <string>
     10: #include <exception>

     12: #include "viennacl/vector.hpp"

     14: #define ViennaCLWaitForGPU() if (PetscViennaCLSynchronize) viennacl::backend::finish();

     16: typedef viennacl::vector<PetscScalar>    ViennaCLVector;

     18: PETSC_EXTERN PetscErrorCode PetscViennaCLInit();

     20: PETSC_INTERN PetscErrorCode VecDotNorm2_SeqViennaCL(Vec,Vec,PetscScalar*, PetscScalar*);
     21: PETSC_INTERN PetscErrorCode VecPointwiseDivide_SeqViennaCL(Vec,Vec,Vec);
     22: PETSC_INTERN PetscErrorCode VecWAXPY_SeqViennaCL(Vec,PetscScalar,Vec,Vec);
     23: PETSC_INTERN PetscErrorCode VecMDot_SeqViennaCL(Vec,PetscInt,const Vec[],PetscScalar*);
     24: PETSC_INTERN PetscErrorCode VecSet_SeqViennaCL(Vec,PetscScalar);
     25: PETSC_INTERN PetscErrorCode VecMAXPY_SeqViennaCL(Vec,PetscInt,const PetscScalar*,Vec*);
     26: PETSC_INTERN PetscErrorCode VecAXPBYPCZ_SeqViennaCL(Vec,PetscScalar,PetscScalar,PetscScalar,Vec,Vec);
     27: PETSC_INTERN PetscErrorCode VecPointwiseMult_SeqViennaCL(Vec,Vec,Vec);
     28: PETSC_INTERN PetscErrorCode VecPlaceArray_SeqViennaCL(Vec,const PetscScalar*);
     29: PETSC_INTERN PetscErrorCode VecResetArray_SeqViennaCL(Vec);
     30: PETSC_INTERN PetscErrorCode VecReplaceArray_SeqViennaCL(Vec,const PetscScalar*);
     31: PETSC_INTERN PetscErrorCode VecDot_SeqViennaCL(Vec,Vec,PetscScalar*);
     32: PETSC_INTERN PetscErrorCode VecTDot_SeqViennaCL(Vec,Vec,PetscScalar*);
     33: PETSC_INTERN PetscErrorCode VecScale_SeqViennaCL(Vec,PetscScalar);
     34: PETSC_INTERN PetscErrorCode VecCopy_SeqViennaCL(Vec,Vec);
     35: PETSC_INTERN PetscErrorCode VecSwap_SeqViennaCL(Vec,Vec);
     36: PETSC_INTERN PetscErrorCode VecAXPY_SeqViennaCL(Vec,PetscScalar,Vec);
     37: PETSC_INTERN PetscErrorCode VecAXPBY_SeqViennaCL(Vec,PetscScalar,PetscScalar,Vec);
     38: PETSC_INTERN PetscErrorCode VecDuplicate_SeqViennaCL(Vec,Vec*);
     39: PETSC_INTERN PetscErrorCode VecNorm_SeqViennaCL(Vec,NormType,PetscReal*);
     40: PETSC_INTERN PetscErrorCode VecViennaCLCopyToGPU(Vec);
     41: PETSC_INTERN PetscErrorCode VecViennaCLAllocateCheck(Vec);
     42: PETSC_EXTERN PetscErrorCode VecViennaCLAllocateCheckHost(Vec);
     43: PETSC_EXTERN PetscErrorCode VecCreate_SeqViennaCL(Vec);
     44: PETSC_INTERN PetscErrorCode VecCreate_SeqViennaCL_Private(Vec,const ViennaCLVector *);
     45: PETSC_EXTERN PetscErrorCode VecView_Seq(Vec,PetscViewer);
     46: PETSC_INTERN PetscErrorCode VecDestroy_SeqViennaCL(Vec);
     47: PETSC_INTERN PetscErrorCode VecAYPX_SeqViennaCL(Vec,PetscScalar,Vec);
     48: PETSC_INTERN PetscErrorCode VecSetRandom_SeqViennaCL(Vec,PetscRandom);

     50: PETSC_INTERN PetscErrorCode VecCreate_MPIViennaCL_Private(Vec,PetscBool,PetscInt,const ViennaCLVector *);

     52: PETSC_INTERN PetscErrorCode VecViennaCLCopyToGPU_Public(Vec);
     53: PETSC_INTERN PetscErrorCode VecViennaCLAllocateCheck_Public(Vec);

     55: struct Vec_ViennaCL {
     56:   viennacl::vector<PetscScalar> *GPUarray;           // this always holds the GPU data
     57:   viennacl::vector<PetscScalar> *GPUarray_allocated; // if the array was allocated by PETSc this is its pointer
     58: };

     62: #endif