diff options
Diffstat (limited to 'poc/web_swarm')
| -rw-r--r-- | poc/web_swarm/SConscript | 34 | ||||
| -rw-r--r-- | poc/web_swarm/SConstruct | 81 | ||||
| -rw-r--r-- | poc/web_swarm/default.nix | 6 | ||||
| -rw-r--r-- | poc/web_swarm/orchestrater/c++/main.cpp | 29 | ||||
| -rw-r--r-- | poc/web_swarm/ui/.nix/derivation.nix | 41 | ||||
| -rw-r--r-- | poc/web_swarm/ui/html/index.html | 0 |
6 files changed, 191 insertions, 0 deletions
diff --git a/poc/web_swarm/SConscript b/poc/web_swarm/SConscript new file mode 100644 index 0000000..64d0b79 --- /dev/null +++ b/poc/web_swarm/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, ['sim.cpp'], shared=False); +examples_env.poiseulle_2d_gpu = examples_env.Program('#bin/kel_lbm_web_swarm', [examples_objects]); + +# Set Alias +env.examples = [ + examples_env.poiseulle_2d_gpu +]; +env.Alias('examples', env.examples); +env.targets += ['examples']; +env.Install('$prefix/bin/', env.examples); diff --git a/poc/web_swarm/SConstruct b/poc/web_swarm/SConstruct new file mode 100644 index 0000000..0611b67 --- /dev/null +++ b/poc/web_swarm/SConstruct @@ -0,0 +1,81 @@ +#!/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' + ], + LIBS=[ + 'forstio-core', + 'forstio-async', + 'forstio-io' + ] +); +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/poc/web_swarm/default.nix b/poc/web_swarm/default.nix new file mode 100644 index 0000000..570debf --- /dev/null +++ b/poc/web_swarm/default.nix @@ -0,0 +1,6 @@ +{ pkgs ? import <nixpkgs> {} +}: + +{ + ui = pkgs.callPackage ./ui/.nix/derivation.nix {}; +} diff --git a/poc/web_swarm/orchestrater/c++/main.cpp b/poc/web_swarm/orchestrater/c++/main.cpp new file mode 100644 index 0000000..b32d5c7 --- /dev/null +++ b/poc/web_swarm/orchestrater/c++/main.cpp @@ -0,0 +1,29 @@ +#include <forstio/codec/args.hpp> + +namespace kel { +namespace sch { +using namespace saw::schema; +} + +saw::error_or<void> kmain(int argc, char** argv){ + saw::data<sch::Args> args; + // Decode the args + { + saw::data<sch::Args,encode::Args> arge; + auto eov = saw::parse_args<sch::Args>(arge,args); + if(eov.is_error()){ + return eov; + } + } + return saw::make_void(); +} + +} + +int main(int argc, char** argv){ + auto eov = kel::kmain(argc,argv); + if(eov.is_error()){ + auto& err = eov.get_error(); + } + return 0; +} diff --git a/poc/web_swarm/ui/.nix/derivation.nix b/poc/web_swarm/ui/.nix/derivation.nix new file mode 100644 index 0000000..8dcabe1 --- /dev/null +++ b/poc/web_swarm/ui/.nix/derivation.nix @@ -0,0 +1,41 @@ +{ lib +, stdenv +, scons +, clang-tools +, forstio +, python3 +, pname +, version +, adaptive-cpp +, kel +}: + +stdenv.mkDerivation { + pname = pname + "-poc-" + "web_swarm_ui"; + inherit version; + src = ./..; + + nativeBuildInputs = [ + scons + clang-tools + python3 + ]; + + buildInputs = [ + forstio.core + forstio.async + forstio.codec + forstio.codec-unit + forstio.io + forstio.remote + forstio.remote-filesystem + forstio.codec-json + adaptive-cpp + kel.lbm.core + kel.lbm.sycl + ]; + + preferLocalBuild = true; + + outputs = [ "out" "dev" ]; +} diff --git a/poc/web_swarm/ui/html/index.html b/poc/web_swarm/ui/html/index.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/poc/web_swarm/ui/html/index.html |
