From 5a746b54b787ae3c45cc347b7bfb5ee278964a30 Mon Sep 17 00:00:00 2001 From: Behzad Safaei <iwia103h@a0522.nhr.fau.de> Date: Thu, 13 Mar 2025 16:43:55 +0100 Subject: [PATCH] Rearrange utility and domain files --- CMakeLists.txt | 20 ++++++++++---------- README.md | 7 +++---- runtime/domain/block_forest.cpp | 2 +- runtime/{ => domain}/boundary_weights.cpp | 0 runtime/{ => domain}/boundary_weights.cu | 0 runtime/{ => domain}/boundary_weights.hpp | 4 ++-- runtime/{ => utility}/copper_fcc_lattice.cpp | 0 runtime/{ => utility}/copper_fcc_lattice.hpp | 0 runtime/{ => utility}/create_body.cpp | 0 runtime/{ => utility}/create_body.hpp | 0 runtime/{ => utility}/dem_sc_grid.cpp | 0 runtime/{ => utility}/dem_sc_grid.hpp | 0 runtime/{ => utility}/read_from_file.cpp | 0 runtime/{ => utility}/read_from_file.hpp | 0 runtime/{ => utility}/stats.cpp | 0 runtime/{ => utility}/stats.hpp | 0 runtime/{ => utility}/thermo.cpp | 0 runtime/{ => utility}/thermo.hpp | 0 runtime/{ => utility}/timing.cpp | 0 runtime/{ => utility}/timing.hpp | 0 runtime/{ => utility}/vtk.cpp | 0 runtime/{ => utility}/vtk.hpp | 0 src/pairs/code_gen/cgen.py | 16 ++++++++-------- 23 files changed, 24 insertions(+), 25 deletions(-) rename runtime/{ => domain}/boundary_weights.cpp (100%) rename runtime/{ => domain}/boundary_weights.cu (100%) rename runtime/{ => domain}/boundary_weights.hpp (86%) rename runtime/{ => utility}/copper_fcc_lattice.cpp (100%) rename runtime/{ => utility}/copper_fcc_lattice.hpp (100%) rename runtime/{ => utility}/create_body.cpp (100%) rename runtime/{ => utility}/create_body.hpp (100%) rename runtime/{ => utility}/dem_sc_grid.cpp (100%) rename runtime/{ => utility}/dem_sc_grid.hpp (100%) rename runtime/{ => utility}/read_from_file.cpp (100%) rename runtime/{ => utility}/read_from_file.hpp (100%) rename runtime/{ => utility}/stats.cpp (100%) rename runtime/{ => utility}/stats.hpp (100%) rename runtime/{ => utility}/thermo.cpp (100%) rename runtime/{ => utility}/thermo.hpp (100%) rename runtime/{ => utility}/timing.cpp (100%) rename runtime/{ => utility}/timing.hpp (100%) rename runtime/{ => utility}/vtk.cpp (100%) rename runtime/{ => utility}/vtk.hpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 963313c..12dcd69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,14 +45,14 @@ file(MAKE_DIRECTORY ${GEN_INTERFACE_DIR}) #================================================================================ set(RUNTIME_COMMON_FILES runtime/pairs.cpp - runtime/copper_fcc_lattice.cpp - runtime/create_body.cpp - runtime/dem_sc_grid.cpp - runtime/read_from_file.cpp - runtime/stats.cpp - runtime/thermo.cpp - runtime/timing.cpp - runtime/vtk.cpp + runtime/utility/copper_fcc_lattice.cpp + runtime/utility/create_body.cpp + runtime/utility/dem_sc_grid.cpp + runtime/utility/read_from_file.cpp + runtime/utility/stats.cpp + runtime/utility/thermo.cpp + runtime/utility/timing.cpp + runtime/utility/vtk.cpp runtime/domain/regular_6d_stencil.cpp) #================================================================================ @@ -106,9 +106,9 @@ if(USE_WALBERLA) # TODO: Generate the host/device functions for computing weights if(COMPILE_CUDA) - list(APPEND RUNTIME_WALBERLA_FILES runtime/boundary_weights.cu) + list(APPEND RUNTIME_WALBERLA_FILES runtime/domain/boundary_weights.cu) else() - list(APPEND RUNTIME_WALBERLA_FILES runtime/boundary_weights.cpp) + list(APPEND RUNTIME_WALBERLA_FILES runtime/domain/boundary_weights.cpp) endif() target_sources(${PAIRS_TARGET} PRIVATE ${RUNTIME_WALBERLA_FILES}) diff --git a/README.md b/README.md index 92db3b5..4d62ccb 100644 --- a/README.md +++ b/README.md @@ -109,18 +109,17 @@ In the following, we assume we have created and navigated to a build directory: **Basic CMake flags:** * Pass your input script to CMake using `-DINPUT_SCRIPT=path/to/script.py` * Enable CUDA with `-DCOMPILE_CUDA=ON` -* Enable support for BlockForest domain partitioning and dynamic load balancing by providing the path to waLBerla source directory `-DWALBERLA_DIR=path/to/walberla` (TODO: waLBerla as a submodule) +* Enable waLBerla support with `-DUSE_WALBERLA=ON` for using BlockForest domain partitioning and dynamic load balancing ### 1. Stand-Alone P4IRS Application --------------------- To build a C++ application using P4IRS, provide the list of your source files to CMake using the `-DUSER_SOURCE_FILES` flag (semicolon-seperated). -**Example**: Build the application [sd_1.cpp](examples/modular/sd_1.cpp) using [spring_dashpot.py](examples/modular/spring_dashpot.py) as the input script. -Note: In this example we assume waLBerla has been already cloned next to the P4IRS directory. +**Example**: Build the application [sd_1.cpp](examples/modular/sd_1.cpp) using [spring_dashpot.py](examples/modular/spring_dashpot.py) as the input script. ``` -cmake -DINPUT_SCRIPT=../examples/modular/spring_dashpot.py -DUSER_SOURCE_FILES=../examples/modular/sd_1.cpp -DWALBERLA_DIR=../../walberla .. +cmake -DINPUT_SCRIPT=../examples/modular/spring_dashpot.py -DUSER_SOURCE_FILES=../examples/modular/sd_1.cpp -DUSE_WALBERLA=ON .. ``` Now call `make` and an **executable** is built. diff --git a/runtime/domain/block_forest.cpp b/runtime/domain/block_forest.cpp index 77c082b..1ad9922 100644 --- a/runtime/domain/block_forest.cpp +++ b/runtime/domain/block_forest.cpp @@ -13,7 +13,7 @@ #include <blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h> #include <blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h> //--- -#include "../boundary_weights.hpp" +#include "boundary_weights.hpp" #include "../pairs_common.hpp" #include "../devices/device.hpp" #include "regular_6d_stencil.hpp" diff --git a/runtime/boundary_weights.cpp b/runtime/domain/boundary_weights.cpp similarity index 100% rename from runtime/boundary_weights.cpp rename to runtime/domain/boundary_weights.cpp diff --git a/runtime/boundary_weights.cu b/runtime/domain/boundary_weights.cu similarity index 100% rename from runtime/boundary_weights.cu rename to runtime/domain/boundary_weights.cu diff --git a/runtime/boundary_weights.hpp b/runtime/domain/boundary_weights.hpp similarity index 86% rename from runtime/boundary_weights.hpp rename to runtime/domain/boundary_weights.hpp index e84348a..3b7fd22 100644 --- a/runtime/boundary_weights.hpp +++ b/runtime/domain/boundary_weights.hpp @@ -6,8 +6,8 @@ #include <fstream> #include <sstream> //--- -#include "pairs.hpp" -#include "pairs_common.hpp" +#include "../pairs.hpp" +#include "../pairs_common.hpp" namespace pairs { diff --git a/runtime/copper_fcc_lattice.cpp b/runtime/utility/copper_fcc_lattice.cpp similarity index 100% rename from runtime/copper_fcc_lattice.cpp rename to runtime/utility/copper_fcc_lattice.cpp diff --git a/runtime/copper_fcc_lattice.hpp b/runtime/utility/copper_fcc_lattice.hpp similarity index 100% rename from runtime/copper_fcc_lattice.hpp rename to runtime/utility/copper_fcc_lattice.hpp diff --git a/runtime/create_body.cpp b/runtime/utility/create_body.cpp similarity index 100% rename from runtime/create_body.cpp rename to runtime/utility/create_body.cpp diff --git a/runtime/create_body.hpp b/runtime/utility/create_body.hpp similarity index 100% rename from runtime/create_body.hpp rename to runtime/utility/create_body.hpp diff --git a/runtime/dem_sc_grid.cpp b/runtime/utility/dem_sc_grid.cpp similarity index 100% rename from runtime/dem_sc_grid.cpp rename to runtime/utility/dem_sc_grid.cpp diff --git a/runtime/dem_sc_grid.hpp b/runtime/utility/dem_sc_grid.hpp similarity index 100% rename from runtime/dem_sc_grid.hpp rename to runtime/utility/dem_sc_grid.hpp diff --git a/runtime/read_from_file.cpp b/runtime/utility/read_from_file.cpp similarity index 100% rename from runtime/read_from_file.cpp rename to runtime/utility/read_from_file.cpp diff --git a/runtime/read_from_file.hpp b/runtime/utility/read_from_file.hpp similarity index 100% rename from runtime/read_from_file.hpp rename to runtime/utility/read_from_file.hpp diff --git a/runtime/stats.cpp b/runtime/utility/stats.cpp similarity index 100% rename from runtime/stats.cpp rename to runtime/utility/stats.cpp diff --git a/runtime/stats.hpp b/runtime/utility/stats.hpp similarity index 100% rename from runtime/stats.hpp rename to runtime/utility/stats.hpp diff --git a/runtime/thermo.cpp b/runtime/utility/thermo.cpp similarity index 100% rename from runtime/thermo.cpp rename to runtime/utility/thermo.cpp diff --git a/runtime/thermo.hpp b/runtime/utility/thermo.hpp similarity index 100% rename from runtime/thermo.hpp rename to runtime/utility/thermo.hpp diff --git a/runtime/timing.cpp b/runtime/utility/timing.cpp similarity index 100% rename from runtime/timing.cpp rename to runtime/utility/timing.cpp diff --git a/runtime/timing.hpp b/runtime/utility/timing.hpp similarity index 100% rename from runtime/timing.hpp rename to runtime/utility/timing.hpp diff --git a/runtime/vtk.cpp b/runtime/utility/vtk.cpp similarity index 100% rename from runtime/vtk.cpp rename to runtime/utility/vtk.cpp diff --git a/runtime/vtk.hpp b/runtime/utility/vtk.hpp similarity index 100% rename from runtime/vtk.hpp rename to runtime/utility/vtk.hpp diff --git a/src/pairs/code_gen/cgen.py b/src/pairs/code_gen/cgen.py index 13f4f8f..9a07c94 100644 --- a/src/pairs/code_gen/cgen.py +++ b/src/pairs/code_gen/cgen.py @@ -154,15 +154,15 @@ class CGen: self.print("#include <stdlib.h>") self.print("//---") self.print("#include \"likwid-marker.h\"") - self.print("#include \"copper_fcc_lattice.hpp\"") - self.print("#include \"create_body.hpp\"") - self.print("#include \"dem_sc_grid.hpp\"") self.print("#include \"pairs.hpp\"") - self.print("#include \"read_from_file.hpp\"") - self.print("#include \"stats.hpp\"") - self.print("#include \"timing.hpp\"") - self.print("#include \"thermo.hpp\"") - self.print("#include \"vtk.hpp\"") + self.print("#include \"utility/copper_fcc_lattice.hpp\"") + self.print("#include \"utility/create_body.hpp\"") + self.print("#include \"utility/dem_sc_grid.hpp\"") + self.print("#include \"utility/read_from_file.hpp\"") + self.print("#include \"utility/stats.hpp\"") + self.print("#include \"utility/timing.hpp\"") + self.print("#include \"utility/thermo.hpp\"") + self.print("#include \"utility/vtk.hpp\"") self.print("") self.print("using namespace pairs;") self.print("") -- GitLab