diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-05 09:47:57 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-05 09:47:57 +0100 |
| commit | f5c40005f576b5a3416c2cda8c60e5f100810ddb (patch) | |
| tree | b31b25624f409a75b6a8bd3801cd01d82649bf9a | |
| parent | e07e0b767849d8bb57c0ffef56e0e8b88c7e3937 (diff) | |
| download | libs-lbm-f5c40005f576b5a3416c2cda8c60e5f100810ddb.tar.gz | |
Dangling changes
| -rw-r--r-- | default.nix | 14 | ||||
| -rw-r--r-- | examples/poiseulle_3d/poiseulle_3d.cpp | 50 | ||||
| -rwxr-xr-x | util/build.sh | 4 |
3 files changed, 66 insertions, 2 deletions
diff --git a/default.nix b/default.nix index 5f7dc1b..287ec0a 100644 --- a/default.nix +++ b/default.nix @@ -69,4 +69,18 @@ in rec { debug = { inherit adaptive-cpp; }; + + release = { + dev = { + inherit lbm; + }; + + examples = pkgs.symlinkJoin { + name = "kel-lbm-sims-${version}"; + paths = [ + lbm + examples.cavity_2d_gpu + ]; + }; + }; } diff --git a/examples/poiseulle_3d/poiseulle_3d.cpp b/examples/poiseulle_3d/poiseulle_3d.cpp index 9220a1f..e6d0a61 100644 --- a/examples/poiseulle_3d/poiseulle_3d.cpp +++ b/examples/poiseulle_3d/poiseulle_3d.cpp @@ -50,6 +50,56 @@ public: return inner_.internal_data(); } }; + +template<typename Desc, typename CellT, typename Encode> +class data<schema::Ref<kel::lbm::sch::CellField<Desc, CellT>>, encode::Sycl<Encode>> final { +public: + using Schema = schema::Ref<kel::lbm::sch::CellField<Desc,CellT>>; + using MetaSchema = typename meta_schema<Schema>::MetaSchema; +private: + data<schema::Array<CellT,Desc::D>, Encode>* inner_ref_; + data<schema::UInt64, Encode> size_; +public: + data() = delete; + data(data<MetaSchema,Encode>& inner_meta__, acpp::sycl::queue& q): + inner_{inner_meta__,q} + {} + + const data<MetaSchema, Encode> meta() const { + return inner_.dims(); + } + + template<uint64_t i> + data<schema::UInt64,Encode> get_dim_size() const { + static_assert(i < Desc::D, "Not enough dimensions"); + return inner_.template get_dim_size<i>(); + } + + const data<CellT>& operator()(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index)const{ + return inner_.at(index); + } + + data<CellT>& operator()(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index){ + return inner_.at(index); + } + + const data<CellT>& at(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index)const{ + return inner_.at(index); + } + + data<CellT>& at(const data<schema::FixedArray<schema::UInt64, Desc::D>, Encode>& index){ + return inner_.at(index); + } + + data<schema::UInt64,Encode> internal_size() const { + return inner_.internal_size(); + } + + data<CellT,Encode>* internal_data() { + return inner_.internal_data(); + } +}; + } namespace kel { diff --git a/util/build.sh b/util/build.sh index d6d0a8d..40fcae5 100755 --- a/util/build.sh +++ b/util/build.sh @@ -30,7 +30,7 @@ podman run --rm -it \ set -euo pipefail # Build the derivation - nix-build default.nix --out-link result + nix-build default.nix -A release.examples --out-link result # Install fpm if missing if ! command -v fpm >/dev/null 2>&1; then @@ -41,7 +41,7 @@ podman run --rm -it \ nix-shell -p fpm --run \"fpm -s dir -t deb -n \$PKG_NAME -v \$PKG_VERSION -C result --prefix /usr/local .\" # Create .rpm package - nix-shell -p fpm rpm --run \"fpm -s dir -t rpm -n \$PKG_NAME -v \$PKG_VERSION -C result --prefix /usr/local .\" + # nix-shell -p fpm rpm --run \"fpm -s dir -t rpm -n \$PKG_NAME -v \$PKG_VERSION -C result --prefix /usr/local .\" " echo "✅ Build complete!" |
