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/cavity_2d/cavity_2d.cpp | 43 +++--- examples/cavity_2d_gpu/cavity_2d_gpu.cpp | 61 ++++---- examples/cavity_3d.cpp | 43 +++--- examples/dkt/common.hpp | 1 - examples/dkt/init.hpp | 14 +- examples/dkt/sim.cpp | 38 ++--- examples/dkt/step.hpp | 90 ++++++------ examples/feature_development/common.hpp | 1 - examples/feature_development/init.hpp | 18 +-- examples/feature_development/sim.cpp | 38 ++--- examples/feature_development/step.hpp | 30 ++-- examples/heterogeneous_computing/sim.cpp | 19 ++- examples/meta/meta.cpp | 27 ++-- .../sim.cpp | 84 +++++------ .../moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp | 80 +++++------ .../moving_poiseulle_particles_2d_psm_gpu/sim.cpp | 82 +++++------ examples/one_particle_sedimentation_2d/common.hpp | 1 - examples/one_particle_sedimentation_2d/init.hpp | 14 +- examples/one_particle_sedimentation_2d/sim.cpp | 38 ++--- examples/one_particle_sedimentation_2d/step.hpp | 84 +++++------ examples/particles_gpu/particles_gpu.cpp | 27 ++-- examples/poiseulle_2d/poiseulle_2d.cpp | 71 +++++----- examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp | 83 ++++++----- examples/poiseulle_3d/poiseulle_3d.cpp | 71 +++++----- examples/poiseulle_3d_gpu/sim.cpp | 64 ++++----- .../poiseulle_moving_particle_2d_psm_gpu/sim.cpp | 60 ++++---- examples/poiseulle_particles_2d_bgk_gpu/sim.cpp | 68 ++++----- examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp | 66 ++++----- examples/poiseulle_particles_2d_gpu/common.hpp | 1 - examples/poiseulle_particles_2d_gpu/init.hpp | 18 +-- examples/poiseulle_particles_2d_gpu/sim.cpp | 38 ++--- examples/poiseulle_particles_2d_gpu/step.hpp | 30 ++-- examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp | 74 +++++----- examples/poiseulle_particles_2d_ibm_gpu/sim.cpp | 78 +++++----- examples/poiseulle_particles_2d_psm_gpu/sim.cpp | 78 +++++----- .../poiseulle_particles_channel_2d.cpp | 157 ++++++++++----------- .../common.hpp | 1 - .../init.hpp | 14 +- .../schaefer_turek_durst_krause_rannbacher/sim.cpp | 38 ++--- .../step.hpp | 90 ++++++------ examples/settling_cubes_2d_ibm_gpu/sim.cpp | 82 +++++------ examples/settling_spheres_2d_hlbm_gpu/sim.cpp | 74 +++++----- examples/stdkr_2d_bgk/common.hpp | 1 - examples/stdkr_2d_bgk/init.hpp | 16 +-- examples/stdkr_2d_bgk/sim.cpp | 34 ++--- examples/stdkr_2d_bgk/step.hpp | 28 ++-- examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp | 72 +++++----- examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp | 76 +++++----- examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp | 80 +++++------ examples/stokes_drag_particle_2d_psm_gpu/sim.cpp | 74 +++++----- examples/throat_clog_2d/common.hpp | 1 - examples/throat_clog_2d/init.hpp | 34 ++--- examples/throat_clog_2d/sim.cpp | 42 +++--- examples/throat_clog_2d/step.hpp | 94 ++++++------ 54 files changed, 1312 insertions(+), 1329 deletions(-) (limited to 'examples') diff --git a/examples/cavity_2d/cavity_2d.cpp b/examples/cavity_2d/cavity_2d.cpp index af22796..177bf05 100644 --- a/examples/cavity_2d/cavity_2d.cpp +++ b/examples/cavity_2d/cavity_2d.cpp @@ -9,7 +9,6 @@ namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; /** * Basic distribution function @@ -66,9 +65,9 @@ class df_cell_view, Encode> { public: using Schema = sch::Cell; private: - std::array::type>*, QN> view_; + std::array::type>*, QN> view_; public: - df_cell_view(const std::array::type>*, QN>& view): + df_cell_view(const std::array::type>*, QN>& view): view_{view} {} }; @@ -84,11 +83,11 @@ struct MovingWall {}; template class component { public: - std::array::type, Desc::D> lid_vel; + std::array::type, Desc::D> lid_vel; public: void apply( - saw::data>& dfs + kel::lbm::data>& dfs ){ using dfi = df_info; @@ -111,18 +110,18 @@ constexpr size_t dim_y = 128; template -void apply_for_cells(Func&& func, saw::data& dat){ +void apply_for_cells(Func&& func, kel::lbm::data& dat){ for(std::size_t i = 0; i < dat.meta().at({1u}).get(); ++i){ for(std::size_t j = 0; j < dat.meta().at({0u}).get(); ++j){ - saw::data di{i}; - saw::data dj{j}; + kel::lbm::data di{i}; + kel::lbm::data dj{j}; auto& cell_v = dat({{dj,di}}); func(cell_v, j, i); } } } -void set_geometry(saw::data& latt){ +void set_geometry(kel::lbm::data& latt){ using namespace kel::lbm; apply_for_cells([](auto& cell, std::size_t i, std::size_t j){ uint8_t val = 0; @@ -142,12 +141,12 @@ void set_geometry(saw::data& latt){ }, latt); } -void set_initial_conditions(saw::data& latt){ +void set_initial_conditions(kel::lbm::data& latt){ using namespace kel::lbm; - saw::data rho{1.0}; + kel::lbm::data rho{1.0}; { - saw::data> vel{{0.0,0.0}}; + kel::lbm::data> vel{{0.0,0.0}}; auto eq = equilibrium(rho, vel); apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){ @@ -164,7 +163,7 @@ void set_initial_conditions(saw::data& latt){ } { - saw::data> vel{{0.1,0.0}}; + kel::lbm::data> vel{{0.1,0.0}}; auto eq = equilibrium(rho, vel); apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){ @@ -184,7 +183,7 @@ void set_initial_conditions(saw::data& latt){ } void lbm_step( - saw::data& latt, + kel::lbm::data& latt, bool even_step, uint64_t time_step ){ @@ -203,8 +202,8 @@ void lbm_step( auto meta = latt.meta(); // Collide - for(saw::data i{0u}; i < meta.at(0u); ++i){ - for(saw::data j{0u}; j < meta.at(1u); ++j ){ + for(kel::lbm::data i{0u}; i < meta.at(0u); ++i){ + for(kel::lbm::data j{0u}; j < meta.at(1u); ++j ){ auto& cell = latt({{i,j}}); auto& info = cell.template get<"info">(); @@ -259,9 +258,9 @@ void lbm_step( int main(){ using namespace kel::lbm; - saw::data> dim{{dim_x, dim_y}}; + kel::lbm::data> dim{{dim_x, dim_y}}; - saw::data lattice{dim}; + kel::lbm::data lattice{dim}; converter conv{ {0.1}, @@ -309,19 +308,19 @@ int main(){ uint64_t print_every = 256u; uint64_t file_no = 0u; - saw::data,sch::D2Q9::D>> macros{dim}; + kel::lbm::data,sch::D2Q9::D>> macros{dim}; for(uint64_t step = 0; step < lattice_steps; ++step){ if(step % print_every == 0u){ std::cout<<"\n"; - typename saw::native_data_type::type sum = 0.0; + typename kel::lbm::native_data_type::type sum = 0.0; apply_for_cells([&](auto& cell, std::size_t i, std::size_t j){ auto& dfs = cell.template get<"dfs">(); - typename saw::native_data_type::type rho; - std::array::type, sch::D2Q9::D> vel; + typename kel::lbm::native_data_type::type rho; + std::array::type, sch::D2Q9::D> vel; compute_rho_u(dfs,rho,vel); if(i > 1 && (i+2) < dim_x && j > 1 && (j+2) < dim_y){ diff --git a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp index fe44baf..ab1ab40 100644 --- a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp +++ b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp @@ -12,7 +12,6 @@ namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; /** * Basic distribution function @@ -71,9 +70,9 @@ class df_cell_view, Encode> { public: using Schema = sch::Cell; private: - std::array::type>*, QN> view_; + std::array::type>*, QN> view_; public: - df_cell_view(const std::array::type>*, QN>& view): + df_cell_view(const std::array::type>*, QN>& view): view_{view} {} }; @@ -89,11 +88,11 @@ struct MovingWall {}; template class component { public: - std::array::type, Desc::D> lid_vel; + std::array::type, Desc::D> lid_vel; public: void apply( - saw::data>& dfs + kel::lbm::data>& dfs ){ using dfi = df_info; @@ -113,15 +112,15 @@ constexpr size_t dim_y = 128; template void set_geometry( - saw::data>* info_field + kel::lbm::data>* info_field ){ using namespace kel::lbm; using namespace acpp; - saw::data> meta{{dim_x,dim_y}}; + kel::lbm::data> meta{{dim_x,dim_y}}; /** * Set ghost */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get(); auto& info = info_field[i]; @@ -132,7 +131,7 @@ void set_geometry( /** * Set wall */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get(); auto& info = info_field[i]; @@ -143,7 +142,7 @@ void set_geometry( /** * Set fluid */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get(); auto& info = info_field[i]; @@ -154,7 +153,7 @@ void set_geometry( /** * Set top lid */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get(); auto& info = info_field[i]; info({0u}).set(3u); @@ -164,27 +163,27 @@ void set_geometry( template void set_initial_conditions( - saw::data>* info_field, - saw::data>* dfs_field, - saw::data>* dfs_old_field + kel::lbm::data>* info_field, + kel::lbm::data>* dfs_field, + kel::lbm::data>* dfs_old_field ){ using namespace kel::lbm; using namespace acpp; - saw::data rho{1.0}; - saw::data> vel{{0.0,0.0}}; + kel::lbm::data rho{1.0}; + kel::lbm::data> vel{{0.0,0.0}}; auto eq = equilibrium(rho, vel); - saw::data> meta{{dim_x,dim_y}}; + kel::lbm::data> meta{{dim_x,dim_y}}; /** * Set distribution */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ size_t i = index.at({0u}).get() * dim_x + index.at({1u}).get(); auto& dfs = dfs_field[i]; auto& dfs_old = dfs_old_field[i]; - for(saw::data k = 0; k < saw::data{Desc::Q}; ++k){ + for(kel::lbm::data k = 0; k < kel::lbm::data{Desc::Q}; ++k){ dfs(k) = eq.at(k); dfs_old(k) = eq.at(k); } @@ -194,9 +193,9 @@ void set_initial_conditions( template void lbm_step( - saw::data>* info_r, - saw::data>* dfs_r, - saw::data>* dfs_r_old, + kel::lbm::data>* info_r, + kel::lbm::data>* dfs_r, + kel::lbm::data>* dfs_r_old, bool is_even, uint64_t time_step, acpp::sycl::queue& sycl_q @@ -207,7 +206,7 @@ void lbm_step( using dfi = df_info; //component coll{0.59}; - constexpr saw::data frequency{1.0 / 0.59}; + constexpr kel::lbm::data frequency{1.0 / 0.59}; //component bb; component bb_lid; bb_lid.lid_vel = {0.1, 0.0}; @@ -243,8 +242,8 @@ void lbm_step( // coll.apply(latt_acc, {i, j}, time_step); auto& dfs_old = is_even ? dfs_r_old[acc_id] : dfs_r[acc_id]; - saw::data rho; - saw::data> vel; + kel::lbm::data rho; + kel::lbm::data> vel; compute_rho_u(dfs_old,rho,vel); auto eq = equilibrium(rho,vel); @@ -302,7 +301,7 @@ int main(){ using namespace kel::lbm; using namespace acpp; - saw::data> meta{{dim_x, dim_y}}; + kel::lbm::data> meta{{dim_x, dim_y}}; constexpr size_t dim_size = dim_x * dim_y; converter conv{ @@ -324,9 +323,9 @@ int main(){ constexpr size_t num_cells = dim_x * dim_y; // Allocate USM shared memory for your main data - auto* info = sycl::malloc_shared>>(num_cells, sycl_q); - auto* dfs = sycl::malloc_shared>>(num_cells, sycl_q); - auto* dfs_old = sycl::malloc_shared>>(num_cells, sycl_q); + auto* info = sycl::malloc_shared>>(num_cells, sycl_q); + auto* dfs = sycl::malloc_shared>>(num_cells, sycl_q); + auto* dfs_old = sycl::malloc_shared>>(num_cells, sycl_q); /** * Set meta information describing what this cell is @@ -347,7 +346,7 @@ int main(){ uint64_t print_every = 256u; uint64_t file_no = 0u; - saw::data,sch::D2Q9::D>> macros{meta}; + kel::lbm::data,sch::D2Q9::D>> macros{meta}; std::cout<<"Start"<(info, dfs, dfs_old, even_step, i, sycl_q); if(i % 1024u == 0u){ sycl_q.wait(); - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ size_t j = index.at({0u}).get() * dim_x + index.at({1u}).get(); auto dfs_field = even_step ? dfs_old : dfs; diff --git a/examples/cavity_3d.cpp b/examples/cavity_3d.cpp index 5ae4834..e62c017 100644 --- a/examples/cavity_3d.cpp +++ b/examples/cavity_3d.cpp @@ -14,7 +14,6 @@ namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; /** * Basic distribution function @@ -70,9 +69,9 @@ class df_cell_view, Encode> { public: using Schema = sch::Cell; private: - std::array::type>*, QN> view_; + std::array::type>*, QN> view_; public: - df_cell_view(const std::array::type>*, QN>& view): + df_cell_view(const std::array::type>*, QN>& view): view_{view} {} }; @@ -88,11 +87,11 @@ struct MovingWall {}; template class component { public: - std::array::type, Desc::D> lid_vel; + std::array::type, Desc::D> lid_vel; public: void apply( - saw::data>& dfs + kel::lbm::data>& dfs ){ using dfi = df_info; @@ -116,18 +115,18 @@ constexpr size_t dim_z = 128; template -void apply_for_cells(Func&& func, saw::data& dat){ +void apply_for_cells(Func&& func, kel::lbm::data& dat){ for(std::size_t i = 0; i < dat.meta().at({1u}).get(); ++i){ for(std::size_t j = 0; j < dat.meta().at({0u}).get(); ++j){ - saw::data di{i}; - saw::data dj{j}; + kel::lbm::data di{i}; + kel::lbm::data dj{j}; auto& cell_v = dat({{dj,di}}); func(cell_v, j, i); } } } -void set_geometry(saw::data& latt){ +void set_geometry(kel::lbm::data& latt){ using namespace kel::lbm; apply_for_cells([](auto& cell, std::size_t i, std::size_t j){ uint8_t val = 0; @@ -147,12 +146,12 @@ void set_geometry(saw::data& latt){ }, latt); } -void set_initial_conditions(saw::data& latt){ +void set_initial_conditions(kel::lbm::data& latt){ using namespace kel::lbm; - saw::data rho{1.0}; + kel::lbm::data rho{1.0}; { - saw::data> vel{{0.0,0.0}}; + kel::lbm::data> vel{{0.0,0.0}}; auto eq = equilibrium(rho, vel); apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){ @@ -169,7 +168,7 @@ void set_initial_conditions(saw::data& latt){ } { - saw::data> vel{{0.1,0.0}}; + kel::lbm::data> vel{{0.1,0.0}}; auto eq = equilibrium(rho, vel); apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){ @@ -189,7 +188,7 @@ void set_initial_conditions(saw::data& latt){ } void lbm_step( - saw::data& latt, + kel::lbm::data& latt, bool even_step, uint64_t time_step ){ @@ -208,8 +207,8 @@ void lbm_step( auto meta = latt.meta(); // Collide - for(saw::data i{0u}; i < meta.at(0u); ++i){ - for(saw::data j{0u}; j < meta.at(1u); ++j ){ + for(kel::lbm::data i{0u}; i < meta.at(0u); ++i){ + for(kel::lbm::data j{0u}; j < meta.at(1u); ++j ){ auto& cell = latt({{i,j}}); auto& info = cell.template get<"info">(); @@ -264,9 +263,9 @@ void lbm_step( int main(){ using namespace kel::lbm; - saw::data> dim{{dim_x, dim_y}}; + kel::lbm::data> dim{{dim_x, dim_y}}; - saw::data lattice{dim}; + kel::lbm::data lattice{dim}; converter conv{ {0.1}, @@ -314,19 +313,19 @@ int main(){ uint64_t print_every = 256u; uint64_t file_no = 0u; - saw::data,sch::D3Q27::D>> macros{dim}; + kel::lbm::data,sch::D3Q27::D>> macros{dim}; for(uint64_t step = 0; step < lattice_steps; ++step){ if(step % print_every == 0u){ std::cout<<"\n"; - typename saw::native_data_type::type sum = 0.0; + typename kel::lbm::native_data_type::type sum = 0.0; apply_for_cells([&](auto& cell, std::size_t i, std::size_t j){ auto& dfs = cell.template get<"dfs">(); - typename saw::native_data_type::type rho; - std::array::type, sch::D3Q27::D> vel; + typename kel::lbm::native_data_type::type rho; + std::array::type, sch::D3Q27::D> vel; compute_rho_u(dfs,rho,vel); if(i > 1 && (i+2) < dim_x && j > 1 && (j+2) < dim_y){ diff --git a/examples/dkt/common.hpp b/examples/dkt/common.hpp index be9a538..6c1dc44 100644 --- a/examples/dkt/common.hpp +++ b/examples/dkt/common.hpp @@ -27,7 +27,6 @@ constexpr uint64_t dim_x = static_cast(dim_y * (220.0 / 41.0)); constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; diff --git a/examples/dkt/init.hpp b/examples/dkt/init.hpp index af7eb89..c52078c 100644 --- a/examples/dkt/init.hpp +++ b/examples/dkt/init.hpp @@ -6,11 +6,11 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ (void) conv; @@ -94,10 +94,10 @@ saw::error_or init( ); { - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get()); std::cout<<"RADIUS: "<> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); particles = create_spheroid_particle_group(radius_p, dense_p, {{64u}}); auto& parts = particles.template get<"particles">(); @@ -114,7 +114,7 @@ saw::error_or init( } } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/dkt/sim.cpp b/examples/dkt/sim.cpp index b3422a5..44fd145 100644 --- a/examples/dkt/sim.cpp +++ b/examples/dkt/sim.cpp @@ -8,7 +8,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< Member @@ -21,7 +20,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -40,7 +39,7 @@ saw::error_or lbm_main(const saw::data& args){ 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"); } } @@ -53,16 +52,17 @@ saw::error_or lbm_main(const saw::data& args){ print_lbm_meta(conv,{1e-3},{1e-4},{0.5 * 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>>(); + // 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>>(); 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}; @@ -94,9 +94,9 @@ saw::error_or lbm_main(const saw::data& args){ } } - 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}; sycl_q.wait(); { @@ -122,11 +122,11 @@ saw::error_or lbm_main(const saw::data& args){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); - saw::data time_steps{64u*1024ul}; + kel::lbm::data time_steps{64u*1024ul}; 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(conv,lsd_view,lsdm_view,lsdp_view,i,dev); @@ -152,10 +152,10 @@ saw::error_or lbm_main(const saw::data& args){ } // 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]); } @@ -191,16 +191,16 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); if(eov.is_error()){ @@ -218,7 +218,7 @@ saw::error_or k_main(int argc, char** argv){ return lbm_main(args); } - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/dkt/step.hpp b/examples/dkt/step.hpp index cbdfd10..879def8 100644 --- a/examples/dkt/step.hpp +++ b/examples/dkt/step.hpp @@ -6,15 +6,15 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, + 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 ){ - static constexpr saw::data sub_steps{0u}; + static constexpr kel::lbm::data sub_steps{0u}; auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); @@ -24,9 +24,9 @@ saw::error_or step( if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_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]); } @@ -35,10 +35,10 @@ saw::error_or step( }); }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_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]); } @@ -48,12 +48,12 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> collision{1.0}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> collision{1.0}; + component> bb; + 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]); } @@ -71,12 +71,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -97,9 +97,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ 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]); } @@ -109,10 +109,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]); } @@ -123,13 +123,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{1.0}; - component> collision{1.0}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{1.0}; + component> collision{1.0}; + component> bb; + 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]); } @@ -147,12 +147,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -173,9 +173,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ 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]); } @@ -185,10 +185,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]); } @@ -199,13 +199,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{1.0}; - component> collision{1.0}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{1.0}; + component> collision{1.0}; + component> bb; + 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]); } @@ -223,12 +223,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -250,7 +250,7 @@ saw::error_or step( } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/feature_development/common.hpp b/examples/feature_development/common.hpp index b321344..6806b2c 100644 --- a/examples/feature_development/common.hpp +++ b/examples/feature_development/common.hpp @@ -19,7 +19,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; diff --git a/examples/feature_development/init.hpp b/examples/feature_development/init.hpp index b7fdeb0..a61ef37 100644 --- a/examples/feature_development/init.hpp +++ b/examples/feature_development/init.hpp @@ -6,11 +6,11 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ (void) conv; @@ -95,7 +95,7 @@ saw::error_or init( iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -103,7 +103,7 @@ saw::error_or init( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ porous_f.at(index).at({}) = 0.0; } @@ -113,14 +113,14 @@ saw::error_or init( ); { - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(2); - saw::data> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); particles = create_spheroid_particle_group(radius_p, dense_p, {{16u}}); } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/feature_development/sim.cpp b/examples/feature_development/sim.cpp index f5b49e9..e852313 100644 --- a/examples/feature_development/sim.cpp +++ b/examples/feature_development/sim.cpp @@ -8,7 +8,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< Member, @@ -22,7 +21,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -41,7 +40,7 @@ saw::error_or lbm_main(const saw::data& args){ 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"); } } @@ -54,16 +53,17 @@ saw::error_or lbm_main(const saw::data& args){ 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_particle_data_ptr = saw::heap>>(); + // 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>>(); 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}; @@ -95,9 +95,9 @@ saw::error_or lbm_main(const saw::data& args){ } } - 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}; sycl_q.wait(); { @@ -117,11 +117,11 @@ saw::error_or lbm_main(const saw::data& args){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); - saw::data time_steps{64u*1024ul}; + kel::lbm::data time_steps{64u*1024ul}; 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(conv,lsd_view,lsdm_view,lsdp_view,i,dev); @@ -147,10 +147,10 @@ saw::error_or lbm_main(const saw::data& args){ } // 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]); } @@ -186,16 +186,16 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); return eov; @@ -209,7 +209,7 @@ saw::error_or k_main(int argc, char** argv){ // return kmain(args); } - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/feature_development/step.hpp b/examples/feature_development/step.hpp index 37eb4e7..ade14ca 100644 --- a/examples/feature_development/step.hpp +++ b/examples/feature_development/step.hpp @@ -6,12 +6,12 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, + 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(); @@ -19,9 +19,9 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_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]); } @@ -31,10 +31,10 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_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]); } @@ -45,10 +45,10 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> collision{0.8}; - component> bb; + component> collision{0.8}; + component> bb; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 16u; if(t_i.get() < target_t_i){ @@ -57,10 +57,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]); } @@ -90,7 +90,7 @@ saw::error_or step( }); }).wait(); - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/heterogeneous_computing/sim.cpp b/examples/heterogeneous_computing/sim.cpp index d074ad8..61058be 100644 --- a/examples/heterogeneous_computing/sim.cpp +++ b/examples/heterogeneous_computing/sim.cpp @@ -6,7 +6,6 @@ namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; /** * struct lbm_data { @@ -44,9 +43,9 @@ using namespace saw::schema; * * template<...> * class data,encode::Sycl> final { - * saw::data> meta; - * saw::data>* dfs; - * saw::data* info; + * kel::lbm::data> meta; + * kel::lbm::data>* dfs; + * kel::lbm::data* info; * }; */ @@ -59,19 +58,19 @@ using CellStruct = Struct< } template -saw::error_or simulate(int argc, char** argv, - const saw::data>& meta +kel::lbm::error_or simulate(int argc, char** argv, + const kel::lbm::data>& meta { - constexpr auto cell_size = sizeof(saw::data>); + constexpr auto cell_size = sizeof(kel::lbm::data>); - auto lbm_data = saw::heap,Desc::D, 64u>>>{meta}; + auto lbm_data = kel::lbm::heap,Desc::D, 64u>>>{meta}; - return saw::make_void(); + return kel::lbm::make_void(); } } -saw::error_or lbm_main(int argc, char** argv){ +kel::lbm::error_or lbm_main(int argc, char** argv){ using namespace lbm; return simulate(argc, argv); } diff --git a/examples/meta/meta.cpp b/examples/meta/meta.cpp index 7232c61..2e2f28c 100644 --- a/examples/meta/meta.cpp +++ b/examples/meta/meta.cpp @@ -7,7 +7,6 @@ namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; using MetaArgsStruct = Struct< Member, @@ -28,7 +27,7 @@ using Prec = Float64; } template -saw::error_or meta_lbm_info(const saw::data& args_str){ +kel::lbm::error_or meta_lbm_info(const kel::lbm::data& args_str){ using namespace kel::lbm; converter conv{ {args_str.template get<"dx">()}, @@ -36,11 +35,11 @@ saw::error_or meta_lbm_info(const saw::data }; print_lbm_meta(conv, {args_str.template get<"kin_vis">()},{args_str.template get<"char_vel">()},{args_str.template get<"char_len">()}); - return saw::make_void(); + return kel::lbm::make_void(); } -saw::error_or meta_main(int argc, char** argv){ +kel::lbm::error_or meta_main(int argc, char** argv){ using namespace kel::lbm; std::string_view cfg_file_name = "config.json"; @@ -48,15 +47,15 @@ saw::error_or meta_main(int argc, char** argv){ cfg_file_name = argv[1]; } - saw::data args_dat; + kel::lbm::data args_dat; auto& args_str = args_dat.template get<"args">(); { { args_str.template get<"dx">().set(1); args_str.template get<"dt">().set(1); } - saw::data args_enc{argc,argv}; - saw::codec args_codec; + kel::lbm::data args_enc{argc,argv}; + kel::lbm::codec args_codec; auto eov = args_codec.decode(args_enc,args_dat); if(eov.is_error()){ @@ -75,7 +74,7 @@ saw::error_or meta_main(int argc, char** argv){ meta_lbm_info>(args_str); break; default: - return saw::make_error("Second positional needs to be a valid momentum set"); + return kel::lbm::make_error("Second positional needs to be a valid momentum set"); } } break; @@ -89,7 +88,7 @@ saw::error_or meta_main(int argc, char** argv){ meta_lbm_info>(args_str); break; default: - return saw::make_error("Second positional needs to be a valid momentum set"); + return kel::lbm::make_error("Second positional needs to be a valid momentum set"); } } break; @@ -97,26 +96,26 @@ saw::error_or meta_main(int argc, char** argv){ { switch(args_pos.get<1u>().get()){ case 7u: - return saw::make_error("D3Q7 Velocity Set is not implemented"); + return kel::lbm::make_error("D3Q7 Velocity Set is not implemented"); // meta_lbm_info>(args_str); break; case 19u: - return saw::make_error("D3Q17 Velocity Set is not implemented"); + return kel::lbm::make_error("D3Q17 Velocity Set is not implemented"); // meta_lbm_info>(args_str); break; case 27u: meta_lbm_info>(args_str); break; default: - return saw::make_error("Second positional needs to be a valid momentum set"); + return kel::lbm::make_error("Second positional needs to be a valid momentum set"); } } break; default: - return saw::make_error("First positional needs to be Dimension 1,2 or 3"); + return kel::lbm::make_error("First positional needs to be Dimension 1,2 or 3"); } - return saw::make_void(); + return kel::lbm::make_void(); } int main(int argc, char** argv){ 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; diff --git a/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp b/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp index bd754bf..86f0ded 100644 --- a/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp +++ b/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -61,10 +60,10 @@ using ParticleSpheroidGroup = ParticleGroup>; } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros, - saw::data>& particles +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -145,9 +144,9 @@ saw::error_or setup_initial_conditions( {{1u,1u}} ); - 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,{16u}); { @@ -156,7 +155,7 @@ saw::error_or setup_initial_conditions( 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; @@ -165,15 +164,15 @@ saw::error_or setup_initial_conditions( 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(); @@ -181,9 +180,9 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_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]); } @@ -193,10 +192,10 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_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]); } @@ -207,10 +206,10 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> collision{0.8}; - component> bb; + 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){ @@ -219,11 +218,11 @@ 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]); } @@ -261,13 +260,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; @@ -284,7 +283,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"); } } @@ -297,17 +296,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}; @@ -339,9 +339,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(); { @@ -367,10 +367,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{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); @@ -406,10 +406,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]); } @@ -451,7 +451,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; diff --git a/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp b/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp index 2daa452..947407e 100644 --- a/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp +++ b/examples/moving_poiseulle_particles_2d_psm_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -62,10 +61,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 @@ -137,9 +136,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}); { @@ -148,7 +147,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; @@ -157,15 +156,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(); @@ -173,9 +172,9 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component> psm_reset; + component> psm_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]); } @@ -185,10 +184,10 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> psm_one_part; + component> psm_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]); } @@ -199,11 +198,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){ @@ -212,10 +211,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]); } @@ -245,13 +244,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; @@ -268,7 +267,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"); } } @@ -281,17 +280,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}; @@ -323,9 +323,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(); { @@ -351,10 +351,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); @@ -390,10 +390,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]); } @@ -437,7 +437,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; diff --git a/examples/one_particle_sedimentation_2d/common.hpp b/examples/one_particle_sedimentation_2d/common.hpp index ffb7f40..e28622f 100644 --- a/examples/one_particle_sedimentation_2d/common.hpp +++ b/examples/one_particle_sedimentation_2d/common.hpp @@ -29,7 +29,6 @@ constexpr uint64_t dim_y = 800ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; diff --git a/examples/one_particle_sedimentation_2d/init.hpp b/examples/one_particle_sedimentation_2d/init.hpp index 8bcc236..989ec4f 100644 --- a/examples/one_particle_sedimentation_2d/init.hpp +++ b/examples/one_particle_sedimentation_2d/init.hpp @@ -6,11 +6,11 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -74,10 +74,10 @@ saw::error_or init( ); { - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(conv.meter_si_to_lbm({{0.00125}}).handle().get()); std::cout<<"RADIUS: "<> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); particles = create_spheroid_particle_group(radius_p, dense_p, {{64u}}); auto& parts = particles.template get<"particles">(); @@ -94,7 +94,7 @@ saw::error_or init( } } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index 2daa0b5..7c8456f 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -8,7 +8,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< Member @@ -21,7 +20,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -40,7 +39,7 @@ saw::error_or lbm_main(const saw::data& args){ 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"); } } @@ -50,23 +49,24 @@ saw::error_or lbm_main(const saw::data& args){ // delta_t {{3e-7}} }; - saw::data> kin_vis_si{1e-3}; + kel::lbm::data> kin_vis_si{1e-3}; auto kin_vis_lbm = conv.kinematic_viscosity_si_to_lbm(kin_vis_si); auto tau = conv.template kinematic_viscosity_lbm_to_tau(kin_vis_lbm); print_lbm_meta(conv,kin_vis_si,{1e-4},{2}); std::cout<<"Position: "<> 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>>(); + // 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>>(); 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}; @@ -98,9 +98,9 @@ saw::error_or lbm_main(const saw::data& args){ } } - 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}; sycl_q.wait(); { @@ -134,7 +134,7 @@ saw::error_or lbm_main(const saw::data& args){ } std::cout<<"Steps for 1 sec: "< i{0u},j{0u}; j.get() < 11u and krun; ++i){ + for(kel::lbm::data i{0u},j{0u}; j.get() < 11u and krun; ++i){ // BC + Collision { @@ -170,10 +170,10 @@ saw::error_or lbm_main(const saw::data& args){ } // 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]); } @@ -209,16 +209,16 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); if(eov.is_error()){ @@ -237,7 +237,7 @@ saw::error_or k_main(int argc, char** argv){ return lbm_main(args); } - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/one_particle_sedimentation_2d/step.hpp b/examples/one_particle_sedimentation_2d/step.hpp index 4bc9dde..de42dec 100644 --- a/examples/one_particle_sedimentation_2d/step.hpp +++ b/examples/one_particle_sedimentation_2d/step.hpp @@ -6,16 +6,16 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - const saw::data>& tau, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, + const kel::lbm::data>& tau, + 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 ){ - static constexpr saw::data sub_steps{0u}; + static constexpr kel::lbm::data sub_steps{0u}; auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); @@ -24,9 +24,9 @@ saw::error_or step( if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_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]); } @@ -35,10 +35,10 @@ saw::error_or step( }); }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_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]); } @@ -48,11 +48,11 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> collision{tau}; - component> bb; + component> collision{tau}; + 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]); } @@ -75,9 +75,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ 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]); } @@ -90,12 +90,12 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - saw::data> gf; + kel::lbm::data> gf; gf.at({{1u}}) = conv.acceleration_si_to_lbm({-9.81}).handle(); - component> fplbm_one_part{gf}; + component> fplbm_one_part{gf}; 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]); } @@ -106,13 +106,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{tau}; - component> collision{tau}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{tau}; + component> collision{tau}; + component> bb; + 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]); } @@ -130,12 +130,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -156,9 +156,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ 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]); } @@ -168,10 +168,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]); } @@ -182,13 +182,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{1.0}; - component> collision{tau}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{1.0}; + component> collision{tau}; + component> bb; + 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]); } @@ -206,12 +206,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -233,7 +233,7 @@ saw::error_or step( } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/particles_gpu/particles_gpu.cpp b/examples/particles_gpu/particles_gpu.cpp index abbc192..f3edbf2 100644 --- a/examples/particles_gpu/particles_gpu.cpp +++ b/examples/particles_gpu/particles_gpu.cpp @@ -8,21 +8,20 @@ namespace kel{ namespace lbm { namespace sch { -using namespace saw::schema; } } -saw::error_or lbm_main(int argc, char** argv){ +kel::lbm::error_or lbm_main(int argc, char** argv){ (void) argc; (void) argv; using namespace lbm; using namespace acpp; - saw::data>> particles{1024u}; + kel::lbm::data>> particles{1024u}; - for(saw::data i{0u}; i < saw::data{32u}; ++i){ - for(saw::data j{0u}; j < saw::data{32u}; ++j){ + for(kel::lbm::data i{0u}; i < kel::lbm::data{32u}; ++i){ + for(kel::lbm::data j{0u}; j < kel::lbm::data{32u}; ++j){ auto& part = particles.at(i*32ul+j); auto& body = part.template get<"rigid_body">(); @@ -42,12 +41,12 @@ saw::error_or lbm_main(int argc, char** argv){ } } - saw::data> time_step; + kel::lbm::data> time_step; time_step.at({}).set(0.05f); - for(saw::data dt{0u}; dt < saw::data{32ul}; ++dt){ + for(kel::lbm::data dt{0u}; dt < kel::lbm::data{32ul}; ++dt){ // Do Verlet Step - for(saw::data i{0u}; i < particles.size(); ++i){ + for(kel::lbm::data i{0u}; i < particles.size(); ++i){ auto& part_i = particles.at(i); verlet_step_lambda(part_i,time_step); @@ -59,7 +58,7 @@ saw::error_or lbm_main(int argc, char** argv){ } // - for(saw::data i{0u}; i < particles.size(); ++i){ + for(kel::lbm::data i{0u}; i < particles.size(); ++i){ auto& part_i = particles.at(i); auto& body_i = part_i.template get<"rigid_body">(); auto& pos_i = body_i.template get<"position">(); @@ -67,7 +66,7 @@ saw::error_or lbm_main(int argc, char** argv){ /** * Test against other particles */ - for(saw::data j{i+1ul}; j < particles.size(); ++j){ + for(kel::lbm::data j{i+1ul}; j < particles.size(); ++j){ auto& part_j = particles.at(j); auto& body_j = part_j.template get<"rigid_body">(); auto& pos_j = body_j.template get<"position">(); @@ -84,12 +83,12 @@ saw::error_or lbm_main(int argc, char** argv){ auto vel_rel = vel_i - vel_j; auto pos_rel = pos_i - pos_j; - auto vel_pos_rel_dot = saw::math::dot(vel_rel,pos_rel); + auto vel_pos_rel_dot = kel::lbm::math::dot(vel_rel,pos_rel); if(vel_pos_rel_dot.at({}).get() < 0.0){ - auto pos_rel_normed = pos_rel / saw::math::sqrt(res.second); + auto pos_rel_normed = pos_rel / kel::lbm::math::sqrt(res.second); } - // auto vel_ij = saw::math::dot(vel_i,vel_j); + // auto vel_ij = kel::lbm::math::dot(vel_i,vel_j); } } @@ -112,7 +111,7 @@ saw::error_or lbm_main(int argc, char** argv){ std::cout< struct component> { private: - saw::data pressure_setting_; - saw::data rho_setting_; + kel::lbm::data pressure_setting_; + kel::lbm::data rho_setting_; public: - component(const saw::data& pressure_setting__): + component(const kel::lbm::data& pressure_setting__): pressure_setting_{pressure_setting__}, rho_setting_{pressure_setting__ * df_info::inv_cs2} {} template - void apply(saw::data& field, saw::data> index, uint64_t time_step){ + void apply(kel::lbm::data& field, kel::lbm::data> index, uint64_t time_step){ using dfi = df_info; bool is_even = ((time_step % 2) == 0); @@ -98,8 +97,8 @@ public: /** * Sum all known DFs */ - saw::data sum_df{0}; - for(saw::data k{0u}; k < saw::data{Descriptor::Q}; ++k){ + kel::lbm::data sum_df{0}; + for(kel::lbm::data k{0u}; k < kel::lbm::data{Descriptor::Q}; ++k){ auto c_k = dfi::directions[k.get()]; auto& cell_n = field({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}}); auto& info_n = cell_n.template get<"info">(); @@ -114,9 +113,9 @@ public: * Get the sum of the unknown dfs and precalculate the direction */ constexpr int known_dir = East ? 1 : -1; - auto sum_unknown_dfs = (rho_setting_ - sum_df) * saw::data{known_dir}; + auto sum_unknown_dfs = (rho_setting_ - sum_df) * kel::lbm::data{known_dir}; - for(saw::data k{0u}; k < saw::data{Descriptor::Q}; ++k){ + for(kel::lbm::data k{0u}; k < kel::lbm::data{Descriptor::Q}; ++k){ auto c_k = dfi::directions[k.get()]; auto& cell_n = field({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}}); auto& info_n = cell_n.template get<"info">(); @@ -131,20 +130,20 @@ public: auto vel_x = sum_unknown_dfs / rho_setting_; if constexpr (East) { - dfs_old({2u}) = dfs_old({1u}) + saw::data{2.0 / 3.0} * rho_setting_ * vel_x; - dfs_old({6u}) = dfs_old({5u}) + saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); - dfs_old({8u}) = dfs_old({7u}) + saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); + dfs_old({2u}) = dfs_old({1u}) + kel::lbm::data{2.0 / 3.0} * rho_setting_ * vel_x; + dfs_old({6u}) = dfs_old({5u}) + kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); + dfs_old({8u}) = dfs_old({7u}) + kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); }else if constexpr (not East){ - dfs_old({1u}) = dfs_old({2u}) - saw::data{2.0 / 3.0} * rho_setting_ * vel_x; - dfs_old({5u}) = dfs_old({6u}) - saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); - dfs_old({7u}) = dfs_old({8u}) - saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); + dfs_old({1u}) = dfs_old({2u}) - kel::lbm::data{2.0 / 3.0} * rho_setting_ * vel_x; + dfs_old({5u}) = dfs_old({6u}) - kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); + dfs_old({7u}) = dfs_old({8u}) - kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); } } }; } } -void set_geometry(saw::data& latt){ +void set_geometry(kel::lbm::data& latt){ using namespace kel::lbm; auto meta = latt.meta(); @@ -152,7 +151,7 @@ void set_geometry(saw::data& latt){ /** * Set ghost */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -163,7 +162,7 @@ void set_geometry(saw::data& latt){ /** * Set wall */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -174,7 +173,7 @@ void set_geometry(saw::data& latt){ /** * Set fluid */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -185,7 +184,7 @@ void set_geometry(saw::data& latt){ /** * Set inflow */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -196,7 +195,7 @@ void set_geometry(saw::data& latt){ /** * Set outflow */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -205,11 +204,11 @@ void set_geometry(saw::data& latt){ }, {{meta.at({0u})-2u,0u}}, {{meta.at({0u})-1u, meta.at({1u})}}, {{0u,2u}}); } -void set_initial_conditions(saw::data& latt){ +void set_initial_conditions(kel::lbm::data& latt){ using namespace kel::lbm; - saw::data rho{1.0}; - saw::data> vel{{0.0,0.0}}; + kel::lbm::data rho{1.0}; + kel::lbm::data> vel{{0.0,0.0}}; auto eq = equilibrium(rho, vel); auto meta = latt.meta(); @@ -217,12 +216,12 @@ void set_initial_conditions(saw::data& latt){ /** * Set distribution */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& dfs = cell.template get<"dfs">(); auto& dfs_old = cell.template get<"dfs_old">(); - for(saw::data k = 0; k < saw::data{sch::D2Q9::Q}; ++k){ + for(kel::lbm::data k = 0; k < kel::lbm::data{sch::D2Q9::Q}; ++k){ dfs(k) = eq.at(k); dfs_old(k) = eq.at(k); } @@ -231,7 +230,7 @@ void set_initial_conditions(saw::data& latt){ } void lbm_step( - saw::data& latt, + kel::lbm::data& latt, uint64_t time_step ){ using namespace kel::lbm; @@ -251,7 +250,7 @@ void lbm_step( /** * Collision */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -279,7 +278,7 @@ void lbm_step( }, {{0u,0u}}, meta); // Stream - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& df_new = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">(); auto& info_new = cell.template get<"info">(); @@ -334,8 +333,8 @@ int main(int argc, char** argv){ print_lbm_meta>(conv, {conf.template get<"kinematic_viscosity">()}); - saw::data> dim{{1024u, 128u}}; - saw::data lattice{dim}; + kel::lbm::data> dim{{1024u, 128u}}; + kel::lbm::data lattice{dim}; auto meta = lattice.meta(); /** @@ -345,9 +344,9 @@ int main(int argc, char** argv){ { - saw::data, sch::D2Q9::D>> geo{dim}; + kel::lbm::data, sch::D2Q9::D>> geo{dim}; - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = lattice(index); auto& info = cell.template get<"info">(); @@ -363,21 +362,21 @@ int main(int argc, char** argv){ */ set_initial_conditions(lattice); - saw::data,sch::D2Q9::D>> macros{dim}; + kel::lbm::data,sch::D2Q9::D>> macros{dim}; for(uint64_t i = 0u; i < 4096u*16u; ++i){ bool even_step = ((i % 2u) == 0u); { // Stream - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = lattice(index); auto& dfs = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">(); auto& rho = macros.at(index).template get<"pressure">(); auto& vel = macros.at(index).template get<"momentum">(); compute_rho_u(dfs,rho,vel); - rho = rho * saw::data{dfi::cs2}; + rho = rho * kel::lbm::data{dfi::cs2}; }, {{0u,0u}}, meta); std::string vtk_f_name{"poiseulle_2d_"}; diff --git a/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp b/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp index 9963c59..bece18f 100644 --- a/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp +++ b/examples/poiseulle_2d_gpu/poiseulle_2d_gpu.cpp @@ -4,12 +4,11 @@ #include template -using SyclHostAlloc = acpp::sycl::usm_allocator, acpp::sycl::usm::alloc::host>; +using SyclHostAlloc = acpp::sycl::usm_allocator, acpp::sycl::usm::alloc::host>; namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; /** * Basic distribution function @@ -50,19 +49,19 @@ struct PressureBoundaryRestrictedVelocityTo {}; template struct component> { private: - saw::data pressure_setting_; - saw::data rho_setting_; + kel::lbm::data pressure_setting_; + kel::lbm::data rho_setting_; public: - component(const saw::data& pressure_setting__): + component(const kel::lbm::data& pressure_setting__): pressure_setting_{pressure_setting__}, rho_setting_{pressure_setting__ * df_info::inv_cs2} {} template void apply( - saw::data* field, - saw::data> index, - const saw::data>& meta, + kel::lbm::data* field, + kel::lbm::data> index, + const kel::lbm::data>& meta, uint64_t time_step ) const { @@ -82,8 +81,8 @@ public: /** * Sum all known DFs */ - saw::data sum_df{0u}; - for(saw::data k{0u}; k < saw::data{Desc::Q}; ++k){ + kel::lbm::data sum_df{0u}; + for(kel::lbm::data k{0u}; k < kel::lbm::data{Desc::Q}; ++k){ auto c_k = dfi::directions[k.get()]; auto flat_ind_n = flatten_index::apply({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}},meta); auto& cell_n = field[flat_ind_n.get()]; @@ -99,9 +98,9 @@ public: * Get the sum of the unknown dfs and precalculate the direction */ constexpr int known_dir = East ? 1 : -1; - auto sum_unknown_dfs = (rho_setting_ - sum_df) * saw::data{known_dir}; + auto sum_unknown_dfs = (rho_setting_ - sum_df) * kel::lbm::data{known_dir}; - for(saw::data k{0u}; k < saw::data{Desc::Q}; ++k){ + for(kel::lbm::data k{0u}; k < kel::lbm::data{Desc::Q}; ++k){ auto c_k = dfi::directions[k.get()]; auto flat_ind_n = flatten_index::apply({{index.at({0u})+c_k[0u], index.at({1u})+c_k[1u]}},meta); auto& cell_n = field[flat_ind_n.get()]; @@ -116,13 +115,13 @@ public: auto vel_x = sum_unknown_dfs / rho_setting_; if constexpr (East) { - dfs_old({2u}) = dfs_old({1u}) + saw::data{2.0 / 3.0} * rho_setting_ * vel_x; - dfs_old({6u}) = dfs_old({5u}) + saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); - dfs_old({8u}) = dfs_old({7u}) + saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); + dfs_old({2u}) = dfs_old({1u}) + kel::lbm::data{2.0 / 3.0} * rho_setting_ * vel_x; + dfs_old({6u}) = dfs_old({5u}) + kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); + dfs_old({8u}) = dfs_old({7u}) + kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); }else if constexpr (not East){ - dfs_old({1u}) = dfs_old({2u}) - saw::data{2.0 / 3.0} * rho_setting_ * vel_x; - dfs_old({5u}) = dfs_old({6u}) - saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); - dfs_old({7u}) = dfs_old({8u}) - saw::data{1.0 / 6.0} * rho_setting_ * vel_x + saw::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); + dfs_old({1u}) = dfs_old({2u}) - kel::lbm::data{2.0 / 3.0} * rho_setting_ * vel_x; + dfs_old({5u}) = dfs_old({6u}) - kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({3u}) - dfs_old({4u})); + dfs_old({7u}) = dfs_old({8u}) - kel::lbm::data{1.0 / 6.0} * rho_setting_ * vel_x + kel::lbm::data{0.5} * (dfs_old({4u}) - dfs_old({3u})); } } }; @@ -141,15 +140,15 @@ public: */ template -saw::error_or set_geometry( - saw::data* cells, - const saw::data>& meta, +kel::lbm::error_or set_geometry( + kel::lbm::data* cells, + const kel::lbm::data>& meta, acpp::sycl::queue& sycl_q ){ using namespace kel::lbm; - saw::data rho{1.0}; - saw::data> vel{{0.0,0.0}}; + kel::lbm::data rho{1.0}; + kel::lbm::data> vel{{0.0,0.0}}; auto eq = equilibrium(rho, vel); sycl_q.submit([&](acpp::sycl::handler& h){ @@ -178,28 +177,28 @@ saw::error_or set_geometry( }else { info.set({0u}); } - for(saw::data k{0u}; k < saw::data{Desc::Q}; ++k){ + for(kel::lbm::data k{0u}; k < kel::lbm::data{Desc::Q}; ++k){ dfs(k) = eq.at(k); dfs_old(k) = eq.at(k); } }); }).wait(); - return saw::make_void(); + return kel::lbm::make_void(); } template void step( - saw::data* cells, - saw::data* macro_cells, - const saw::data>& meta, + kel::lbm::data* cells, + kel::lbm::data* macro_cells, + const kel::lbm::data>& meta, uint64_t time_step, acpp::sycl::queue& sycl_q ){ using namespace kel::lbm; using dfi = df_info; - constexpr saw::data frequency{1.0 / 0.6}; + constexpr kel::lbm::data frequency{1.0 / 0.6}; bool is_even = ((time_step % 2u) == 0u); /** @@ -244,8 +243,8 @@ void step( auto& macro_c = macro_cells[acc_id]; - saw::data& rho = macro_c.template get<"pressure">(); - saw::data>& vel = macro_c.template get<"momentum">(); + kel::lbm::data& rho = macro_c.template get<"pressure">(); + kel::lbm::data>& vel = macro_c.template get<"momentum">(); compute_rho_u(dfs_old,rho,vel); auto eq = equilibrium(rho,vel); @@ -261,8 +260,8 @@ void step( auto& macro_c = macro_cells[acc_id]; - saw::data& rho = macro_c.template get<"pressure">(); - saw::data>& vel = macro_c.template get<"momentum">(); + kel::lbm::data& rho = macro_c.template get<"pressure">(); + kel::lbm::data>& vel = macro_c.template get<"momentum">(); compute_rho_u(dfs_old,rho,vel); auto eq = equilibrium(rho,vel); @@ -278,8 +277,8 @@ void step( auto& macro_c = macro_cells[acc_id]; - saw::data& rho = macro_c.template get<"pressure">(); - saw::data>& vel = macro_c.template get<"momentum">(); + kel::lbm::data& rho = macro_c.template get<"pressure">(); + kel::lbm::data>& vel = macro_c.template get<"momentum">(); compute_rho_u(dfs_old,rho,vel); auto eq = equilibrium(rho,vel); @@ -327,7 +326,7 @@ void step( } template -saw::error_or kel_main(int argc, char** argv){ +kel::lbm::error_or kel_main(int argc, char** argv){ using namespace kel; using dfi = lbm::df_info; @@ -350,16 +349,16 @@ saw::error_or kel_main(int argc, char** argv){ uint64_t x_d = 1024u; uint64_t y_d = 512u; - saw::data> meta{{x_d,y_d}}; + kel::lbm::data> meta{{x_d,y_d}}; acpp::sycl::queue sycl_q; SyclHostAlloc sycl_host_alloc{sycl_q}; // SyclDeviceAlloc sycl_dev_alloc{sycl_q}; - std::vector, SyclHostAlloc> host_cells{x_d * y_d,sycl_host_alloc}; + std::vector, SyclHostAlloc> host_cells{x_d * y_d,sycl_host_alloc}; - saw::data* cells = acpp::sycl::malloc_device>(x_d * y_d,sycl_q); - saw::data* macro_cells = acpp::sycl::malloc_device>(x_d * y_d,sycl_q); + kel::lbm::data* cells = acpp::sycl::malloc_device>(x_d * y_d,sycl_q); + kel::lbm::data* macro_cells = acpp::sycl::malloc_device>(x_d * y_d,sycl_q); { auto eov = lbm::set_geometry(cells,meta,sycl_q); if(eov.is_error()){ @@ -376,7 +375,7 @@ saw::error_or kel_main(int argc, char** argv){ std::string vtk_f_name{"tmp/poiseulle_2d_gpu_"}; vtk_f_name += std::to_string(i) + ".vtk"; // write_vtk_file(vtk_f_name,host_cells); - sycl_q.memcpy(&host_cells[0u], macro_cells, x_d * y_d * sizeof(saw::data) ).wait(); + sycl_q.memcpy(&host_cells[0u], macro_cells, x_d * y_d * sizeof(kel::lbm::data) ).wait(); lbm::write_vtk_file(vtk_f_name, &host_cells[0], meta); } } @@ -386,7 +385,7 @@ saw::error_or kel_main(int argc, char** argv){ acpp::sycl::free(macro_cells, sycl_q); sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } int main(int argc, char** argv){ diff --git a/examples/poiseulle_3d/poiseulle_3d.cpp b/examples/poiseulle_3d/poiseulle_3d.cpp index 83d1af1..141dc5f 100644 --- a/examples/poiseulle_3d/poiseulle_3d.cpp +++ b/examples/poiseulle_3d/poiseulle_3d.cpp @@ -146,7 +146,6 @@ public: namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; using T = Float32; using Desc = Descriptor<3u,27u>; @@ -161,21 +160,21 @@ using CellStruct = Struct< Member >; } -using SyclKelAllocator = acpp::sycl::usm_allocator, acpp::sycl::usm::alloc::shared>; +using SyclKelAllocator = acpp::sycl::usm_allocator, acpp::sycl::usm::alloc::shared>; -uint64_t to_flat_index(const saw::data>& index, const saw::data>& meta){ +uint64_t to_flat_index(const kel::lbm::data>& index, const kel::lbm::data>& meta){ auto flat = index.at({2u}) + meta.at({2u})*(index.at({1u}) + index.at({0u})*meta.at({1u})); return flat.get(); } template -saw::error_or set_geometry(std::vector,SyclKelAllocator>& latt, const saw::data>& meta){ +kel::lbm::error_or set_geometry(std::vector,SyclKelAllocator>& latt, const kel::lbm::data>& meta){ using namespace kel::lbm; /** * Set ghost */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -183,17 +182,17 @@ saw::error_or set_geometry(std::vector,SyclKe info({0u}).set(0u); }, {{0u,0u}}, meta); - saw::data> distance; + kel::lbm::data> distance; /** * Set wall */ - iterator<1u>::apply([&](const saw::data>& index){ + iterator<1u>::apply([&](const kel::lbm::data>& index){ distance.at(index.at({0u})) = {1u}; },{{0u}},{{sch::Desc::D}}); /* */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -204,12 +203,12 @@ saw::error_or set_geometry(std::vector,SyclKe /** * Set fluid */ - iterator<1u>::apply([&](const saw::data>& index){ + iterator<1u>::apply([&](const kel::lbm::data>& index){ distance.at(index.at({0u})) = {2u}; },{{0u}},{{sch::Desc::D}}); /* */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -222,14 +221,14 @@ saw::error_or set_geometry(std::vector,SyclKe * Set inflow */ - saw::data> shifted_point; - iterator<1u>::apply([&](const saw::data>& index){ + kel::lbm::data> shifted_point; + iterator<1u>::apply([&](const kel::lbm::data>& index){ distance.at(index.at({0u})) = (index.at({0u}).get() == 0u)?1u:2u; shifted_point.at(index.at({0u})) = (index.at({0u}).get() == 0u)?3u:meta.at({index.at({0u})}); },{{0u}},{{sch::Desc::D}}); /* */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -241,13 +240,13 @@ saw::error_or set_geometry(std::vector,SyclKe /** * Set outflow */ - iterator<1u>::apply([&](const saw::data>& index){ + iterator<1u>::apply([&](const kel::lbm::data>& index){ distance.at(index.at({0u})) = (index.at({0u}).get() == 0u)?1u:2u; shifted_point.at(index.at({0u})) = (index.at({0u}).get() == 0u)?(meta.at({0u})-3u):0u; },{{0u}},{{sch::Desc::D}}); /* */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -256,51 +255,51 @@ saw::error_or set_geometry(std::vector,SyclKe }, shifted_point, meta, distance); - return saw::make_void(); + return kel::lbm::make_void(); } template -saw::error_or set_initial_conditions(std::vector,SyclKelAllocator>& latt, const saw::data>& meta){ +kel::lbm::error_or set_initial_conditions(std::vector,SyclKelAllocator>& latt, const kel::lbm::data>& meta){ - saw::data rho{1.0}; - saw::data> vel{}; + kel::lbm::data rho{1.0}; + kel::lbm::data> vel{}; vel.at({0u}) = {0.1f}; auto eq = equilibrium(rho, vel); /** * Set distribution */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& dfs = cell.template get<"dfs">(); auto& dfs_old = cell.template get<"dfs_old">(); - for(saw::data k = 0; k < saw::data{sch::Desc::Q}; ++k){ + for(kel::lbm::data k = 0; k < kel::lbm::data{sch::Desc::Q}; ++k){ dfs(k) = eq.at(k); dfs_old(k) = eq.at(k); } }, {}, meta); - return saw::make_void(); + return kel::lbm::make_void(); } template -saw::error_or lbm_step( - std::vector,SyclKelAllocator>& latt, - const saw::data>& meta, - saw::data time_step, +kel::lbm::error_or lbm_step( + std::vector,SyclKelAllocator>& latt, + const kel::lbm::data>& meta, + kel::lbm::data time_step, acpp::sycl::queue& sycl_q ){ using dfi = df_info; bool even_step = ((time_step.get() % 2u) == 0u); - component coll{0.5384}; - component bb; + component coll{0.5384}; + component bb; /** * Collision */ - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -329,7 +328,7 @@ saw::error_or lbm_step( }, {}, meta); // Stream - iterator::apply([&](const saw::data>& index){ + iterator::apply([&](const kel::lbm::data>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& df_new = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">(); @@ -352,10 +351,10 @@ saw::error_or lbm_step( } } }, {}, meta); - return saw::make_void(); + return kel::lbm::make_void(); } -saw::error_or real_main(int argc, char** argv){ +kel::lbm::error_or real_main(int argc, char** argv){ using dfi = df_info; converter conv { @@ -369,10 +368,10 @@ saw::error_or real_main(int argc, char** argv){ /** * Set the meta and initialize the lattice */ - saw::data> meta{{2048u,128u,128u}}; + kel::lbm::data> meta{{2048u,128u,128u}}; SyclKelAllocator sycl_shared_alloc{sycl_q}; - std::vector,SyclKelAllocator> lattice{(meta.at({0u})*meta.at({1u})*meta.at({2u})).get(), sycl_shared_alloc}; + std::vector,SyclKelAllocator> lattice{(meta.at({0u})*meta.at({1u})*meta.at({2u})).get(), sycl_shared_alloc}; /** * Set the geometry @@ -394,14 +393,14 @@ saw::error_or real_main(int argc, char** argv){ } } - for(saw::data ts{0u}; ts < saw::data{1024u*32u}; ++ts){ + for(kel::lbm::data ts{0u}; ts < kel::lbm::data{1024u*32u}; ++ts){ auto eov = lbm_step(lattice,meta,ts,sycl_q); if(eov.is_error()){ return eov; } } - return saw::make_void(); + return kel::lbm::make_void(); } } // lbm diff --git a/examples/poiseulle_3d_gpu/sim.cpp b/examples/poiseulle_3d_gpu/sim.cpp index 167234d..3fe7358 100644 --- a/examples/poiseulle_3d_gpu/sim.cpp +++ b/examples/poiseulle_3d_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_z = 256ul; constexpr uint64_t particle_size = 128ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -53,11 +52,11 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( +kel::lbm::error_or setup_initial_conditions( converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data, particle_size>>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data, particle_size>>& particles ){ auto& info_f = fields.template get<"info">(); // Set everything as walls @@ -135,19 +134,19 @@ saw::error_or setup_initial_conditions( {{1u,1u,1u}} ); - for(saw::data i{0u}; i < saw::data{particle_size}; ++i){ + for(kel::lbm::data i{0u}; i < kel::lbm::data{particle_size}; ++i){ auto& part = particles.at(i); } - return saw::make_void(); + return kel::lbm::make_void(); } template -saw::error_or step( +kel::lbm::error_or step( converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data t_i, + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -156,11 +155,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{conv.template kinematic_viscosity_si_to_tau({0.1}).handle()}; - // component> collision{0.6}; - component> bb; + component> collision{conv.template kinematic_viscosity_si_to_tau({0.1}).handle()}; + // component> collision{0.6}; + component> bb; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 256u; if(t_i.get() < target_t_i){ @@ -169,10 +168,10 @@ saw::error_or step( return 1.001; }() }; - component,encode::Sycl> flow_out{1.0}; + component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x,dim_y,dim_z}, [=](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]); } @@ -203,10 +202,10 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> stream; + component> stream; h.parallel_for(acpp::sycl::range{dim_x,dim_y,dim_z}, [=](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]); } @@ -226,13 +225,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; @@ -249,7 +248,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"); } } @@ -262,15 +261,16 @@ saw::error_or lbm_main(int argc, char** argv){ print_lbm_meta(conv,{0.1},{0.01},{1024.0}); - auto lbm_data_ptr = saw::heap>>(); - auto lbm_macro_data_ptr = saw::heap>>(); - auto lbm_particle_data_ptr = saw::heap, particle_size>>>(); + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); + auto lbm_particle_data_ptr = kel::lbm::heap, particle_size>>>(); 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}; @@ -296,9 +296,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, particle_size>, 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, particle_size>, encode::Sycl> lbm_sycl_particle_data{sycl_q}; sycl_q.wait(); auto lsd_view = make_view(lbm_sycl_data); @@ -322,9 +322,9 @@ saw::error_or lbm_main(int argc, char** argv){ } } sycl_q.wait(); - saw::data time_steps{2048ul}; + kel::lbm::data time_steps{2048ul}; - for(saw::data i{0u}; i < time_steps and krun; ++i){ + for(kel::lbm::data i{0u}; i < time_steps and krun; ++i){ { { auto eov = write_vtk_file(out_dir,"t",i.get(),*lbm_macro_data_ptr); @@ -386,7 +386,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; diff --git a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp b/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp index 1af0023..793be1f 100644 --- a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp +++ b/examples/poiseulle_moving_particle_2d_psm_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 InfoChunk = Chunk; @@ -59,9 +58,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -159,14 +158,14 @@ saw::error_or setup_initial_conditions( {{1u,1u}} ); - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -176,20 +175,20 @@ saw::error_or step( eps.at({}).set(1.5f); q.submit([&](acpp::sycl::handler& h){ - component> collision{0.8}; - component> bb; - component,encode::Sycl> abb; + component> collision{0.8}; + component> bb; + component,encode::Sycl> abb; - component,encode::Sycl> flow_in{1.0001}; - component,encode::Sycl> flow_out{1.0}; + component,encode::Sycl> flow_in{1.0001}; + component,encode::Sycl> flow_out{1.0}; - component> optw; + component> optw; h.parallel_for(acpp::sycl::range<1u>{1u},[=](acpp::sycl::id<1u> idx){ }).wait(); 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]); } @@ -233,13 +232,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; @@ -256,7 +255,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"); } } @@ -269,15 +268,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -309,8 +309,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -329,11 +329,11 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -376,10 +376,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]); } @@ -427,7 +427,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; diff --git a/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp b/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp index 9ed1646..e8ae50a 100644 --- a/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_bgk_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 InfoChunk = Chunk; @@ -56,9 +55,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); // Set everything as walls @@ -138,7 +137,7 @@ saw::error_or setup_initial_conditions( iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -146,7 +145,7 @@ saw::error_or setup_initial_conditions( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ info_f.at(index) = 1u; } @@ -155,14 +154,14 @@ saw::error_or setup_initial_conditions( df_f.get_dims() ); - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -171,18 +170,18 @@ 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,encode::Sycl> abb; + component> collision{0.8}; + component> bb; + component,encode::Sycl> abb; - saw::data> rho_b; + kel::lbm::data> rho_b; rho_b.at({}) = 1.0; - saw::data> vel_b; + kel::lbm::data> vel_b; vel_b.at({{0u}}) = 0.015; - component> equi{rho_b,vel_b}; + component> equi{rho_b,vel_b}; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 32u; if(t_i.get() < target_t_i){ @@ -191,11 +190,11 @@ saw::error_or step( return 1.0002; }() }; - 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]); } @@ -234,13 +233,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; /* @@ -265,7 +264,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"); } } @@ -278,15 +277,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -318,8 +318,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -337,11 +337,11 @@ saw::error_or lbm_main(int argc, char** argv){ sycl_q.wait(); auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -384,10 +384,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]); } @@ -429,7 +429,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; diff --git a/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp b/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp index f45e10e..9d9e32e 100644 --- a/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_fplbm_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -62,9 +61,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -145,14 +144,14 @@ saw::error_or setup_initial_conditions( {{1u,1u}} ); - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -161,22 +160,22 @@ 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; - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.25; p_pos.at({{1u}}) = dim_y * 0.5; } - component> opa{p_pos,rad,eps}; + component> opa{p_pos,rad,eps}; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 64u; if(t_i.get() < target_t_i){ @@ -185,11 +184,11 @@ saw::error_or step( return 1.0002; }() }; - 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]); } @@ -230,13 +229,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; @@ -253,7 +252,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"); } } @@ -266,15 +265,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -305,8 +305,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -324,10 +324,10 @@ saw::error_or lbm_main(int argc, char** argv){ sycl_q.wait(); auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -339,10 +339,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]); } @@ -384,7 +384,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; diff --git a/examples/poiseulle_particles_2d_gpu/common.hpp b/examples/poiseulle_particles_2d_gpu/common.hpp index b321344..6806b2c 100644 --- a/examples/poiseulle_particles_2d_gpu/common.hpp +++ b/examples/poiseulle_particles_2d_gpu/common.hpp @@ -19,7 +19,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; diff --git a/examples/poiseulle_particles_2d_gpu/init.hpp b/examples/poiseulle_particles_2d_gpu/init.hpp index b7fdeb0..a61ef37 100644 --- a/examples/poiseulle_particles_2d_gpu/init.hpp +++ b/examples/poiseulle_particles_2d_gpu/init.hpp @@ -6,11 +6,11 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ (void) conv; @@ -95,7 +95,7 @@ saw::error_or init( iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -103,7 +103,7 @@ saw::error_or init( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ porous_f.at(index).at({}) = 0.0; } @@ -113,14 +113,14 @@ saw::error_or init( ); { - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(2); - saw::data> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); particles = create_spheroid_particle_group(radius_p, dense_p, {{16u}}); } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index f5b49e9..e852313 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -8,7 +8,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< Member, @@ -22,7 +21,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -41,7 +40,7 @@ saw::error_or lbm_main(const saw::data& args){ 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"); } } @@ -54,16 +53,17 @@ saw::error_or lbm_main(const saw::data& args){ 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_particle_data_ptr = saw::heap>>(); + // 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>>(); 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}; @@ -95,9 +95,9 @@ saw::error_or lbm_main(const saw::data& args){ } } - 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}; sycl_q.wait(); { @@ -117,11 +117,11 @@ saw::error_or lbm_main(const saw::data& args){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); - saw::data time_steps{64u*1024ul}; + kel::lbm::data time_steps{64u*1024ul}; 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(conv,lsd_view,lsdm_view,lsdp_view,i,dev); @@ -147,10 +147,10 @@ saw::error_or lbm_main(const saw::data& args){ } // 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]); } @@ -186,16 +186,16 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); return eov; @@ -209,7 +209,7 @@ saw::error_or k_main(int argc, char** argv){ // return kmain(args); } - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/poiseulle_particles_2d_gpu/step.hpp b/examples/poiseulle_particles_2d_gpu/step.hpp index 37eb4e7..ade14ca 100644 --- a/examples/poiseulle_particles_2d_gpu/step.hpp +++ b/examples/poiseulle_particles_2d_gpu/step.hpp @@ -6,12 +6,12 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, + 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(); @@ -19,9 +19,9 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_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]); } @@ -31,10 +31,10 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_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]); } @@ -45,10 +45,10 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> collision{0.8}; - component> bb; + component> collision{0.8}; + component> bb; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 16u; if(t_i.get() < target_t_i){ @@ -57,10 +57,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]); } @@ -90,7 +90,7 @@ saw::error_or step( }); }).wait(); - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp index 0061fa2..926086c 100644 --- a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; // constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -59,9 +58,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -145,7 +144,7 @@ saw::error_or setup_initial_conditions( /* iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -153,7 +152,7 @@ saw::error_or setup_initial_conditions( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ porous_f.at(index).at({}) = 0.0; } @@ -163,14 +162,14 @@ saw::error_or setup_initial_conditions( ); */ - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -179,25 +178,25 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8}; - component> collision{0.8}; - component> bb; - component,encode::Sycl> abb; + component> bgk{0.8}; + component> collision{0.8}; + component> bb; + component,encode::Sycl> abb; - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.25; p_pos.at({{1u}}) = dim_y * 0.5; } - component> opa{p_pos,rad,eps}; + component> opa{p_pos,rad,eps}; - component> fg; + component> fg; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 64u; if(t_i.get() < target_t_i){ @@ -206,11 +205,11 @@ saw::error_or step( return 1.0002; }() }; - 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]); } @@ -252,13 +251,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; @@ -275,7 +274,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"); } } @@ -288,15 +287,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -328,8 +328,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -347,10 +347,10 @@ saw::error_or lbm_main(int argc, char** argv){ sycl_q.wait(); auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -362,10 +362,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]); } @@ -407,7 +407,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; diff --git a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp index d63515d..b051c4e 100644 --- a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp @@ -18,7 +18,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; // constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -66,10 +65,10 @@ using ParticleSpheroidGroup = ParticleGroup< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros, - saw::data>& particles +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ auto& info_f = fields.template get<"info">(); // Set everything as walls @@ -153,7 +152,7 @@ saw::error_or setup_initial_conditions( // Particles { - saw::data> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); auto& spheroid_grp = particles; @@ -186,15 +185,15 @@ saw::error_or setup_initial_conditions( } } - 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(); @@ -203,7 +202,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]); } @@ -240,7 +239,7 @@ saw::error_or step( iterator::apply([&](const auto& index){ /// Calculate the shift from the mask - saw::data> index_shift; + kel::lbm::data> index_shift; for(uint64_t i = 0u; i < Desc::D; ++i){ index_shift.at({{i}}) = index.at({i}).template cast_to() - com.at({}).at({{i}}); // Scale to LBM Grid @@ -271,18 +270,18 @@ 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.65}; - component> bb; - component,encode::Sycl> abb; + component> collision{0.65}; + component> bb; + component,encode::Sycl> abb; - saw::data> rho_b; + kel::lbm::data> rho_b; rho_b.at({}) = 1.0; - saw::data> vel_b; + kel::lbm::data> vel_b; vel_b.at({{0u}}) = 0.015; - component> equi{rho_b,vel_b}; + component> equi{rho_b,vel_b}; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 32u; if(t_i.get() < target_t_i){ @@ -291,11 +290,11 @@ saw::error_or step( return 1.0002; }() }; - 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]); } @@ -335,13 +334,13 @@ saw::error_or step( // h.depends_on(collision_ev); }).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; /* @@ -366,7 +365,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"); } } @@ -379,16 +378,17 @@ 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_particle_ptr = saw::heap>>(); + // 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_ptr = kel::lbm::heap>>(); 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}; @@ -420,9 +420,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{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{sycl_q}; sycl_q.wait(); { @@ -447,11 +447,11 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle); - 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); @@ -492,10 +492,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]); } @@ -544,7 +544,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; diff --git a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp index ae15a9a..3fd5579 100644 --- a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_psm_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 InfoChunk = Chunk; @@ -60,9 +59,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -160,11 +159,11 @@ saw::error_or setup_initial_conditions( {{1u,1u}} ); - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.25; p_pos.at({{1u}}) = dim_y * 0.5; @@ -184,7 +183,7 @@ saw::error_or setup_initial_conditions( /* iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -192,7 +191,7 @@ saw::error_or setup_initial_conditions( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ porous_f.at(index).at({}) = 0.0; } @@ -202,14 +201,14 @@ saw::error_or setup_initial_conditions( ); */ - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -217,22 +216,22 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); 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; - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.25; p_pos.at({{1u}}) = dim_y * 0.5; } - component> opa{p_pos,rad,eps}; + component> opa{p_pos,rad,eps}; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 64u; if(t_i.get() < target_t_i){ @@ -241,12 +240,12 @@ saw::error_or step( return 1.0002; }() }; - component,encode::Sycl> flow_out{1.0}; + component,encode::Sycl> flow_out{1.0}; - component> fg; + component> fg; 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]); } @@ -292,13 +291,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; @@ -315,7 +314,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"); } } @@ -328,15 +327,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -368,8 +368,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -388,11 +388,11 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -404,10 +404,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]); } @@ -449,7 +449,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; diff --git a/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp b/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp index 24832f2..aadeb12 100644 --- a/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp +++ b/examples/poiseulle_particles_channel_2d/poiseulle_particles_channel_2d.cpp @@ -13,7 +13,6 @@ namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; using T = Float32; @@ -85,7 +84,7 @@ using CavityFieldD2Q9 = CellField>; } } -void set_geometry(saw::data& latt){ +void set_geometry(kel::lbm::data& latt){ using namespace kel::lbm; auto meta = latt.meta(); @@ -93,7 +92,7 @@ void set_geometry(saw::data& latt){ /** * Set ghost */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -104,7 +103,7 @@ void set_geometry(saw::data& latt){ /** * Set wall */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -115,7 +114,7 @@ void set_geometry(saw::data& latt){ /** * Set fluid */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -126,7 +125,7 @@ void set_geometry(saw::data& latt){ /** * Set inflow */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -137,7 +136,7 @@ void set_geometry(saw::data& latt){ /** * Set outflow */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -148,11 +147,11 @@ void set_geometry(saw::data& latt){ /** * Set channel wall */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); - saw::data> area{{meta.at({0u})-8u, meta.at({1u})-2u}}; + kel::lbm::data> area{{meta.at({0u})-8u, meta.at({1u})-2u}}; double safety_start = 0.1*area.at({0u}).get(); double safety_width = 0.2*area.at({1u}).get(); @@ -160,7 +159,7 @@ void set_geometry(saw::data& latt){ double ch_width = (area.at({1u}).get()-safety_width) * 0.5; double ch_length = (area.at({0u}).get()-safety_start) * 0.5; - saw::data> middle{{meta.at({0u})/2u, meta.at({1u})/2u}}; + kel::lbm::data> middle{{meta.at({0u})/2u, meta.at({1u})/2u}}; // r^2 = (r-w/2)^2 + l^2 double r_c = ch_length * ch_length; @@ -187,11 +186,11 @@ void set_geometry(saw::data& latt){ /** * Set channel circular obstacle */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); - saw::data> area{{meta.at({0u})-4u, meta.at({1u})-4u}}; + kel::lbm::data> area{{meta.at({0u})-4u, meta.at({1u})-4u}}; double pos_x = 0.8 * area.at({0u}).get(); double pos_y = 0.5 * area.at({1u}).get(); @@ -207,11 +206,11 @@ void set_geometry(saw::data& latt){ }, {{0u,0u}}, meta, {{2u,2u}}); } -void set_initial_conditions(saw::data& latt){ +void set_initial_conditions(kel::lbm::data& latt){ using namespace kel::lbm; - saw::data rho{1.0}; - saw::data> vel{{0.0,0.0}}; + kel::lbm::data rho{1.0}; + kel::lbm::data> vel{{0.0,0.0}}; auto eq = equilibrium(rho, vel); auto meta = latt.meta(); @@ -219,12 +218,12 @@ void set_initial_conditions(saw::data& latt){ /** * Set distribution */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& dfs = cell.template get<"dfs">(); auto& dfs_old = cell.template get<"dfs_old">(); - for(saw::data k = 0; k < saw::data{sch::D2Q9::Q}; ++k){ + for(kel::lbm::data k = 0; k < kel::lbm::data{sch::D2Q9::Q}; ++k){ dfs(k) = eq.at(k); dfs_old(k) = eq.at(k); } @@ -234,7 +233,7 @@ void set_initial_conditions(saw::data& latt){ void add_particles(kel::lbm::particle_system& part_sys){ using namespace kel::lbm; - saw::data> part; + kel::lbm::data> part; auto& p_mask = part.template get<"mask">(); auto& p_mass = part.template get<"mass">(); @@ -243,7 +242,7 @@ void add_particles(kel::lbm::particle_system& part_sys){ p_mask = geo.template generate_mask(10u,0u); auto& p_grid = p_mask.template get<"grid">(); - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& p_grid_cell = p_grid.at(index); p_mass = p_mass + p_grid_cell; }, {{0u,0u}}, p_grid.dims()); @@ -263,8 +262,8 @@ void add_particles(kel::lbm::particle_system& part_sys){ for(uint64_t i = 0; i < 10; ++i){ for(uint64_t j = 0; j < 15; ++j){ - pos.at({{0u}}) = {static_cast::type>(16u + j * 11u)}; - pos.at({{1u}}) = {static_cast::type>(16u + i * 11u)}; + pos.at({{0u}}) = {static_cast::type>(16u + j * 11u)}; + pos.at({{1u}}) = {static_cast::type>(16u + i * 11u)}; old_pos = pos; auto eov = part_sys.add_particle(part); @@ -277,9 +276,9 @@ void add_particles(kel::lbm::particle_system& part_sys){ void couple_particles_to_lattice( kel::lbm::particle_system& part_sys, - saw::data& latt, - saw::data,kel::lbm::sch::D2Q9::D>>& macros, - saw::data time_step + kel::lbm::data& latt, + kel::lbm::data,kel::lbm::sch::D2Q9::D>>& macros, + kel::lbm::data time_step ){ using namespace kel::lbm; (void) time_step; @@ -287,7 +286,7 @@ void couple_particles_to_lattice( auto meta = latt.meta(); using dfi = df_info; - for(saw::data i{0u}; i < part_sys.size(); ++i){ + for(kel::lbm::data i{0u}; i < part_sys.size(); ++i){ auto& part = part_sys.at(i); auto& p_rb = part.template get<"rigid_body">(); @@ -307,15 +306,15 @@ void couple_particles_to_lattice( // Temporary unused due to me trying to debug freaking particle wall phasing // Rotated x-dir - saw::data> x_dir{{ - p_size * saw::data{std::cos(p_rot.get())}, - p_size * saw::data{-std::sin(p_rot.get())} + kel::lbm::data> x_dir{{ + p_size * kel::lbm::data{std::cos(p_rot.get())}, + p_size * kel::lbm::data{-std::sin(p_rot.get())} }}; // Rotated y-dir - saw::data> y_dir{{ - p_size * saw::data{std::sin(p_rot.get())}, - p_size * saw::data{std::cos(p_rot.get())} + kel::lbm::data> y_dir{{ + p_size * kel::lbm::data{std::sin(p_rot.get())}, + p_size * kel::lbm::data{std::cos(p_rot.get())} }}; auto& p_mask_grid = p_mask.template get<"grid">(); @@ -328,26 +327,26 @@ void couple_particles_to_lattice( // Particle to Fluid Coupling // Spread force to close fluid cells - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ (void)index; }, {{0u,0u}}, p_mask_grid_dims); // Fluid to Particle Coupling // Prepare force sum - // saw::data> forces; + // kel::lbm::data> forces; - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ if(p_mask_grid.at(index).get() == 0){ return; } - saw::data> index_shift; + kel::lbm::data> index_shift; for(uint64_t i = 0u; i < sch::D2Q9::D; ++i){ index_shift.at({{i}}) = index.at({i}).template cast_to() - center_of_mass.at({{i}}); } - saw::data> mask_shift; + kel::lbm::data> mask_shift; for(uint64_t i = 0u; i < sch::D2Q9::D; ++i){ // Technically rotate and adjust here mask_shift.at({{i}}) = index_shift.at({{i}}); @@ -357,7 +356,7 @@ void couple_particles_to_lattice( // Cast down to get lower corner. // Before casting shift by 0.5 for closest pick - saw::data> p_cell_pos; + kel::lbm::data> p_cell_pos; { p_cell_pos.at({{0u}}) = {static_cast(p_pos_lie.at({{0u}}).get()+0.5)}; p_cell_pos.at({{1u}}) = {static_cast(p_pos_lie.at({{1u}}).get()+0.5)}; @@ -374,7 +373,7 @@ void couple_particles_to_lattice( // p_pos - p_pos_old // auto p_vel_rel = closest_u - p_vel; - saw::data> p_vel_rel = closest_u - p_vel; + kel::lbm::data> p_vel_rel = closest_u - p_vel; { p_vel_rel.at({{0u}}) = p_vel_rel.at({{0u}}) / p_mass; p_vel_rel.at({{1u}}) = p_vel_rel.at({{1u}}) / p_mass; @@ -385,7 +384,7 @@ void couple_particles_to_lattice( p_acc = p_acc + p_vel_rel; /* - for(saw::data i{0u}; i.get() < 2u; ++i){ + for(kel::lbm::data i{0u}; i.get() < 2u; ++i){ p_cell_pos.at({{1u}}).set(std::max(1ul, std::min(p_cell_pos.at({{1u}}).get(), meta.at({1u}).get()-2ul))); p_acc.at({{i}}) = p_acc.at({{i}}) + p_vel_rel.at({{i}}); } @@ -393,20 +392,20 @@ void couple_particles_to_lattice( }, {{0u,0u}}, p_mask_grid.dims()); - saw::data> solid_normal; + kel::lbm::data> solid_normal; - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ if(p_mask_grid.at(index).get() == 0){ return; } - saw::data> index_shift; + kel::lbm::data> index_shift; for(uint64_t i = 0; i < sch::D2Q9::D; ++i){ index_shift.at({{i}}) = index.at({i}).template cast_to() - center_of_mass.at({{i}}); } - saw::data> mask_shift; + kel::lbm::data> mask_shift; /* { mask_shift.at({{0u}}) = index_shift.at({{0u}}) * x_dir.at({0u}) + index_shift.at({{1u}}) * y_dir.at({0u}); @@ -422,7 +421,7 @@ void couple_particles_to_lattice( // Cast down to get lower corner. // Before casting shift by 0.5 for closest pick - saw::data> p_cell_pos; + kel::lbm::data> p_cell_pos; for(uint64_t i = 0; i < sch::D2Q9::D; ++i){ p_cell_pos.at({{i}}) = {static_cast(p_pos_lie.at({{i}}).get()+0.5)}; } @@ -430,7 +429,7 @@ void couple_particles_to_lattice( p_cell_pos.at({{i}}).set(std::max(1ul, std::min(p_cell_pos.at({{i}}).get(), meta.at({i}).get()-2ul))); } - saw::data> p_vec_cell_pos; + kel::lbm::data> p_vec_cell_pos; for(uint64_t i = 0; i < sch::D2Q9::D; ++i){ p_vec_cell_pos.at({{i}}) = p_cell_pos.at({i}); } @@ -446,13 +445,13 @@ void couple_particles_to_lattice( auto p_pos_rel_vec = p_pos - p_vec_cell_pos.template cast_to(); solid_normal = solid_normal + p_pos_rel_vec; - p_pos_rel_vec = saw::math::normalize(p_pos_rel_vec); + p_pos_rel_vec = kel::lbm::math::normalize(p_pos_rel_vec); - // solid_normal = saw::math::normalize(solid_normal); - // auto v_n = saw::math::dot(solid_normal,p_vel + p_acc); + // solid_normal = kel::lbm::math::normalize(solid_normal); + // auto v_n = kel::lbm::math::dot(solid_normal,p_vel + p_acc); { - saw::data> one; + kel::lbm::data> one; one.at({}) = {0.05f}; p_pos_rel_vec.at({{0u}}) = p_pos_rel_vec.at({{0u}}) * one.at({}); @@ -470,8 +469,8 @@ void couple_particles_to_lattice( */ /* - for(saw::data k{0u}; k.get() < sch::D2Q9::Q; ++k){ - auto n_p_cell_pos = saw::data> {{ + for(kel::lbm::data k{0u}; k.get() < sch::D2Q9::Q; ++k){ + auto n_p_cell_pos = kel::lbm::data> {{ p_cell_pos.at({{0u}}) + dfi::directions[k.get()][0u], p_cell_pos.at({{1u}}) + dfi::directions[k.get()][1u] }}; @@ -486,7 +485,7 @@ void couple_particles_to_lattice( if(n_info.get() <= 1u or (n_macro_cell_particle.get() != (i.get()+1u) and n_macro_cell_particle.get() > 0u) ) { // add to p_acc - saw::data dist_dot{ + kel::lbm::data dist_dot{ (p_pos.at({{0u}})-n_p_cell_pos.at({{0u}}).template cast_to()) * dfi::directions[dfi::opposite_index[k.get()]][0u]+ (p_pos.at({{1u}})-n_p_cell_pos.at({{1u}}).template cast_to()) * dfi::directions[dfi::opposite_index[k.get()]][1u] }; @@ -495,10 +494,10 @@ void couple_particles_to_lattice( // TODO add if particle is close //auto& n_debug_acc = n_macro_cell.template get<"debug_acceleration">(); - saw::data> push_force; + kel::lbm::data> push_force; { - push_force.at({{0u}}) = saw::data{1000000 * dfi::directions[dfi::opposite_index[k.get()]][0u]}.template cast_to(); - push_force.at({{1u}}) = saw::data{1000000 * dfi::directions[dfi::opposite_index[k.get()]][1u]}.template cast_to(); + push_force.at({{0u}}) = kel::lbm::data{1000000 * dfi::directions[dfi::opposite_index[k.get()]][0u]}.template cast_to(); + push_force.at({{1u}}) = kel::lbm::data{1000000 * dfi::directions[dfi::opposite_index[k.get()]][1u]}.template cast_to(); } //n_debug_acc = n_debug_acc + push_force; @@ -513,10 +512,10 @@ void couple_particles_to_lattice( }, {{0u,0u}}, p_mask_grid.dims()); - solid_normal = saw::math::normalize(solid_normal); + solid_normal = kel::lbm::math::normalize(solid_normal); // Calculate orientation (Leaving wall or particle "< 0" or not "> 0") - auto v_n = saw::math::dot(solid_normal, (p_vel + p_acc)); + auto v_n = kel::lbm::math::dot(solid_normal, (p_vel + p_acc)); if(v_n.at({}).get() < 0.0){ auto v_n_2 = v_n + v_n; @@ -531,8 +530,8 @@ void couple_particles_to_lattice( } void lbm_step( - saw::data& latt, - saw::data,kel::lbm::sch::D2Q9::D>>& macros, + kel::lbm::data& latt, + kel::lbm::data,kel::lbm::sch::D2Q9::D>>& macros, uint64_t time_step ){ using namespace kel::lbm; @@ -554,7 +553,7 @@ void lbm_step( /** * Collision */ - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); @@ -587,7 +586,7 @@ void lbm_step( }, {{0u,0u}}, meta); // Stream - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = latt(index); auto& df_new = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">(); auto& info_new = cell.template get<"info">(); @@ -620,7 +619,7 @@ void lbm_step( */ -saw::error_or real_main(int argc, char** argv){ +kel::lbm::error_or real_main(int argc, char** argv){ using namespace kel::lbm; using dfi = df_info; @@ -632,7 +631,7 @@ saw::error_or real_main(int argc, char** argv){ - saw::data> args; + kel::lbm::data> args; auto& conf = args.template get<"args">(); { conf.template get<"delta_x">() = 1.0f; @@ -648,8 +647,8 @@ saw::error_or real_main(int argc, char** argv){ */ } { - saw::data, saw::encode::Args> args_enc{argc,argv}; - saw::codec, saw::encode::Args> args_codec; + kel::lbm::data, saw::encode::Args> args_enc{argc,argv}; + kel::lbm::codec, saw::encode::Args> args_codec; auto eov = args_codec.decode(args_enc, args); if(eov.is_error()){ return eov; @@ -671,8 +670,8 @@ saw::error_or real_main(int argc, char** argv){ print_lbm_meta>(conv, {conf.template get<"kinematic_viscosity">()}); - saw::data> dim{{1024u, 128u}}; - saw::data lattice{dim}; + kel::lbm::data> dim{{1024u, 128u}}; + kel::lbm::data lattice{dim}; auto meta = lattice.meta(); /** @@ -687,9 +686,9 @@ saw::error_or real_main(int argc, char** argv){ set_geometry(lattice); { - saw::data, sch::D2Q9::D>> geo{dim}; + kel::lbm::data, sch::D2Q9::D>> geo{dim}; - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = lattice(index); auto& info = cell.template get<"info">(); @@ -705,7 +704,7 @@ saw::error_or real_main(int argc, char** argv){ */ set_initial_conditions(lattice); - saw::data,sch::D2Q9::D>> macros{dim}; + kel::lbm::data,sch::D2Q9::D>> macros{dim}; uint64_t lbm_steps = 10000u; for(uint64_t i = 0u; i < lbm_steps; ++i){ @@ -714,7 +713,7 @@ saw::error_or real_main(int argc, char** argv){ { // Stream - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ auto& cell = lattice(index); auto& dfs = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">(); @@ -726,7 +725,7 @@ saw::error_or real_main(int argc, char** argv){ auto& part_mask = macro_cell.template get<"particle">(); compute_rho_u(dfs,rho,vel); - rho = rho * saw::data{dfi::cs2}; + rho = rho * kel::lbm::data{dfi::cs2}; for(uint64_t d = 0u; d < sch::D2Q9::D; ++d){ force.at({d}) = cell.template get<"force">()({d}); @@ -735,7 +734,7 @@ saw::error_or real_main(int argc, char** argv){ part_mask.set(0u); }, {{0u,0u}}, meta); - for(saw::data i{0u}; i < particle_sys.size(); ++i){ + for(kel::lbm::data i{0u}; i < particle_sys.size(); ++i){ auto& p = particle_sys.at({i}); auto& p_rb = p.template get<"rigid_body">(); @@ -746,23 +745,23 @@ saw::error_or real_main(int argc, char** argv){ auto p_mask_grid_dims = p_mask_grid.dims(); - saw::data> p_mask_grid_shift; + kel::lbm::data> p_mask_grid_shift; p_mask_grid_shift.at({{0u}}) = (p_mask_grid_dims.at({0u}).template cast_to() - 1.0) / 2.0; p_mask_grid_shift.at({{1u}}) = (p_mask_grid_dims.at({1u}).template cast_to() - 1.0) / 2.0; // Iterate - iterate_over([&](const saw::data>& index){ + iterate_over([&](const kel::lbm::data>& index){ if(p_mask_grid.at(index).get() == 0){ return; } - saw::data> index_shift; + kel::lbm::data> index_shift; index_shift.at({{0u}}) = index.at({0u}).template cast_to() - p_mask_grid_shift.at({{0u}}); index_shift.at({{1u}}) = index.at({1u}).template cast_to() - p_mask_grid_shift.at({{1u}}); - saw::data> mask_shift; + kel::lbm::data> mask_shift; for(uint64_t i = 0; i < sch::D2Q9::D; ++i){ // Technically rotate and adjust here mask_shift.at({{i}}) = index_shift.at({{i}}); @@ -772,7 +771,7 @@ saw::error_or real_main(int argc, char** argv){ // Cast down to get lower corner. // Before casting shift by 0.5 for closest pick - saw::data> p_cell_pos {{ + kel::lbm::data> p_cell_pos {{ static_cast(p_pos_lie.at({{0u}}).get()+0.5), static_cast(p_pos_lie.at({{1u}}).get()+0.5) }}; @@ -801,7 +800,7 @@ saw::error_or real_main(int argc, char** argv){ lbm_step(lattice, macros, i); } - return saw::make_void(); + return kel::lbm::make_void(); } int main(int argc, char** argv){ diff --git a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp index ac5c94e..cd5d944 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp @@ -41,7 +41,6 @@ constexpr std::array dims{ constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; template using InfoChunk = Chunk; diff --git a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp index 45cbaa2..c8e2cc9 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp @@ -6,11 +6,11 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ (void) conv; @@ -94,10 +94,10 @@ saw::error_or init( ); { - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get()); std::cout<<"RADIUS: "<> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); particles = create_spheroid_particle_group(radius_p, dense_p, {{64u}}); auto& parts = particles.template get<"particles">(); @@ -114,7 +114,7 @@ saw::error_or init( } } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp index 71410b2..2d389d1 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp @@ -8,7 +8,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< Member @@ -21,7 +20,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -40,7 +39,7 @@ saw::error_or lbm_main(const saw::data& args){ 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"); } } @@ -55,16 +54,17 @@ saw::error_or lbm_main(const saw::data& args){ std::cout<<"Inflow free flow velocity: "<> 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>>(); + // 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>>(); 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}; @@ -90,9 +90,9 @@ saw::error_or lbm_main(const saw::data& args){ } } - 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}; sycl_q.wait(); { @@ -118,11 +118,11 @@ saw::error_or lbm_main(const saw::data& args){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); - saw::data time_steps{64u*1024ul * N * N}; + kel::lbm::data time_steps{64u*1024ul * N * N}; 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(conv,lsd_view,lsdm_view,lsdp_view,i,dev); @@ -148,10 +148,10 @@ saw::error_or lbm_main(const saw::data& args){ } // Stream sycl_q.submit([&](acpp::sycl::handler& h){ - component> stream; + component> stream; h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](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]); } @@ -192,16 +192,16 @@ saw::error_or lbm_main(const saw::data& args){ } } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); if(eov.is_error()){ @@ -219,7 +219,7 @@ saw::error_or k_main(int argc, char** argv){ return lbm_main(args); } - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp index 3e5f9ba..080d27d 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp @@ -6,15 +6,15 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, + 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 ){ - static constexpr saw::data sub_steps{0u}; + static constexpr kel::lbm::data sub_steps{0u}; auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); @@ -22,9 +22,9 @@ saw::error_or step( if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_reset; h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](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]); } @@ -33,10 +33,10 @@ saw::error_or step( }); }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_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]); } @@ -46,12 +46,12 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> collision{0.59}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> collision{0.59}; + component> bb; + component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](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]); } @@ -69,12 +69,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -95,9 +95,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ - component> fplbm_reset; + component> fplbm_reset; h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](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]); } @@ -107,10 +107,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]); } @@ -121,13 +121,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.59}; - component> collision{0.59}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{0.59}; + component> collision{0.59}; + component> bb; + component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](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]); } @@ -145,12 +145,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -171,9 +171,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ - component> fplbm_reset; + component> fplbm_reset; h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](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]); } @@ -183,10 +183,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]); } @@ -197,13 +197,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.59}; - component> collision{0.59}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{0.59}; + component> collision{0.59}; + component> bb; + component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](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]); } @@ -221,12 +221,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -248,7 +248,7 @@ saw::error_or step( } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/settling_cubes_2d_ibm_gpu/sim.cpp b/examples/settling_cubes_2d_ibm_gpu/sim.cpp index d7c51bc..50e6ce5 100644 --- a/examples/settling_cubes_2d_ibm_gpu/sim.cpp +++ b/examples/settling_cubes_2d_ibm_gpu/sim.cpp @@ -17,7 +17,6 @@ constexpr uint64_t dim_y = dim_x * 2ul; constexpr uint64_t particle_amount = 16ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -66,10 +65,10 @@ using ParticleGroups = Tuple< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros, - saw::data>& particles +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ auto& info_f = fields.template get<"info">(); // Set everything as walls @@ -111,7 +110,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; @@ -147,15 +146,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(); @@ -170,7 +169,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]); } @@ -183,14 +182,14 @@ 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]); } auto& p = parts.at(index); auto& p_rb = p.template get<"rigid_body">(); - saw::data> delta_t; + kel::lbm::data> delta_t; delta_t.at({}).set(1.0f); auto& p_pos = p_rb.template get<"position">(); @@ -200,12 +199,12 @@ saw::error_or step( iterator::apply( [&](auto& m_ind){ - saw::data> index_shift; + kel::lbm::data> index_shift; for(uint64_t i{0u}; i < Desc::D; ++i){ index_shift.at({{i}}) = m_ind.at({i}).template cast_to() - (vels.meta().at({i})+1u).template cast_to() * 0.5; } - saw::data> transformed_pos; + kel::lbm::data> transformed_pos; for(uint64_t i{0u}; i < Desc::D; ++i){ // TODO add rotation, scaling here. transformed_pos.at({{i}}) = index_shift.at({{i}}); @@ -215,8 +214,8 @@ saw::error_or step( auto p_pos_lag = p_pos + transformed_pos; // Pick the closest momentum and clamp it - saw::data> p_cell_pos; - saw::data> p_cell_pos_vec; + kel::lbm::data> p_cell_pos; + kel::lbm::data> p_cell_pos_vec; for(uint64_t i{0u}; i < Desc::D; ++i){ p_cell_pos.at({{i}}) = (p_pos_lag.at({{i}}) + 0.5).template cast_to(); p_cell_pos.at({{i}}).set(std::max(0ul,std::min(p_cell_pos.at({{i}}).get(), vels.meta().at({{i}}).get() - 2ul))); @@ -230,7 +229,7 @@ saw::error_or step( auto p_vel = (p_pos - p_rb.template get<"position_old">()) * delta_t; - auto u_solid = p_vel + saw::math::cross(p_rot,rel_cell_to_part_pos); + auto u_solid = p_vel + kel::lbm::math::cross(p_rot,rel_cell_to_part_pos); // Force auto force = (u_solid - u_fluid) / delta_t; @@ -252,11 +251,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]); } @@ -285,13 +284,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; @@ -308,7 +307,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"); } } @@ -321,18 +320,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}; @@ -364,9 +364,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); @@ -398,11 +398,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); @@ -443,10 +443,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]); } @@ -482,7 +482,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; 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; diff --git a/examples/stdkr_2d_bgk/common.hpp b/examples/stdkr_2d_bgk/common.hpp index 0b597c0..cac01fd 100644 --- a/examples/stdkr_2d_bgk/common.hpp +++ b/examples/stdkr_2d_bgk/common.hpp @@ -30,7 +30,6 @@ constexpr uint64_t dim_x = 220u; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; diff --git a/examples/stdkr_2d_bgk/init.hpp b/examples/stdkr_2d_bgk/init.hpp index 3127c88..10edd9c 100644 --- a/examples/stdkr_2d_bgk/init.hpp +++ b/examples/stdkr_2d_bgk/init.hpp @@ -6,10 +6,10 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ (void) conv; @@ -92,12 +92,12 @@ saw::error_or init( iterator::apply( [&](const auto& index){ auto& info = info_f.at(index); - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get()); - saw::data> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); - saw::data> middle,ind_vec; + kel::lbm::data> middle,ind_vec; middle.at({{0u}}) = conv.meter_si_to_lbm({{0.16}}).handle(); middle.at({{1u}}) = conv.meter_si_to_lbm({{0.2}}).handle(); @@ -106,7 +106,7 @@ saw::error_or init( } auto dist = ind_vec - middle; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}) < radius_p.at({}) * radius_p.at({})){ info_f.at(index) = 1u; @@ -115,7 +115,7 @@ saw::error_or init( {},// 0-index df_f.get_dims() ); - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/stdkr_2d_bgk/sim.cpp b/examples/stdkr_2d_bgk/sim.cpp index 36147d5..9b9b5a7 100644 --- a/examples/stdkr_2d_bgk/sim.cpp +++ b/examples/stdkr_2d_bgk/sim.cpp @@ -9,7 +9,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< >; @@ -21,7 +20,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -40,7 +39,7 @@ saw::error_or lbm_main(const saw::data& args){ 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"); } } @@ -53,15 +52,16 @@ saw::error_or lbm_main(const saw::data& args){ print_lbm_meta(conv,{1e-3},{1e-4},{0.5 * dim_y}); - // saw::data> meta{{dim_x,dim_y}}; - auto lbm_data_ptr = saw::heap>>(); - auto lbm_macro_data_ptr = saw::heap>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -93,8 +93,8 @@ saw::error_or lbm_main(const saw::data& args){ } } - saw::data, encode::Sycl> lbm_sycl_data{sycl_q}; - saw::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -113,11 +113,11 @@ saw::error_or lbm_main(const saw::data& args){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - saw::data time_steps{64u*1024ul}; + kel::lbm::data time_steps{64u*1024ul}; 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(conv,lsd_view,lsdm_view,i,dev); @@ -143,10 +143,10 @@ saw::error_or lbm_main(const saw::data& args){ } // 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]); } @@ -182,16 +182,16 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); if(eov.is_error()){ @@ -201,7 +201,7 @@ saw::error_or k_main(int argc, char** argv){ return lbm_main(args); - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/stdkr_2d_bgk/step.hpp b/examples/stdkr_2d_bgk/step.hpp index cbf9f43..67f8486 100644 --- a/examples/stdkr_2d_bgk/step.hpp +++ b/examples/stdkr_2d_bgk/step.hpp @@ -6,26 +6,26 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data t_i, + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ - static constexpr saw::data sub_steps{0u}; + static constexpr kel::lbm::data sub_steps{0u}; auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); { q.submit([&](acpp::sycl::handler& h){ - component> collision{1.0}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> collision{1.0}; + component> bb; + 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]); } @@ -43,12 +43,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -69,7 +69,7 @@ saw::error_or step( }).wait(); } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp b/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp index bbe8cfd..ffa921f 100644 --- a/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_bgk_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 2ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -60,9 +59,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); // Set everything as walls @@ -159,7 +158,7 @@ saw::error_or setup_initial_conditions( iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.5; middle.at({{1u}}) = dim_y * 0.5; @@ -167,7 +166,7 @@ saw::error_or setup_initial_conditions( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01 / 16.0){ info_f.at(index).set(5u); } @@ -176,14 +175,14 @@ saw::error_or setup_initial_conditions( df_f.get_dims() ); - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -191,23 +190,23 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8}; + component> bgk{0.8}; auto& collision = bgk; - component> bb; - component,encode::Sycl> abb; + component> bb; + component,encode::Sycl> abb; - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.5; p_pos.at({{1u}}) = dim_y * 0.5; } - component,encode::Sycl> flow_in{ - [&]() -> saw::data>{ - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data>{ + kel::lbm::data> vel; uint64_t target_t_i = 8u; if(t_i.get() < target_t_i){ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get(); @@ -217,11 +216,11 @@ saw::error_or step( return vel; }() }; - 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]); } @@ -264,13 +263,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; @@ -287,7 +286,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"); } } @@ -300,15 +299,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -339,8 +339,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -358,10 +358,10 @@ saw::error_or lbm_main(int argc, char** argv){ sycl_q.wait(); auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -373,10 +373,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]); } @@ -418,7 +418,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; diff --git a/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp index 9cf974a..90a73cd 100644 --- a/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 2ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -62,9 +61,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -162,7 +161,7 @@ saw::error_or setup_initial_conditions( /* iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -170,7 +169,7 @@ saw::error_or setup_initial_conditions( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ porous_f.at(index).at({}) = 1.0; } @@ -180,14 +179,14 @@ saw::error_or setup_initial_conditions( ); */ - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -196,25 +195,25 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8}; - component> collision{0.8}; - component> bb; - component,encode::Sycl> abb; + component> bgk{0.8}; + component> collision{0.8}; + component> bb; + component,encode::Sycl> abb; - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1/4.0); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.5; p_pos.at({{1u}}) = dim_y * 0.5; } - component> opa{p_pos,rad,eps}; + component> opa{p_pos,rad,eps}; - component,encode::Sycl> flow_in{ - [&]() -> saw::data>{ - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data>{ + kel::lbm::data> vel; uint64_t target_t_i = 8u; if(t_i.get() < target_t_i){ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get(); @@ -224,10 +223,10 @@ saw::error_or step( return vel; }() }; - 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]); } @@ -271,13 +270,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; @@ -294,7 +293,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"); } } @@ -307,15 +306,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -346,8 +346,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -366,11 +366,11 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -382,10 +382,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]); } @@ -427,7 +427,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; diff --git a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp index b63a003..0fe76cb 100644 --- a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp @@ -16,7 +16,6 @@ constexpr uint64_t dim_x = dim_y * 2ul; // constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -59,9 +58,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -159,7 +158,7 @@ saw::error_or setup_initial_conditions( /* iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -167,7 +166,7 @@ saw::error_or setup_initial_conditions( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ porous_f.at(index).at({}) = 0.0; } @@ -177,14 +176,14 @@ saw::error_or setup_initial_conditions( ); */ - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -193,28 +192,28 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8}; - component> collision{0.8}; - component> one_part_moment; - component> bb; - component,encode::Sycl> abb; + component> bgk{0.8}; + component> collision{0.8}; + component> one_part_moment; + component> bb; + component,encode::Sycl> abb; - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1/4.0); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.5; p_pos.at({{1u}}) = dim_y * 0.5; } - component> opa{p_pos,rad,eps}; + component> opa{p_pos,rad,eps}; - component> fg; + component> fg; - component,encode::Sycl> flow_in{ - [&]() -> saw::data>{ - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data>{ + kel::lbm::data> vel; uint64_t target_t_i = 8u; if(t_i.get() < target_t_i){ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get(); @@ -224,10 +223,10 @@ saw::error_or step( return vel; }() }; - 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]); } @@ -272,13 +271,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; @@ -295,7 +294,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"); } } @@ -308,15 +307,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -348,8 +348,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -368,11 +368,11 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -383,10 +383,10 @@ saw::error_or lbm_main(int argc, char** argv){ sycl_q.wait(); // 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]); } @@ -427,7 +427,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; diff --git a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp index 6b86c68..652309c 100644 --- a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp @@ -17,7 +17,6 @@ constexpr uint64_t dim_x = dim_y * 2ul; // constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; @@ -60,9 +59,9 @@ using MacroStruct = Struct< } template -saw::error_or setup_initial_conditions( - saw::data>& fields, - saw::data>& macros +kel::lbm::error_or setup_initial_conditions( + kel::lbm::data>& fields, + kel::lbm::data>& macros ){ auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); @@ -159,14 +158,14 @@ saw::error_or setup_initial_conditions( {{1u,1u}} ); - 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 t_i, +kel::lbm::error_or step( + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -174,25 +173,25 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8}; - component> collision{0.8}; - component> bb; - component,encode::Sycl> abb; + component> bgk{0.8}; + component> collision{0.8}; + component> bb; + component,encode::Sycl> abb; - saw::data> eps; + kel::lbm::data> eps; eps.at({}).set(1.5f); - saw::data> rad; + kel::lbm::data> rad; rad.at({}).set(dim_y*0.1 / 4.0); - saw::data> p_pos; + kel::lbm::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.5; p_pos.at({{1u}}) = dim_y * 0.5; } - component> opa{p_pos,rad,eps}; + component> opa{p_pos,rad,eps}; - component,encode::Sycl> flow_in{ - [&]() -> saw::data>{ - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data>{ + kel::lbm::data> vel; uint64_t target_t_i = 8u; if(t_i.get() < target_t_i){ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get(); @@ -202,12 +201,12 @@ saw::error_or step( return vel; }() }; - component,encode::Sycl> flow_out{1.0}; + component,encode::Sycl> flow_out{1.0}; - component> fg; + component> fg; 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]); } @@ -253,13 +252,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; @@ -276,7 +275,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"); } } @@ -289,15 +288,16 @@ 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>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); 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}; @@ -329,8 +329,8 @@ 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}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -349,11 +349,11 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - 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,i,dev); @@ -396,10 +396,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]); } @@ -441,7 +441,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; diff --git a/examples/throat_clog_2d/common.hpp b/examples/throat_clog_2d/common.hpp index 15fe08a..d74b2f9 100644 --- a/examples/throat_clog_2d/common.hpp +++ b/examples/throat_clog_2d/common.hpp @@ -28,7 +28,6 @@ constexpr uint64_t dim_x = dim_y * 4ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; diff --git a/examples/throat_clog_2d/init.hpp b/examples/throat_clog_2d/init.hpp index 68b2aaa..f76cd67 100644 --- a/examples/throat_clog_2d/init.hpp +++ b/examples/throat_clog_2d/init.hpp @@ -6,11 +6,11 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ (void) conv; @@ -44,11 +44,11 @@ saw::error_or init( auto w2 = w * 0.5; auto h4 = h * 0.25; - saw::data e{0.1}; - saw::data c = w * (saw::data{1.0} - e) * 0.5; + kel::lbm::data e{0.1}; + kel::lbm::data c = w * (kel::lbm::data{1.0} - e) * 0.5; - saw::data d{0.2}; - auto b = h * (saw::data{1.0} - d) * 0.5; + kel::lbm::data d{0.2}; + auto b = h * (kel::lbm::data{1.0} - d) * 0.5; auto p_r = (c*c + b*b) / (b*2); auto p_r_2 = p_r * p_r; @@ -56,14 +56,14 @@ saw::error_or init( auto p_i = p_r - b; // Circle Top - saw::data> top_pos; + kel::lbm::data> top_pos; { top_pos.at({0u}) = w2.get(); top_pos.at({1u}) = (h + p_i).get(); } // Circle Bot - saw::data> bot_pos; + kel::lbm::data> bot_pos; { bot_pos.at({0u}) = w2.get(); bot_pos.at({1u}) = -p_i.get(); @@ -80,11 +80,11 @@ saw::error_or init( bp_diff.at(i) = bot_pos.at(i) - index.at(i).template cast_to(); } - auto tpd_v = saw::math::vectorize_data(tp_diff); - auto tpd_dot = saw::math::dot(tpd_v,tpd_v); + auto tpd_v = kel::lbm::math::vectorize_data(tp_diff); + auto tpd_dot = kel::lbm::math::dot(tpd_v,tpd_v); - auto bpd_v = saw::math::vectorize_data(bp_diff); - auto bpd_dot = saw::math::dot(bpd_v,bpd_v); + auto bpd_v = kel::lbm::math::vectorize_data(bp_diff); + auto bpd_dot = kel::lbm::math::dot(bpd_v,bpd_v); if( (tpd_dot.at({}).template cast_to() <= p_r_2 ) or @@ -157,10 +157,10 @@ saw::error_or init( ); { - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get()); std::cout<<"RADIUS: "<> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); particles = create_spheroid_particle_group(radius_p, dense_p, {{64u}}); auto& parts = particles.template get<"particles">(); @@ -177,7 +177,7 @@ saw::error_or init( } } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/throat_clog_2d/sim.cpp b/examples/throat_clog_2d/sim.cpp index 4084353..118e1b1 100644 --- a/examples/throat_clog_2d/sim.cpp +++ b/examples/throat_clog_2d/sim.cpp @@ -8,7 +8,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< Member @@ -22,7 +21,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -41,7 +40,7 @@ saw::error_or lbm_main(const saw::data& args){ 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"); } } @@ -54,16 +53,17 @@ saw::error_or lbm_main(const saw::data& args){ print_lbm_meta(conv,{1e-3},{1e-4},{0.2 * 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>>(); + // 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>>(); 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}; @@ -101,9 +101,9 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - 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}; sycl_q.wait(); { @@ -129,11 +129,11 @@ saw::error_or lbm_main(const saw::data& args){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); - saw::data time_steps{256u*512ul}; + kel::lbm::data time_steps{256u*512ul}; 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(conv,lsd_view,lsdm_view,lsdp_view,i,dev); @@ -159,10 +159,10 @@ saw::error_or lbm_main(const saw::data& args){ } // 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]); } @@ -203,16 +203,16 @@ saw::error_or lbm_main(const saw::data& args){ } } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); if(eov.is_error()){ @@ -222,11 +222,11 @@ saw::error_or k_main(int argc, char** argv){ auto& an = args.template get<"args">(); auto& coupling = an.template get<"coupling">(); - auto resolution_resolve = [&]() -> saw::error_or{ + auto resolution_resolve = [&]() -> kel::lbm::error_or{ return lbm_main(args); }; - auto coupling_resolve = [&]() -> saw::error_or { + auto coupling_resolve = [&]() -> kel::lbm::error_or { if(coupling.stl_view() == "hlbm"){ return resolution_resolve.template operator()(); } else if(coupling.stl_view() == "fplbm"){ @@ -238,7 +238,7 @@ saw::error_or k_main(int argc, char** argv){ return coupling_resolve(); - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/throat_clog_2d/step.hpp b/examples/throat_clog_2d/step.hpp index dab9178..840f8ba 100644 --- a/examples/throat_clog_2d/step.hpp +++ b/examples/throat_clog_2d/step.hpp @@ -6,15 +6,15 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, + 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 ){ - static constexpr saw::data sub_steps{0u}; + static constexpr kel::lbm::data sub_steps{0u}; auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); @@ -22,9 +22,9 @@ saw::error_or step( if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_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]); } @@ -33,10 +33,10 @@ saw::error_or step( }); }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_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]); } @@ -46,12 +46,12 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> collision{0.8201}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> collision{0.8201}; + component> bb; + 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]); } @@ -69,10 +69,10 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; - saw::data scale; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; + kel::lbm::data scale; { scale.set([&](){ if(t_i.get() > 1024u){ @@ -84,7 +84,7 @@ saw::error_or step( } { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((0.1 / 0.64) * y_si.get() - (0.1 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle() * scale; + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((0.1 / 0.64) * y_si.get() - (0.1 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle() * scale; vel.at({{1u}}) = 0.0f; } return vel; @@ -105,9 +105,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ 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]); } @@ -117,11 +117,11 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - saw::data> grav; - component> fplbm_one_part{grav}; + kel::lbm::data> grav; + component> fplbm_one_part{grav}; 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]); } @@ -132,13 +132,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8201}; - component> collision{0.8201}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{0.8201}; + component> collision{0.8201}; + component> bb; + 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]); } @@ -156,12 +156,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((0.01 / 0.64) * y_si.get() - (0.01 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((0.01 / 0.64) * y_si.get() - (0.01 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -182,9 +182,9 @@ saw::error_or step( }).wait(); }else if constexpr ( std::is_same_v ){ 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 +194,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,13 +208,13 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8201}; - component> collision{0.8201}; - component> bb; - component,encode::Sycl> flow_out{1.0}; + component> bgk{0.8201}; + component> collision{0.8201}; + component> bb; + 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]); } @@ -232,12 +232,12 @@ saw::error_or step( break; case 3u: { - component,encode::Sycl> flow_in{ - [&]() -> saw::data> { - saw::data> vel; + component,encode::Sycl> flow_in{ + [&]() -> kel::lbm::data> { + kel::lbm::data> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.64) * y_si.get() - (1.2 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::type>((1.2 / 0.64) * y_si.get() - (1.2 / (0.64*0.64)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -259,7 +259,7 @@ saw::error_or step( } - return saw::make_void(); + return kel::lbm::make_void(); } } -- cgit v1.3.1