summaryrefslogtreecommitdiff
path: root/examples/poiseulle_3d_gpu/sim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/poiseulle_3d_gpu/sim.cpp')
-rw-r--r--examples/poiseulle_3d_gpu/sim.cpp64
1 files changed, 32 insertions, 32 deletions
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<UInt8, 0u, dim_x, dim_y, dim_z>;
@@ -53,11 +52,11 @@ using MacroStruct = Struct<
}
template<typename T, typename Desc>
-saw::error_or<void> setup_initial_conditions(
+kel::lbm::error_or<void> setup_initial_conditions(
converter<T>& conv,
- saw::data<sch::ChunkStruct<T,Desc>>& fields,
- saw::data<sch::MacroStruct<T,Desc>>& macros,
- saw::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>& particles
+ kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields,
+ kel::lbm::data<sch::MacroStruct<T,Desc>>& macros,
+ kel::lbm::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>& particles
){
auto& info_f = fields.template get<"info">();
// Set everything as walls
@@ -135,19 +134,19 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u,1u}}
);
- for(saw::data<sch::UInt64> i{0u}; i < saw::data<sch::UInt64>{particle_size}; ++i){
+ for(kel::lbm::data<sch::UInt64> i{0u}; i < kel::lbm::data<sch::UInt64>{particle_size}; ++i){
auto& part = particles.at(i);
}
- return saw::make_void();
+ return kel::lbm::make_void();
}
template<typename T, typename Desc>
-saw::error_or<void> step(
+kel::lbm::error_or<void> step(
converter<T>& conv,
- saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
- saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
- saw::data<sch::UInt64> t_i,
+ kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields,
+ kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros,
+ kel::lbm::data<sch::UInt64> t_i,
device& dev
){
auto& q = dev.get_handle();
@@ -156,11 +155,11 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
// Need nicer things to handle the flow. I see improvement here
- component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> collision{conv.template kinematic_viscosity_si_to_tau<Desc>({0.1}).handle()};
- // component<T,Desc,cmpt::HLBM,encode::Sycl<saw::encode::Native>> collision{0.6};
- component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::BGK, encode::Sycl<kel::lbm::enc::Native>> collision{conv.template kinematic_viscosity_si_to_tau<Desc>({0.1}).handle()};
+ // component<T,Desc,cmpt::HLBM,encode::Sycl<kel::lbm::enc::Native>> collision{0.6};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{
[&](){
uint64_t target_t_i = 256u;
if(t_i.get() < target_t_i){
@@ -169,10 +168,10 @@ saw::error_or<void> step(
return 1.001;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y,dim_z}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -203,10 +202,10 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
+ component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream;
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y,dim_z}, [=](acpp::sycl::id<Desc::D> idx){
- saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
+ kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
@@ -226,13 +225,13 @@ saw::error_or<void> step(
}).wait();
*/
- return saw::make_void();
+ return kel::lbm::make_void();
}
}
}
template<typename T, typename Desc>
-saw::error_or<void> lbm_main(int argc, char** argv){
+kel::lbm::error_or<void> lbm_main(int argc, char** argv){
using namespace kel::lbm;
using dfi = df_info<T,Desc>;
@@ -249,7 +248,7 @@ saw::error_or<void> 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<saw::err::critical>("Could not create output directory");
+ return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory");
}
}
@@ -262,15 +261,16 @@ saw::error_or<void> lbm_main(int argc, char** argv){
print_lbm_meta<T,Desc>(conv,{0.1},{0.01},{1024.0});
- auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
- auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>();
- auto lbm_particle_data_ptr = saw::heap<saw::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>>();
+ auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>();
+ auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>();
+ auto lbm_particle_data_ptr = kel::lbm::heap<kel::lbm::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>>>();
std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl;
auto eo_aio = saw::setup_async_io();
if(eo_aio.is_error()){
- return std::move(eo_aio.get_error());
+ return kel::lbm::make_error<kel::lbm::err::critical>(
+ 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<void> lbm_main(int argc, char** argv){
}
}
- saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q};
- saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q};
- saw::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>, encode::Sycl<saw::encode::Native>> lbm_sycl_particle_data{sycl_q};
+ kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q};
+ kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q};
+ kel::lbm::data<sch::FixedArray<sch::Particle<T,Desc::D>, particle_size>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_particle_data{sycl_q};
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
@@ -322,9 +322,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
sycl_q.wait();
- saw::data<sch::UInt64> time_steps{2048ul};
+ kel::lbm::data<sch::UInt64> time_steps{2048ul};
- for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
+ for(kel::lbm::data<sch::UInt64> 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<void> lbm_main(int argc, char** argv){
*/
sycl_q.wait();
- return saw::make_void();
+ return kel::lbm::make_void();
}
using FloatT = kel::lbm::sch::Float32;