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 --- examples/settling_spheres_2d_hlbm_gpu/sim.cpp | 74 +++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'examples/settling_spheres_2d_hlbm_gpu/sim.cpp') diff --git a/examples/settling_spheres_2d_hlbm_gpu/sim.cpp b/examples/settling_spheres_2d_hlbm_gpu/sim.cpp index 5913a1f..26c2ed8 100644 --- a/examples/settling_spheres_2d_hlbm_gpu/sim.cpp +++ b/examples/settling_spheres_2d_hlbm_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_y = dim_x * 2ul; constexpr uint64_t particle_amount = 16ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -64,10 +63,10 @@ using ParticleSpheroidGroup = ParticleGroup< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros, - saw::data>& p_group +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& p_group ){ auto& info_f = fields.template get<"info">(); // Set everything as walls @@ -109,7 +108,7 @@ saw::error_or setup_initial_conditions( // Particles { - saw::data> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); // auto& spheroid_group = particles.template get<0u>(); auto& spheroid_group = particles; @@ -133,7 +132,7 @@ saw::error_or setup_initial_conditions( auto& p_rb = p_ind.template get<"rigid_body">(); auto& p_pos = p_rb.template get<"position">(); - saw::data> p; + kel::lbm::data> p; uint64_t x = index.at({0u}).get() % 8u; uint64_t y = index.at({1u}).get() / 8u; p.at({{0u}}).set( 0.2 + 0.6 / (x-1u) ); @@ -152,15 +151,15 @@ saw::error_or setup_initial_conditions( // Particle in hacky flavour {} - 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>& p_group, - 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>& p_group, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -175,7 +174,7 @@ saw::error_or step( q.submit([&](acpp::sycl::handler& h){ 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]); } @@ -185,7 +184,7 @@ saw::error_or step( q.submit([&](acpp::sycl::handler& h){ h.parallel_for(acpp::sycl::range<1u>{p_meta.at({0u}).get()}, [=](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]); } @@ -197,7 +196,7 @@ saw::error_or step( auto& p_rot = pirb.template get<"rotation">(); auto& p_acc = pirb.template get<"acceleration">(); - saw::data> delta_t; + kel::lbm::data> delta_t; delta_t.at({}).set(1.0f); verlet_step_lambda(p,delta_t); }); @@ -206,11 +205,11 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ // Need nicer things to handle the flow. I see improvement here - component> collision{0.8}; - component> bb; + component> collision{0.8}; + component> bb; 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]); } @@ -239,13 +238,13 @@ 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; @@ -262,7 +261,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"); } } @@ -275,18 +274,19 @@ saw::error_or lbm_main(int argc, char** argv){ print_lbm_meta(conv,{0.05},{0.01},{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_particle_data_ptr = saw::heap>>(); - // auto lbm_particles_ptr = saw::heap,part_count>>>(); - // saw::data> p_mask; + // 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_particle_data_ptr = kel::lbm::heap>>(); + // auto lbm_particles_ptr = kel::lbm::heap,part_count>>>(); + // kel::lbm::data> p_mask; std::cout<<"Estimated Bytes of LBM Fields: "<,sch::MacroStruct>().get()<( + std::string{eo_aio.get_error().get_message()}); } auto& aio = eo_aio.get_value(); saw::wait_scope wait{aio.event_loop}; @@ -318,9 +318,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_particle_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_particle_data{sycl_q}; { auto eov = dev.copy_to_device(*lbm_data_ptr,lbm_sycl_data); @@ -352,11 +352,11 @@ saw::error_or lbm_main(int argc, char** argv){ return eov; } } - saw::data time_steps{16u*4096ul}; + kel::lbm::data time_steps{16u*4096ul}; 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); @@ -397,10 +397,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]); } @@ -436,7 +436,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::Float32; -- cgit v1.3.1