diff options
Diffstat (limited to 'examples/heterogeneous_computing')
| -rw-r--r-- | examples/heterogeneous_computing/.nix/derivation.nix | 41 | ||||
| -rw-r--r-- | examples/heterogeneous_computing/README.md | 7 | ||||
| -rw-r--r-- | examples/heterogeneous_computing/SConscript | 34 | ||||
| -rw-r--r-- | examples/heterogeneous_computing/SConstruct | 82 | ||||
| -rw-r--r-- | examples/heterogeneous_computing/sim.cpp | 95 |
5 files changed, 0 insertions, 259 deletions
diff --git a/examples/heterogeneous_computing/.nix/derivation.nix b/examples/heterogeneous_computing/.nix/derivation.nix deleted file mode 100644 index bf824bf..0000000 --- a/examples/heterogeneous_computing/.nix/derivation.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ lib -, stdenv -, scons -, clang-tools -, forstio -, pname -, version -, adaptive-cpp -, kel -}: - -stdenv.mkDerivation { - pname = pname + "-examples-" + "heterogeneous_computing"; - inherit version; - src = ./..; - - nativeBuildInputs = [ - scons - clang-tools - ]; - - buildInputs = [ - forstio.core - forstio.async - forstio.io - forstio.io_codec - forstio.codec - forstio.codec-unit - forstio.codec-json - forstio.remote - forstio.remote-filesystem - forstio.remote-io - forstio.remote-sycl - kel.lbm.core - adaptive-cpp - ]; - - preferLocalBuild = true; - - outputs = [ "out" "dev" ]; -} diff --git a/examples/heterogeneous_computing/README.md b/examples/heterogeneous_computing/README.md deleted file mode 100644 index 16463e6..0000000 --- a/examples/heterogeneous_computing/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Heterogeneous - -This is more intended as a thinking ground for a solution to LBM integrations for distributed computing. -In the end MPI does it correctly in a sense I would almost ask to separate in blocks. -But I want to learn, so no MPI. -Or rather MPI abstracted away. -MPI also has some discovery issues in edge cases where the network is a bit more complex. diff --git a/examples/heterogeneous_computing/SConscript b/examples/heterogeneous_computing/SConscript deleted file mode 100644 index 226185b..0000000 --- a/examples/heterogeneous_computing/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, ['sim.cpp'], shared=False); -examples_env.heterogeneous_computing = examples_env.Program('#bin/heterogeneous_computing', [examples_objects]); - -# Set Alias -env.examples = [ - examples_env.heterogeneous_computing -]; -env.Alias('examples', env.examples); -env.targets += ['examples']; -env.Install('$prefix/bin/', env.examples); diff --git a/examples/heterogeneous_computing/SConstruct b/examples/heterogeneous_computing/SConstruct deleted file mode 100644 index fe206e1..0000000 --- a/examples/heterogeneous_computing/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/heterogeneous_computing/sim.cpp b/examples/heterogeneous_computing/sim.cpp deleted file mode 100644 index 61058be..0000000 --- a/examples/heterogeneous_computing/sim.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include <forstio/error.hpp> -#include <iostream> - -#include <kel/lbm/lbm.hpp> - -namespace kel { -namespace lbm { -namespace sch { - -/** - * struct lbm_data { - * std::array<std::array<float,9>, 64u*64u> dfs; - * std::array<uint8_t, 64u*64u> info; - * }; - * - * which leads to the form - * - * template<uint64_t Dim, uint64_t Size> - * struct lbm_data { - * std::array<std::array<float,9>, Size*Size> dfs; - * std::array<uint8_t, Size*Size> info; - * }; - * - * which transferred into sycl requires us to go to - * - * template<uint64_t Dim, uint64_t Size> - * struct lbm_sycl_data { - * std::array<float,9>* dfs; - * uint8_t* info; - * }; - * - * in data form on host - * - * template<uint64_t Dim, uint64_t Size> - * using LbmData = Struct< - * Member<FixedArray<FixedArray<Float32,9u>, Size*Size>, "dfs">, - * Member<FixedArray<UInt8, Size*Size>, "info"> - * >; - * - * If we specialize the encode::Sycl<Encoding> data type, then we get - * With a helper class we can copy single values back and forth and the whole block is guaranteed - * to be allocated. And this one can be dynamic while the host definition might be compile time. - * - * template<...> - * class data<LbmData<...>,encode::Sycl<Encoding>> final { - * kel::lbm::data<sch::FixedArray<sch::UInt64,Dim>> meta; - * kel::lbm::data<FixedArray<Float32u,9>>* dfs; - * kel::lbm::data<UInt8>* info; - * }; - */ - -template<typename T, typename Desc> -using CellStruct = Struct< - Member<Chunk<FixedArray<T,Desc::Q>,Desc::D, "dfs">, - Member<FixedArray<T,Desc::Q>, "dfs_old">, - Member<UInt8, "info"> ->; - -} -template<typename T, typename Desc> -kel::lbm::error_or<void> simulate(int argc, char** argv, - const kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>>& meta -{ - constexpr auto cell_size = sizeof(kel::lbm::data<sch::CellStruct<T,Desc>>); - - auto lbm_data = kel::lbm::heap<kel::lbm::data<sch::Chunk<CellStruct<>,Desc::D, 64u>>>{meta}; - - return kel::lbm::make_void(); -} - -} - -kel::lbm::error_or<void> lbm_main(int argc, char** argv){ - using namespace lbm; - return simulate<sch::Float64,sch::D2Q9>(argc, argv); -} -} - -int main(int argc, char** argv){ - auto eov = kel::lbm_main(argc, argv); - if(eov.is_error()){ - auto& err = eov.get_error(); - auto err_msg = err.get_message(); - std::cerr<<"[Error]: "<<err.get_category(); - - if(not err_msg.empty()){ - std::cerr<<" - "<<err_msg; - } - std::cerr<<std::endl; - - return err.get_id(); - } - - return 0; -} |
