From e9fc9f329589feb902fd1c982d9fa55bd69d81ea Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 7 Jan 2026 11:21:49 +0100 Subject: Renaming folder --- default.nix | 5 ++ examples/particles/.nix/derivation.nix | 37 -------------- examples/particles/SConscript | 34 ------------- examples/particles/SConstruct | 82 ------------------------------ examples/particles/particles_gpu.cpp | 1 - examples/particles_gpu/.nix/derivation.nix | 37 ++++++++++++++ examples/particles_gpu/SConscript | 34 +++++++++++++ examples/particles_gpu/SConstruct | 82 ++++++++++++++++++++++++++++++ examples/particles_gpu/particles_gpu.cpp | 42 +++++++++++++++ 9 files changed, 200 insertions(+), 154 deletions(-) delete mode 100644 examples/particles/.nix/derivation.nix delete mode 100644 examples/particles/SConscript delete mode 100644 examples/particles/SConstruct delete mode 100644 examples/particles/particles_gpu.cpp create mode 100644 examples/particles_gpu/.nix/derivation.nix create mode 100644 examples/particles_gpu/SConscript create mode 100644 examples/particles_gpu/SConstruct create mode 100644 examples/particles_gpu/particles_gpu.cpp diff --git a/default.nix b/default.nix index 8724de1..2f97e99 100644 --- a/default.nix +++ b/default.nix @@ -73,6 +73,11 @@ in rec { inherit kel-lbm; }; + particles_gpu = pkgs.callPackage ./examples/particles_gpu/.nix/derivation.nix { + inherit pname version stdenv forstio adaptive-cpp; + inherit kel-lbm; + }; + heterogeneous_computing = pkgs.callPackage ./examples/heterogeneous_computing/.nix/derivation.nix { inherit pname version stdenv forstio adaptive-cpp; inherit kel-lbm; diff --git a/examples/particles/.nix/derivation.nix b/examples/particles/.nix/derivation.nix deleted file mode 100644 index 227132f..0000000 --- a/examples/particles/.nix/derivation.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ lib -, stdenv -, scons -, clang-tools -, forstio -, python3 -, pname -, version -, kel-lbm -, adaptive-cpp -}: - -stdenv.mkDerivation { - pname = pname + "-examples-" + "particles"; - inherit version; - src = ./..; - - nativeBuildInputs = [ - scons - clang-tools - python3 - ]; - - buildInputs = [ - forstio.core - forstio.async - forstio.codec - forstio.codec-unit - forstio.codec-json - kel-lbm.core - adaptive-cpp - ]; - - preferLocalBuild = true; - - outputs = [ "out" "dev" ]; -} diff --git a/examples/particles/SConscript b/examples/particles/SConscript deleted file mode 100644 index f22fdf2..0000000 --- a/examples/particles/SConscript +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/false - -import os -import os.path -import glob - - -Import('env') - -dir_path = Dir('.').abspath - -# Environment for base library -examples_env = env.Clone(); -examples_env['CXX'] = 'syclcc-clang'; -examples_env['CXXFLAGS'] += ['-O3']; - -examples_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) -examples_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) - -env.sources += examples_env.sources; -env.headers += examples_env.headers; - -# Cavity2D -examples_objects = []; -examples_env.add_source_files(examples_objects, ['particles_gpu.cpp'], shared=False); -examples_env.particles_gpu = examples_env.Program('#bin/particles_gpu', [examples_objects]); - -# Set Alias -env.examples = [ - examples_env.particles_gpu -]; -env.Alias('examples', env.examples); -env.targets += ['examples']; -env.Install('$prefix/bin/', env.examples); diff --git a/examples/particles/SConstruct b/examples/particles/SConstruct deleted file mode 100644 index fe206e1..0000000 --- a/examples/particles/SConstruct +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os -import os.path -import glob -import re - - -if sys.version_info < (3,): - def isbasestring(s): - return isinstance(s,basestring) -else: - def isbasestring(s): - return isinstance(s, (str,bytes)) - -def add_kel_source_files(self, sources, filetype, lib_env=None, shared=False, target_post=""): - - if isbasestring(filetype): - dir_path = self.Dir('.').abspath - filetype = sorted(glob.glob(dir_path+"/"+filetype)) - - for path in filetype: - target_name = re.sub( r'(.*?)(\.cpp|\.c\+\+)', r'\1' + target_post, path ) - if shared: - target_name+='.os' - sources.append( self.SharedObject( target=target_name, source=path ) ) - else: - target_name+='.o' - sources.append( self.StaticObject( target=target_name, source=path ) ) - pass - -def isAbsolutePath(key, dirname, env): - assert os.path.isabs(dirname), "%r must have absolute path syntax" % (key,) - -env_vars = Variables( - args=ARGUMENTS -) - -env_vars.Add('prefix', - help='Installation target location of build results and headers', - default='/usr/local/', - validator=isAbsolutePath -) - -env_vars.Add('build_examples', - help='If examples should be built', - default="true" -) - -env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], - CPPDEFINES=['SAW_UNIX'], - CXXFLAGS=[ - '-std=c++20', - '-g', - '-Wall', - '-Wextra', - '-isystem', 'AdaptiveCpp' - ], - LIBS=[ - 'forstio-core', - 'acpp-rt', - 'omp' - ] -); -env.__class__.add_source_files = add_kel_source_files -env.Tool('compilation_db'); -env.cdb = env.CompilationDatabase('compile_commands.json'); - -env.objects = []; -env.sources = []; -env.headers = []; -env.targets = []; - -Export('env') -SConscript('SConscript') - -env.Alias('cdb', env.cdb); -env.Alias('all', [env.targets]); -env.Default('all'); - -env.Alias('install', '$prefix') diff --git a/examples/particles/particles_gpu.cpp b/examples/particles/particles_gpu.cpp deleted file mode 100644 index 8b13789..0000000 --- a/examples/particles/particles_gpu.cpp +++ /dev/null @@ -1 +0,0 @@ - diff --git a/examples/particles_gpu/.nix/derivation.nix b/examples/particles_gpu/.nix/derivation.nix new file mode 100644 index 0000000..227132f --- /dev/null +++ b/examples/particles_gpu/.nix/derivation.nix @@ -0,0 +1,37 @@ +{ lib +, stdenv +, scons +, clang-tools +, forstio +, python3 +, pname +, version +, kel-lbm +, adaptive-cpp +}: + +stdenv.mkDerivation { + pname = pname + "-examples-" + "particles"; + inherit version; + src = ./..; + + nativeBuildInputs = [ + scons + clang-tools + python3 + ]; + + buildInputs = [ + forstio.core + forstio.async + forstio.codec + forstio.codec-unit + forstio.codec-json + kel-lbm.core + adaptive-cpp + ]; + + preferLocalBuild = true; + + outputs = [ "out" "dev" ]; +} diff --git a/examples/particles_gpu/SConscript b/examples/particles_gpu/SConscript new file mode 100644 index 0000000..f22fdf2 --- /dev/null +++ b/examples/particles_gpu/SConscript @@ -0,0 +1,34 @@ +#!/bin/false + +import os +import os.path +import glob + + +Import('env') + +dir_path = Dir('.').abspath + +# Environment for base library +examples_env = env.Clone(); +examples_env['CXX'] = 'syclcc-clang'; +examples_env['CXXFLAGS'] += ['-O3']; + +examples_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +examples_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) + +env.sources += examples_env.sources; +env.headers += examples_env.headers; + +# Cavity2D +examples_objects = []; +examples_env.add_source_files(examples_objects, ['particles_gpu.cpp'], shared=False); +examples_env.particles_gpu = examples_env.Program('#bin/particles_gpu', [examples_objects]); + +# Set Alias +env.examples = [ + examples_env.particles_gpu +]; +env.Alias('examples', env.examples); +env.targets += ['examples']; +env.Install('$prefix/bin/', env.examples); diff --git a/examples/particles_gpu/SConstruct b/examples/particles_gpu/SConstruct new file mode 100644 index 0000000..fe206e1 --- /dev/null +++ b/examples/particles_gpu/SConstruct @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 + +import sys +import os +import os.path +import glob +import re + + +if sys.version_info < (3,): + def isbasestring(s): + return isinstance(s,basestring) +else: + def isbasestring(s): + return isinstance(s, (str,bytes)) + +def add_kel_source_files(self, sources, filetype, lib_env=None, shared=False, target_post=""): + + if isbasestring(filetype): + dir_path = self.Dir('.').abspath + filetype = sorted(glob.glob(dir_path+"/"+filetype)) + + for path in filetype: + target_name = re.sub( r'(.*?)(\.cpp|\.c\+\+)', r'\1' + target_post, path ) + if shared: + target_name+='.os' + sources.append( self.SharedObject( target=target_name, source=path ) ) + else: + target_name+='.o' + sources.append( self.StaticObject( target=target_name, source=path ) ) + pass + +def isAbsolutePath(key, dirname, env): + assert os.path.isabs(dirname), "%r must have absolute path syntax" % (key,) + +env_vars = Variables( + args=ARGUMENTS +) + +env_vars.Add('prefix', + help='Installation target location of build results and headers', + default='/usr/local/', + validator=isAbsolutePath +) + +env_vars.Add('build_examples', + help='If examples should be built', + default="true" +) + +env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CPPDEFINES=['SAW_UNIX'], + CXXFLAGS=[ + '-std=c++20', + '-g', + '-Wall', + '-Wextra', + '-isystem', 'AdaptiveCpp' + ], + LIBS=[ + 'forstio-core', + 'acpp-rt', + 'omp' + ] +); +env.__class__.add_source_files = add_kel_source_files +env.Tool('compilation_db'); +env.cdb = env.CompilationDatabase('compile_commands.json'); + +env.objects = []; +env.sources = []; +env.headers = []; +env.targets = []; + +Export('env') +SConscript('SConscript') + +env.Alias('cdb', env.cdb); +env.Alias('all', [env.targets]); +env.Default('all'); + +env.Alias('install', '$prefix') diff --git a/examples/particles_gpu/particles_gpu.cpp b/examples/particles_gpu/particles_gpu.cpp new file mode 100644 index 0000000..2104a88 --- /dev/null +++ b/examples/particles_gpu/particles_gpu.cpp @@ -0,0 +1,42 @@ +#include +#include + + +#include +#include + +namespace kel{ +namespace lbm { +namespace sch { +using namespace saw::schema; +} +} + +saw::error_or lbm_main(int argc, char** argv){ + (void) argc; + (void) argv; + + using namespace lbm; + using namespace acpp; + + saw::data>> particles{256u}; + + return saw::make_void(); +} +} + +int main(int argc, char** argv){ + auto eov = kel::lbm_main(argc, argv); + if(eov.is_error()){ + auto& err = eov.get_error(); + std::cerr<<"[Error] "< 0u){ + std::cerr<<" - "<