diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-01-28 16:03:29 +0100 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-01-28 16:03:29 +0100 |
commit | 6f2cabfa4311eb71d70ec03a0a46b9ab55fd0820 (patch) | |
tree | 39401fc71ad2d804f10cf1c7296acb35e75dde59 /modules/remote-kokkos/c++/remote.hpp | |
parent | ae75e63bfaf927e10e9f2642b3a1a9dae04b7dbc (diff) |
device-hip, remote-kokkos: Moving to kokkos. Easier to manage
Diffstat (limited to 'modules/remote-kokkos/c++/remote.hpp')
-rw-r--r-- | modules/remote-kokkos/c++/remote.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/remote-kokkos/c++/remote.hpp b/modules/remote-kokkos/c++/remote.hpp new file mode 100644 index 0000000..549b9ec --- /dev/null +++ b/modules/remote-kokkos/c++/remote.hpp @@ -0,0 +1,48 @@ +#pragma once + +#include <Kokkos_Core.hpp> + +namespace saw { +namespace rmt { +struct Kokkos {}; +} + +template<typename T> +struct remote; + +template<typename T> +struct remote_ctx; + +template<> +class remote_ctx<rmt::Kokkos> { +private: + Kokkos::ScopeGuard guard_; + + SAW_FORBID_COPY(remote_ctx); + SAW_FORBID_MOVE(remote_ctx); +public: + remote_ctx(Kokkos::InitializationSettings init_settings): + guard_{std::move(init_settings)} + {} + + error_or<void> create_remote(){ + return remote<rmt::Kokkos>{*this}; + } +}; + +template<> +struct remote<rmt::Kokkos> { +private: + remote_ctx<rmt::Kokkos>* ctx_; + + SAW_FORBID_COPY(remote); + SAW_FORBID_MOVE(remote); +public: + remote(remote_ctx<rmt::Kokkos>& r_ctx): + ctx_{&r_ctx} + {} + + template<typename Iface> + error +}; +} |