From 73405e9544f5c6910d8d2e3dea8062e5f5d62b71 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 12 Apr 2024 17:25:51 +0200 Subject: codec,remote-opencl: Work on remote devices --- modules/remote-opencl/.nix/derivation.nix | 6 +++- modules/remote-opencl/SConstruct | 6 ++-- modules/remote-opencl/c++/SConscript | 24 ++++++++-------- modules/remote-opencl/c++/device.hpp | 14 ---------- modules/remote-opencl/c++/remote.hpp | 10 +++++-- modules/remote-opencl/c++/rpc.hpp | 44 ------------------------------ modules/remote-opencl/tests/calculator.cpp | 7 +++++ 7 files changed, 35 insertions(+), 76 deletions(-) delete mode 100644 modules/remote-opencl/c++/device.hpp delete mode 100644 modules/remote-opencl/c++/rpc.hpp create mode 100644 modules/remote-opencl/tests/calculator.cpp (limited to 'modules/remote-opencl') diff --git a/modules/remote-opencl/.nix/derivation.nix b/modules/remote-opencl/.nix/derivation.nix index 564a27f..8c14796 100644 --- a/modules/remote-opencl/.nix/derivation.nix +++ b/modules/remote-opencl/.nix/derivation.nix @@ -4,6 +4,7 @@ , clang-tools , version , forstio +, opencl-clhpp }: let @@ -22,7 +23,10 @@ in stdenv.mkDerivation { buildInputs = [ forstio.core - forstio.codec + forstio.codec + forstio.async + forstio.io + opencl-clhpp ]; outputs = ["out" "dev"]; diff --git a/modules/remote-opencl/SConstruct b/modules/remote-opencl/SConstruct index c5b2bb4..e344f75 100644 --- a/modules/remote-opencl/SConstruct +++ b/modules/remote-opencl/SConstruct @@ -47,8 +47,10 @@ env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], CPPDEFINES=['SAW_UNIX'], CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], LIBS=[ - 'forstio-core' - 'forstio-codec' + 'forstio-core', + 'forstio-codec', + 'forstio-async', + 'forstio-io' ] ); env.__class__.add_source_files = add_kel_source_files diff --git a/modules/remote-opencl/c++/SConscript b/modules/remote-opencl/c++/SConscript index b66ce79..e902c22 100644 --- a/modules/remote-opencl/c++/SConscript +++ b/modules/remote-opencl/c++/SConscript @@ -10,29 +10,29 @@ Import('env') dir_path = Dir('.').abspath # Environment for base library -dev_hip_env = env.Clone(); +dev_opencl_env = env.Clone(); -dev_hip_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) -dev_hip_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) +dev_opencl_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +dev_opencl_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) -env.sources += dev_hip_env.sources; -env.headers += dev_hip_env.headers; +env.sources += dev_opencl_env.sources; +env.headers += dev_opencl_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]); +dev_opencl_env.add_source_files(objects_shared, dev_opencl_env.sources, shared=True); +env.library_shared = dev_opencl_env.SharedLibrary('#build/forstio-remote-opencl', [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]); +dev_opencl_env.add_source_files(objects_static, dev_opencl_env.sources, shared=False); +env.library_static = dev_opencl_env.StaticLibrary('#build/forstio-remote-opencl', [objects_static]); # Set Alias -env.Alias('library_device-hip', [env.library_shared, env.library_static]); +env.Alias('library_remote_opencl', [env.library_shared, env.library_static]); -env.targets += ['library_device-hip']; +env.targets += ['library_remote_opencl']; # Install env.Install('$prefix/lib/', [env.library_shared, env.library_static]); -env.Install('$prefix/include/forstio/device/hip/', [dev_hip_env.headers]); +env.Install('$prefix/include/forstio/remote/opencl/', [dev_opencl_env.headers]); diff --git a/modules/remote-opencl/c++/device.hpp b/modules/remote-opencl/c++/device.hpp deleted file mode 100644 index 7176004..0000000 --- a/modules/remote-opencl/c++/device.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace saw { -namespace rmt { -struct OpenCl{}; -} -template -struct backend; - -struct backend { -}; - - -} diff --git a/modules/remote-opencl/c++/remote.hpp b/modules/remote-opencl/c++/remote.hpp index 4ece821..0ef9e57 100644 --- a/modules/remote-opencl/c++/remote.hpp +++ b/modules/remote-opencl/c++/remote.hpp @@ -1,6 +1,8 @@ #pragma once -#include +#include + +#include namespace saw { namespace rmt { @@ -8,20 +10,22 @@ struct OpenCl {}; } template<> -class remote_api { +class remote { private: SAW_FORBID_COPY(remote_ctx); SAW_FORBID_MOVE(remote_ctx); public: remote_api(){} + /* error_or create_remote(){ return remote{*this}; } + */ }; template<> -struct remote { +struct remote_address { private: remote_ctx* ctx_; diff --git a/modules/remote-opencl/c++/rpc.hpp b/modules/remote-opencl/c++/rpc.hpp deleted file mode 100644 index bddb60d..0000000 --- a/modules/remote-opencl/c++/rpc.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -namespace saw { -namespace rmt { -struct DeviceKokkos {}; -} - -template<> -class remote { -private: -public: - template - error_or> connect(){ - return make_error(); - } -}; - -error_or> create_remote(){ - auto rc = hipInit(0); - - return make_error(); -} - -template -class rpc_client { -public: - template - struct request { - std::tuple...> ids; - - error_or>> wait(); - }; -}; - -template -class rpc_server { -private: - /** - * Needs a variant ptr of all possible return types - */ - struct data_storage { - }; -}; -} diff --git a/modules/remote-opencl/tests/calculator.cpp b/modules/remote-opencl/tests/calculator.cpp new file mode 100644 index 0000000..9ee1583 --- /dev/null +++ b/modules/remote-opencl/tests/calculator.cpp @@ -0,0 +1,7 @@ +#include + +#include "../c++/remote.hpp" + +SAW_TEST("OpenCl Calculator"){ + +} -- cgit v1.2.3