1 #if !defined(PETSCVEC_KOKKOS_HPP) 2 #define PETSCVEC_KOKKOS_HPP 3 4 #include <petscconf.h> 5 6 #if defined(PETSC_HAVE_KOKKOS) 7 #if defined(petsccomplexlib) 8 #error "Error: You must include petscvec_kokkos.hpp before other petsc headers in this C++ file to use petsc complex with Kokkos" 9 #endif 10 11 #define PETSC_DESIRE_KOKKOS_COMPLEX 1 /* To control the definition of petsccomplexlib in petscsystypes.h */ 12 #endif 13 14 #include <petscvec.h> 15 16 #if defined(PETSC_HAVE_KOKKOS) 17 #include <Kokkos_Core.hpp> 18 19 /* Routines to get/restore Kokkos Views from PETSc vectors */ 20 21 /* Like VecGetArrayRead() */ 22 template<class MemorySpace> PetscErrorCode VecGetKokkosView (Vec,Kokkos::View<const PetscScalar*,MemorySpace>*); 23 template<class MemorySpace> PetscErrorCode VecRestoreKokkosView(Vec,Kokkos::View<const PetscScalar*,MemorySpace>*){return 0;} 24 25 /* Like VecGetArray() */ 26 template<class MemorySpace> PetscErrorCode VecGetKokkosView (Vec,Kokkos::View<PetscScalar*,MemorySpace>*); 27 template<class MemorySpace> PetscErrorCode VecRestoreKokkosView(Vec,Kokkos::View<PetscScalar*,MemorySpace>*); 28 29 /* Like VecGetArrayWrite() */ 30 template<class MemorySpace> PetscErrorCode VecGetKokkosViewWrite (Vec,Kokkos::View<PetscScalar*,MemorySpace>*); 31 template<class MemorySpace> PetscErrorCode VecRestoreKokkosViewWrite(Vec,Kokkos::View<PetscScalar*,MemorySpace>*); 32 33 #endif 34 35 #endif 36