From 461022ee5135a3bfcca4659cf73fadccc0594d3f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 10 Sep 2025 15:29:40 +0200 Subject: Moving towards gpu --- examples/cavity_2d_gpu/.nix/derivation.nix | 9 +++++++-- examples/cavity_2d_gpu/SConscript | 21 ++++++--------------- examples/cavity_2d_gpu/cavity_2d_gpu.cpp | 14 ++++---------- 3 files changed, 17 insertions(+), 27 deletions(-) (limited to 'examples') diff --git a/examples/cavity_2d_gpu/.nix/derivation.nix b/examples/cavity_2d_gpu/.nix/derivation.nix index a98795b..876bcb7 100644 --- a/examples/cavity_2d_gpu/.nix/derivation.nix +++ b/examples/cavity_2d_gpu/.nix/derivation.nix @@ -3,12 +3,15 @@ , scons , clang-tools , forstio +, adaptive-cpp , pname , version +, kel-lbm }: stdenv.mkDerivation { - inherit pname version; + pname = pname + "-examples-" + "cavity_2d_gpu"; + inherit version; src = ./..; nativeBuildInputs = [ @@ -21,7 +24,9 @@ stdenv.mkDerivation { forstio.async forstio.codec forstio.codec-unit - forstio.codec-json + forstio.codec-json + adaptive-cpp + kel-lbm ]; doCheck = true; diff --git a/examples/cavity_2d_gpu/SConscript b/examples/cavity_2d_gpu/SConscript index 077fb99..15b013d 100644 --- a/examples/cavity_2d_gpu/SConscript +++ b/examples/cavity_2d_gpu/SConscript @@ -10,7 +10,7 @@ Import('env') dir_path = Dir('.').abspath # Environment for base library -cavity2d_env = examples_env.Clone(); +examples_env = env.Clone(); examples_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) examples_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) @@ -20,22 +20,13 @@ env.headers += examples_env.headers; # Cavity2D examples_objects = []; -examples_env.add_source_files(examples_objects, ['cavity_2d.cpp'], shared=False); -examples_env.cavity_2d = examples_env.Program('#bin/cavity_2d', [env.library_static, examples_objects]); +examples_env.add_source_files(examples_objects, ['cavity_2d_gpu.cpp'], shared=False); +examples_env.cavity_2d_gpu = examples_env.Program('#bin/cavity_2d_gpu', [examples_objects]); # Set Alias env.examples = [ - examples_env.meta_2d, -# examples_env.cavity_2d, -# examples_env.cavity_3d, -# examples_env.particle_ibm_2d - examples_env.poiseulle_2d, - examples_env.poiseulle_channel_2d, - examples_env.poiseulle_particles_channel_2d + examples_env.cavity_2d_gpu ]; env.Alias('examples', env.examples); - -if env["build_examples"]: - env.targets += ['examples']; - env.Install('$prefix/bin/', env.examples); -#endif +env.targets += ['examples']; +env.Install('$prefix/bin/', env.examples); diff --git a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp index a72cc6a..dc022a1 100644 --- a/examples/cavity_2d_gpu/cavity_2d_gpu.cpp +++ b/examples/cavity_2d_gpu/cavity_2d_gpu.cpp @@ -1,9 +1,4 @@ -#include "../c++/descriptor.hpp" -#include "../c++/macroscopic.hpp" -#include "../c++/lbm.hpp" -#include "../c++/component.hpp" -#include "../c++/collision.hpp" -#include "../c++/boundary.hpp" +#include #include // #include ; using D2Q9 = Descriptor<2u,9u>; template using DfCell = Cell; template -using CellInfo = Cell; +using CellInfo = Cell; /** * Basic type for simulation @@ -217,11 +211,11 @@ void lbm_step( switch(info({0u}).get()){ case 1u: { - coll.apply(latt, index, time_step); + bb.apply(latt, index, time_step); break; } case 2u: { - bb.apply(latt, index, time_step); + coll.apply(latt, index, time_step); break; } default: -- cgit v1.2.3