8 #ifndef INCLUDE_KOKKOSINTERFACE_H_ 9 #define INCLUDE_KOKKOSINTERFACE_H_ 11 #include <stk_mesh/base/Entity.hpp> 12 #include <Kokkos_Core.hpp> 22 using TeamHandleType = Kokkos::TeamPolicy<DeviceSpace, DynamicScheduleType>::member_type;
25 using SharedMemView = Kokkos::View<T, Kokkos::LayoutRight, DeviceShmem, Kokkos::MemoryUnmanaged>;
31 const size_t bytes_per_thread)
34 return policy.set_scratch_size(0, Kokkos::PerTeam(bytes_per_team), Kokkos::PerThread(bytes_per_thread));
40 return Kokkos::subview(
SharedMemView<int**>(team.team_shmem(), team.team_size(), len), team.team_rank(), Kokkos::ALL());
52 return Kokkos::subview(
SharedMemView<T**>(team.team_shmem(), team.team_size(), len), team.team_rank(), Kokkos::ALL());
58 return Kokkos::subview(
SharedMemView<T***>(team.team_shmem(), team.team_size(), len1, len2), team.team_rank(), Kokkos::ALL(), Kokkos::ALL());
64 return Kokkos::subview(
SharedMemView<T****>(team.team_shmem(), team.team_size(), len1, len2, len3), team.team_rank(), Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
67 template<
typename SizeType,
class Function>
70 Kokkos::parallel_for(debuggingName, Kokkos::RangePolicy<Kokkos::Serial>(0, n), loop_body);
73 template<
typename SizeType,
class Function,
typename ReduceType>
76 Kokkos::parallel_reduce(debuggingName, Kokkos::RangePolicy<Kokkos::Serial>(0, n), loop_body, reduce);
SharedMemView< stk::mesh::Entity * > get_entity_shmem_view_1D(const TeamHandleType &team, size_t len)
Definition: KokkosInterface.h:44
Kokkos::HostSpace HostSpace
Definition: KokkosInterface.h:17
DeviceTeamPolicy::member_type DeviceTeam
Definition: KokkosInterface.h:28
Definition: ABLForcingAlgorithm.C:26
Kokkos::DefaultExecutionSpace DeviceSpace
Definition: KokkosInterface.h:18
SharedMemView< int * > get_int_shmem_view_1D(const TeamHandleType &team, size_t len)
Definition: KokkosInterface.h:38
void kokkos_parallel_for(const std::string &debuggingName, SizeType n, Function loop_body)
Definition: KokkosInterface.h:68
Kokkos::Schedule< Kokkos::Dynamic > DynamicScheduleType
Definition: KokkosInterface.h:21
SharedMemView< T * > get_shmem_view_1D(const TeamHandleType &team, size_t len)
Definition: KokkosInterface.h:50
Kokkos::TeamPolicy< DeviceSpace > DeviceTeamPolicy
Definition: KokkosInterface.h:27
void kokkos_parallel_reduce(SizeType n, Function loop_body, ReduceType &reduce, const std::string &debuggingName)
Definition: KokkosInterface.h:74
DeviceTeamPolicy get_team_policy(const size_t sz, const size_t bytes_per_team, const size_t bytes_per_thread)
Definition: KokkosInterface.h:30
Kokkos::View< T, Kokkos::LayoutRight, DeviceShmem, Kokkos::MemoryUnmanaged > SharedMemView
Definition: KokkosInterface.h:25
SharedMemView< T ** > get_shmem_view_2D(const TeamHandleType &team, size_t len1, size_t len2)
Definition: KokkosInterface.h:56
Kokkos::TeamPolicy< DeviceSpace, DynamicScheduleType >::member_type TeamHandleType
Definition: KokkosInterface.h:22
DeviceSpace::scratch_memory_space DeviceShmem
Definition: KokkosInterface.h:20
SharedMemView< T *** > get_shmem_view_3D(const TeamHandleType &team, size_t len1, size_t len2, size_t len3)
Definition: KokkosInterface.h:62