From 8b3ade73997e9f87f1232b9dc9af35969e6f50dd Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 19 Jan 2026 13:35:25 +0100 Subject: Rewriting parts to handle different ghost layers --- examples/heterogeneous_computing/sim.cpp | 96 ++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 examples/heterogeneous_computing/sim.cpp (limited to 'examples/heterogeneous_computing/sim.cpp') diff --git a/examples/heterogeneous_computing/sim.cpp b/examples/heterogeneous_computing/sim.cpp new file mode 100644 index 0000000..d074ad8 --- /dev/null +++ b/examples/heterogeneous_computing/sim.cpp @@ -0,0 +1,96 @@ +#include +#include + +#include + +namespace kel { +namespace lbm { +namespace sch { +using namespace saw::schema; + +/** + * struct lbm_data { + * std::array, 64u*64u> dfs; + * std::array info; + * }; + * + * which leads to the form + * + * template + * struct lbm_data { + * std::array, Size*Size> dfs; + * std::array info; + * }; + * + * which transferred into sycl requires us to go to + * + * template + * struct lbm_sycl_data { + * std::array* dfs; + * uint8_t* info; + * }; + * + * in data form on host + * + * template + * using LbmData = Struct< + * Member, Size*Size>, "dfs">, + * Member, "info"> + * >; + * + * If we specialize the encode::Sycl data type, then we get + * With a helper class we can copy single values back and forth and the whole block is guaranteed + * to be allocated. And this one can be dynamic while the host definition might be compile time. + * + * template<...> + * class data,encode::Sycl> final { + * saw::data> meta; + * saw::data>* dfs; + * saw::data* info; + * }; + */ + +template +using CellStruct = Struct< + Member,Desc::D, "dfs">, + Member, "dfs_old">, + Member +>; + +} +template +saw::error_or simulate(int argc, char** argv, + const saw::data>& meta +{ + constexpr auto cell_size = sizeof(saw::data>); + + auto lbm_data = saw::heap,Desc::D, 64u>>>{meta}; + + return saw::make_void(); +} + +} + +saw::error_or lbm_main(int argc, char** argv){ + using namespace lbm; + return simulate(argc, argv); +} +} + +int main(int argc, char** argv){ + auto eov = kel::lbm_main(argc, argv); + if(eov.is_error()){ + auto& err = eov.get_error(); + auto err_msg = err.get_message(); + std::cerr<<"[Error]: "<