diff options
Diffstat (limited to 'modules/remote-kokkos/c++')
-rw-r--r-- | modules/remote-kokkos/c++/SConscript | 38 | ||||
-rw-r--r-- | modules/remote-kokkos/c++/device.hpp | 14 | ||||
-rw-r--r-- | modules/remote-kokkos/c++/remote.hpp | 48 | ||||
-rw-r--r-- | modules/remote-kokkos/c++/rpc.hpp | 47 |
4 files changed, 147 insertions, 0 deletions
diff --git a/modules/remote-kokkos/c++/SConscript b/modules/remote-kokkos/c++/SConscript new file mode 100644 index 0000000..b66ce79 --- /dev/null +++ b/modules/remote-kokkos/c++/SConscript @@ -0,0 +1,38 @@ +#!/bin/false + +import os +import os.path +import glob + + +Import('env') + +dir_path = Dir('.').abspath + +# Environment for base library +dev_hip_env = env.Clone(); + +dev_hip_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +dev_hip_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) + +env.sources += dev_hip_env.sources; +env.headers += dev_hip_env.headers; + +## Shared lib +objects_shared = [] +dev_hip_env.add_source_files(objects_shared, dev_hip_env.sources, shared=True); +env.library_shared = dev_hip_env.SharedLibrary('#build/forstio-device-hip', [objects_shared]); + +## Static lib +objects_static = [] +dev_hip_env.add_source_files(objects_static, dev_hip_env.sources, shared=False); +env.library_static = dev_hip_env.StaticLibrary('#build/forstio-device-hip', [objects_static]); + +# Set Alias +env.Alias('library_device-hip', [env.library_shared, env.library_static]); + +env.targets += ['library_device-hip']; + +# Install +env.Install('$prefix/lib/', [env.library_shared, env.library_static]); +env.Install('$prefix/include/forstio/device/hip/', [dev_hip_env.headers]); diff --git a/modules/remote-kokkos/c++/device.hpp b/modules/remote-kokkos/c++/device.hpp new file mode 100644 index 0000000..6c84fe1 --- /dev/null +++ b/modules/remote-kokkos/c++/device.hpp @@ -0,0 +1,14 @@ +#pragma once + +namespace saw { +namespace dev { +struct Hip {}; +} +template<typename T> +struct backend; + +struct backend<dev::Hip> { +}; + + +} 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 +}; +} diff --git a/modules/remote-kokkos/c++/rpc.hpp b/modules/remote-kokkos/c++/rpc.hpp new file mode 100644 index 0000000..5bce553 --- /dev/null +++ b/modules/remote-kokkos/c++/rpc.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include <hip.hpp> + +namespace saw { +namespace rmt { +struct DeviceHip {}; +} + +template<> +class remote<rmt::DeviceHip> { +private: +public: + template<typename Iface> + error_or<rpc_client<rmt::DeviceHip, Iface>> connect(){ + return make_error<err::not_implemented>(); + } +}; + +error_or<remote<rmt::DeviceHip>> create_remote(){ + auto rc = hipInit(0); + + return make_error<err::not_implemented>(); +} + +template<typename Iface> +class rpc_client<rmt::DeviceHip, Iface> { +public: + template<typename... T> + struct request { + std::tuple<id<T>...> ids; + + error_or<data<schema::Tuple<T...>>> wait(); + }; +}; + +template<typename Iface> +class rpc_server<rmt::DeviceHip, Iface> { +private: + /** + * Needs a variant ptr of all possible return types + */ + struct data_storage { + }; + +}; +} |