CMakeList modified for automatic compile of Zoltan
This commit is contained in:
parent
ad5233bb77
commit
0053ef002a
|
@ -19,7 +19,7 @@ export pFlow_SRC_DIR="$pFlow_PROJECT_DIR/src"
|
||||||
|
|
||||||
export Kokkos_DIR="$kokkosDir"
|
export Kokkos_DIR="$kokkosDir"
|
||||||
|
|
||||||
export Zoltan_DIR="$projectDir/Zoltan"
|
#export Zoltan_DIR="$projectDir/Zoltan"
|
||||||
|
|
||||||
# Cleanup variables (done as final statement for a clean exit code)
|
# Cleanup variables (done as final statement for a clean exit code)
|
||||||
unset projectDir
|
unset projectDir
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
# Macro to check for Zoltan installation and build it if needed
|
||||||
|
# Usage: zoltan_find_or_build(ZOLTAN_DIR)
|
||||||
|
# Returns: ZOLTAN_INCLUDE_DIR, ZOLTAN_LIBRARY
|
||||||
|
|
||||||
|
macro(zoltan_find_or_build ZOLTAN_DIR)
|
||||||
|
# Set the Zoltan directory
|
||||||
|
set(ZOLTAN_PREFIX "${ZOLTAN_DIR}" CACHE STRING "Zoltan install directory")
|
||||||
|
message(STATUS "Zoltan install directory is ${ZOLTAN_PREFIX}")
|
||||||
|
|
||||||
|
# Check if the Zoltan library is already built
|
||||||
|
find_path(ZOLTAN_INCLUDE_DIR zoltan.h PATHS "${ZOLTAN_PREFIX}/include")
|
||||||
|
message(STATUS "Zoltan include path: ${ZOLTAN_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
find_library(ZOLTAN_LIBRARY zoltan PATHS "${ZOLTAN_PREFIX}/lib")
|
||||||
|
message(STATUS "Zoltan lib path: ${ZOLTAN_LIBRARY}")
|
||||||
|
|
||||||
|
# Check if Zoltan library exists, if not compile it using buildlib script
|
||||||
|
if(NOT ZOLTAN_LIBRARY)
|
||||||
|
message(STATUS "Zoltan library not found. Compiling from source using buildlib script...")
|
||||||
|
|
||||||
|
# Execute the buildlib bash script
|
||||||
|
execute_process(
|
||||||
|
COMMAND bash ${ZOLTAN_PREFIX}/buildlib
|
||||||
|
WORKING_DIRECTORY ${ZOLTAN_PREFIX}
|
||||||
|
RESULT_VARIABLE ZOLTAN_BUILD_RESULT
|
||||||
|
OUTPUT_VARIABLE ZOLTAN_BUILD_OUTPUT
|
||||||
|
ERROR_VARIABLE ZOLTAN_BUILD_ERROR
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT ZOLTAN_BUILD_RESULT EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Failed to build Zoltan library using buildlib script. Error: ${ZOLTAN_BUILD_ERROR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Try to find the library again after building
|
||||||
|
find_library(ZOLTAN_LIBRARY zoltan PATHS "${ZOLTAN_PREFIX}/lib" NO_DEFAULT_PATH)
|
||||||
|
find_path(ZOLTAN_INCLUDE_DIR zoltan.h PATHS "${ZOLTAN_PREFIX}/include" NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
if(NOT ZOLTAN_LIBRARY)
|
||||||
|
message(FATAL_ERROR "Failed to locate Zoltan library after building")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Successfully built Zoltan library at ${ZOLTAN_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
list(APPEND SourceFiles
|
list(APPEND SourceFiles
|
||||||
types/basicTypes/bTypesFunctions.cpp
|
types/basicTypes/bTypesFunctions.cpp
|
||||||
types/basicTypes/Logical.cpp
|
types/basicTypes/Logical.cpp
|
||||||
|
@ -119,35 +118,27 @@ set(link_libs)
|
||||||
set(link_libs Kokkos::kokkos tbb)
|
set(link_libs Kokkos::kokkos tbb)
|
||||||
|
|
||||||
|
|
||||||
|
# for MPI parallelization
|
||||||
if(pFlow_Build_MPI)
|
if(pFlow_Build_MPI)
|
||||||
|
|
||||||
set(Zoltan_Install_DIR)
|
# Include the Zoltan installation check macro
|
||||||
if(DEFINED ENV{Zoltan_DIR})
|
include(${CMAKE_SOURCE_DIR}/cmake/zoltanInstallCheck.cmake)
|
||||||
set(Zoltan_Install_DIR $ENV{Zoltan_DIR})
|
|
||||||
else()
|
# set the Zoltan Directory and check/build if needed
|
||||||
set(Zoltan_Install_DIR $ENV{HOME}/PhasicFlow/Zoltan)
|
set(Zoltan_Install_DIR ${CMAKE_SOURCE_DIR}/thirdParty/Zoltan)
|
||||||
endif()
|
|
||||||
message(STATUS "Zoltan install directory is ${Zoltan_Install_DIR}")
|
# Call the macro to find or build Zoltan
|
||||||
|
zoltan_find_or_build(${Zoltan_Install_DIR})
|
||||||
set(ZOLTAN_PREFIX "${Zoltan_Install_DIR}" CACHE STRING "Zoltan install directory")
|
|
||||||
|
|
||||||
find_path(ZOLTAN_INCLUDE_DIR zoltan.h PATHS "${ZOLTAN_PREFIX}/include")
|
|
||||||
|
|
||||||
message(STATUS "Zoltan include path: ${ZOLTAN_INCLUDE_DIR}")
|
|
||||||
|
|
||||||
find_library(ZOLTAN_LIBRARY zoltan PATHS "${ZOLTAN_PREFIX}/lib")
|
|
||||||
message(STATUS "Zoltan lib path: ${ZOLTAN_LIBRARY}")
|
|
||||||
|
|
||||||
list(APPEND SourceFiles
|
list(APPEND SourceFiles
|
||||||
MPIParallelization/domain/partitioning/partitioning.cpp
|
MPIParallelization/domain/partitioning/partitioning.cpp
|
||||||
MPIParallelization/domain/partitioning/rcb1DPartitioning.cpp
|
MPIParallelization/domain/partitioning/rcb1DPartitioning.cpp
|
||||||
MPIParallelization/domain/MPISimulationDomain.cpp
|
MPIParallelization/domain/MPISimulationDomain.cpp
|
||||||
MPIParallelization/dataIOMPI/dataIOMPIs.cpp
|
MPIParallelization/dataIOMPI/dataIOMPIs.cpp
|
||||||
MPIParallelization/MPI/procCommunication.cpp
|
MPIParallelization/MPI/procCommunication.cpp
|
||||||
MPIParallelization/MPI/scatteredMasterDistributeChar.cpp
|
MPIParallelization/MPI/scatteredMasterDistributeChar.cpp
|
||||||
MPIParallelization/pointStructure/boundaries/boundaryProcessor.cpp
|
MPIParallelization/pointStructure/boundaries/boundaryProcessor.cpp
|
||||||
MPIParallelization/pointField/processorBoundaryFields.cpp
|
MPIParallelization/pointField/processorBoundaryFields.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND link_libs MPI::MPI_CXX ${ZOLTAN_LIBRARY} -lm )
|
list(APPEND link_libs MPI::MPI_CXX ${ZOLTAN_LIBRARY} -lm )
|
||||||
|
@ -155,8 +146,10 @@ if(pFlow_Build_MPI)
|
||||||
target_include_directories(phasicFlow PUBLIC ./globals ${ZOLTAN_INCLUDE_DIR})
|
target_include_directories(phasicFlow PUBLIC ./globals ${ZOLTAN_INCLUDE_DIR})
|
||||||
|
|
||||||
else()
|
else()
|
||||||
pFlow_add_library_install(phasicFlow SourceFiles link_libs)
|
|
||||||
|
pFlow_add_library_install(phasicFlow SourceFiles link_libs)
|
||||||
target_include_directories(phasicFlow PUBLIC ./globals)
|
target_include_directories(phasicFlow PUBLIC ./globals)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue