Skip to content
Snippets Groups Projects
Commit 1cb76c8f authored by Behzad Safaei's avatar Behzad Safaei
Browse files

Add waLBerla as a submodule

parent 106f5217
Branches
Tags
No related merge requests found
[submodule "external/walberla"]
path = external/walberla
url = https://i10git.cs.fau.de/walberla/walberla.git
......@@ -9,6 +9,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DDEBUG")
option(USE_MPI "USE_MPI" ON)
option(USE_WALBERLA "Enable waLBerla support for using BlockForest domain partitioning and dynamic load balancing" OFF)
option(COMPILE_CUDA "COMPILE_CUDA" OFF)
set(USER_SOURCE_FILES "" CACHE STRING "List of source files to compile (semicolon-separated)")
......@@ -96,14 +97,8 @@ endif()
#================================================================================
# waLBerla ======================================================================
#================================================================================
set(WALBERLA_DIR ${WALBERLA_DIR} CACHE PATH "Path to waLBerla source directory (required only when using BlockForest partitioning).")
if(WALBERLA_DIR)
if(EXISTS "${WALBERLA_DIR}")
target_compile_definitions(${PAIRS_TARGET} PUBLIC USE_WALBERLA)
else()
message(FATAL_ERROR "Invalid WALBERLA_DIR: '${WALBERLA_DIR}' does not exist.")
endif()
if(USE_WALBERLA)
target_compile_definitions(${PAIRS_TARGET} PUBLIC USE_WALBERLA)
set(RUNTIME_WALBERLA_FILES
runtime/domain/block_forest.cpp
......@@ -115,13 +110,14 @@ if(WALBERLA_DIR)
else()
list(APPEND RUNTIME_WALBERLA_FILES runtime/boundary_weights.cpp)
endif()
target_sources(${PAIRS_TARGET} PRIVATE ${RUNTIME_WALBERLA_FILES})
## Linking walberla modules
set(PAIRS_WALBERLA_DEPENDENCIES walberla::blockforest walberla::core walberla::pe)
find_package(waLBerla REQUIRED)
set(WALBERLA_LINK_LIBRARIES_KEYWORD PUBLIC)
add_subdirectory(external/walberla EXCLUDE_FROM_ALL)
waLBerla_import()
# Recent issue from the waLBerla side: warnings about empty CUDA_ARCHITECTURES for walberla_gpu
set(PAIRS_WALBERLA_DEPENDENCIES walberla::blockforest walberla::core)
target_link_libraries(${PAIRS_TARGET} PUBLIC ${PAIRS_WALBERLA_DEPENDENCIES})
## TODO: PAIRS_LINK_DIRS and PAIRS_LINK_LIBRARIES for walberla modules *AND* their dependencies
......
if ( WALBERLA_DIR )
# WALBERLA_DIR has to point to the waLBerla source directory
# this command builds waLBerla (again) in the current build directory in the subfolder "walberla" (second argument)
add_subdirectory( ${WALBERLA_DIR} walberla EXCLUDE_FROM_ALL)
waLBerla_import()
# Adds the 'src' and 'tests' directory of current app
list( APPEND WALBERLA_MODULE_DIRS "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/tests" )
list( REMOVE_DUPLICATES WALBERLA_MODULE_DIRS )
set ( WALBERLA_MODULE_DIRS ${WALBERLA_MODULE_DIRS} CACHE INTERNAL "All folders that contain modules or tests" )
else()
message( FATAL_ERROR "waLBerla not found - Use 'cmake -DWALBERLA_DIR=path_to_waLBerla_sources pathToApplicationSources' " )
endif()
......@@ -255,13 +255,12 @@ void BlockForest::initialize(int *argc, char ***argv) {
rank = mpiManager->rank();
auto block_config = balance_workload ? walberla::Vector3<int>(1, 1, 1) : getBlockConfig();
auto procs = mpiManager->numProcesses();
auto ref_level = balance_workload ? getInitialRefinementLevel(procs) : 0;
auto ref_level = balance_workload ? getInitialRefinementLevel(world_size) : 0;
// PBC's are forced to true here and sperately handled when determining ghosts
walberla::Vector3<bool> pbc(true, true, true);
walberla::math::AABB domain(grid_min[0], grid_min[1], grid_min[2], grid_max[0], grid_max[1], grid_max[2]);
forest = walberla::blockforest::createBlockForest(domain, block_config, pbc, procs, ref_level);
forest = walberla::blockforest::createBlockForest(domain, block_config, pbc, world_size, ref_level);
this->info = make_shared<walberla::blockforest::InfoCollection>();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment