From c59aeef2e0c86ec3f0f34ce77c205f3ef0b034cc Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 8 Nov 2026 22:04:06 +0100 Subject: Abstract move. Forstio independence --- .../sim.cpp | 84 +++++++++++----------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp') diff --git a/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp b/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp index 4c9c8bd..d8c65fb 100644 --- a/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp +++ b/examples/moving_poiseulle_particles_2d_fplbm_gpu/sim.cpp @@ -17,7 +17,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using LbmArgs = Args< Struct< @@ -71,10 +70,10 @@ using ParticleSpheroidGroup = ParticleGroup>; } template -saw::error_or init( - saw::data>& fields, - saw::data>& macros, - saw::data>& particles +kel::lbm::error_or init( + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ auto& info_f = fields.template get<"info">(); // Set everything as walls @@ -146,9 +145,9 @@ saw::error_or init( dfs_f.get_dims() ); - saw::data> rad; + kel::lbm::data> rad; rad.at({}) = dim_y * 0.1f; - saw::data> dense; + kel::lbm::data> dense; dense.at({}) = 1.0f; particles = create_spheroid_particle_group(rad,dense,{1u}); { @@ -157,7 +156,7 @@ saw::error_or init( rbp.at({{0u}}) = 0.25 * dim_x; rbp.at({{1u}}) = 0.5 * dim_y; rb.template get<"position_old">() = rbp; - saw::data> zero; + kel::lbm::data> zero; zero.at({{0u}}) = 0.0f; zero.at({{1u}}) = 0.0f; rb.template get<"acceleration">() = zero; @@ -166,15 +165,15 @@ saw::error_or init( rb.template get<"angular_acceleration">() = {}; } - return saw::make_void(); + return kel::lbm::make_void(); } template -saw::error_or step( - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data>,encode::Sycl>& particles, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -182,9 +181,9 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component> fplbm_reset; + component> fplbm_reset; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -194,10 +193,10 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> fplbm_one_part; + component> fplbm_one_part; h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < 1u; ++i){ index.at({{i}}).set(idx[i]); } @@ -208,11 +207,11 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8}; - component> collision{0.8}; - component> bb; + component> bgk{0.8}; + component> collision{0.8}; + component> bb; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 8u; if(t_i.get() < target_t_i){ @@ -221,10 +220,10 @@ saw::error_or step( return 1.01; }() }; - component,encode::Sycl> flow_out{1.0}; + component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -254,18 +253,18 @@ saw::error_or step( }); }).wait(); - return saw::make_void(); + return kel::lbm::make_void(); } } } template -saw::error_or lbm_main(int argc, char** argv){ +kel::lbm::error_or lbm_main(int argc, char** argv){ using namespace kel::lbm; using dfi = df_info; - saw::data args; + kel::lbm::data args; { auto& args_n = args.template get<"args">(); auto& name = args_n.template get<"name">(); @@ -289,7 +288,7 @@ saw::error_or lbm_main(int argc, char** argv){ std::error_code ec; std::filesystem::create_directories(out_dir,ec); if(ec != std::errc{}){ - return saw::make_error("Could not create output directory"); + return kel::lbm::make_error("Could not create output directory"); } } @@ -302,17 +301,18 @@ saw::error_or lbm_main(int argc, char** argv){ print_lbm_meta(conv,{0.1},{1e-4},{0.4 * dim_y}); - // saw::data> meta{{dim_x,dim_y}}; - auto lbm_data_ptr = saw::heap>>(); - auto lbm_macro_data_ptr = saw::heap>>(); - auto lbm_parts_data_ptr = saw::heap>>(); - //saw::data>,encode::Sycl>& particles + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); + auto lbm_parts_data_ptr = kel::lbm::heap>>(); + //kel::lbm::data>,encode::Sycl>& particles std::cout<<"Estimated Bytes: "<,sch::MacroStruct>().get()<( + std::string{eo_aio.get_error().get_message()}); } auto& aio = eo_aio.get_value(); saw::wait_scope wait{aio.event_loop}; @@ -344,9 +344,9 @@ saw::error_or lbm_main(int argc, char** argv){ } } - saw::data, encode::Sycl> lbm_sycl_data{sycl_q}; - saw::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; - saw::data, encode::Sycl> lbm_sycl_parts_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_parts_data{sycl_q}; sycl_q.wait(); { @@ -372,10 +372,10 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_parts_data); - saw::data time_steps{32u*2048ul}; + kel::lbm::data time_steps{32u*2048ul}; auto& info_f = lsd_view.template get<"info">(); - for(saw::data i{0u}; i < time_steps and krun; ++i){ + for(kel::lbm::data i{0u}; i < time_steps and krun; ++i){ // BC + Collision { auto eov = step(lsd_view,lsdm_view,lsdp_view,i,dev); @@ -411,10 +411,10 @@ saw::error_or lbm_main(int argc, char** argv){ } // Stream sycl_q.submit([&](acpp::sycl::handler& h){ - component> stream; + component> stream; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -458,7 +458,7 @@ saw::error_or lbm_main(int argc, char** argv){ } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float64; -- cgit v1.3.1