summaryrefslogtreecommitdiff
path: root/modules/remote-kokkos/c++/remote.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/remote-kokkos/c++/remote.hpp')
-rw-r--r--modules/remote-kokkos/c++/remote.hpp48
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
+};
+}