summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-04-12 17:25:51 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-04-12 17:25:51 +0200
commit73405e9544f5c6910d8d2e3dea8062e5f5d62b71 (patch)
treee81387ddeb57f783d117efd8d438d139dacef324
parentcb77d1fe956d6011a5739bce5eddf6f6daf80661 (diff)
codec,remote-opencl: Work on remote devices
-rw-r--r--modules/codec/c++/rpc.hpp4
-rw-r--r--modules/remote-opencl/.nix/derivation.nix6
-rw-r--r--modules/remote-opencl/SConstruct6
-rw-r--r--modules/remote-opencl/c++/SConscript24
-rw-r--r--modules/remote-opencl/c++/device.hpp14
-rw-r--r--modules/remote-opencl/c++/remote.hpp10
-rw-r--r--modules/remote-opencl/c++/rpc.hpp44
-rw-r--r--modules/remote-opencl/tests/calculator.cpp7
8 files changed, 39 insertions, 76 deletions
diff --git a/modules/codec/c++/rpc.hpp b/modules/codec/c++/rpc.hpp
index 5f29f6e..5a24034 100644
--- a/modules/codec/c++/rpc.hpp
+++ b/modules/codec/c++/rpc.hpp
@@ -1,5 +1,9 @@
#pragma once
+#include <forstio/id.hpp>
+#include <forstio/codec/data.hpp>
+#include <forstio/io/io.hpp>
+
namespace saw {
/**
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<typename T>
-struct backend;
-
-struct backend<dev::Hip> {
-};
-
-
-}
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 <CL/cl.hpp>
+#include <CL/opencl.hpp>
+
+#include <forstio/codec/rpc.hpp>
namespace saw {
namespace rmt {
@@ -8,20 +10,22 @@ struct OpenCl {};
}
template<>
-class remote_api<rmt::OpenCl> {
+class remote<rmt::OpenCl> {
private:
SAW_FORBID_COPY(remote_ctx);
SAW_FORBID_MOVE(remote_ctx);
public:
remote_api(){}
+ /*
error_or<void> create_remote(){
return remote<rmt::OpenCl>{*this};
}
+ */
};
template<>
-struct remote<rmt::OpenCl> {
+struct remote_address<rmt::OpenCl> {
private:
remote_ctx<rmt::OpenCl>* 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<rmt::DeviceKokkos> {
-private:
-public:
- template<typename Iface>
- error_or<rpc_client<rmt::DeviceKokkos, Iface>> connect(){
- return make_error<err::not_implemented>();
- }
-};
-
-error_or<remote<rmt::DeviceKokkos>> create_remote(){
- auto rc = hipInit(0);
-
- return make_error<err::not_implemented>();
-}
-
-template<typename Iface>
-class rpc_client<rmt::DeviceKokkos, 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::DeviceKokkos, Iface> {
-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 <forstio/test/suite.hpp>
+
+#include "../c++/remote.hpp"
+
+SAW_TEST("OpenCl Calculator"){
+
+}