Commit 941d28f2 authored by Praetorius, Simon's avatar Praetorius, Simon

petsc and zoltan configuration updated

parent 14b8a30c
...@@ -42,9 +42,9 @@ if (ENABLE_PARALLEL_DOMAIN) ...@@ -42,9 +42,9 @@ if (ENABLE_PARALLEL_DOMAIN)
endif (ENABLE_ZOLTAN) endif (ENABLE_ZOLTAN)
if (ENABLE_BDDCML) if (ENABLE_BDDCML)
target_compile_definitions(amdis_parallel INTERFACE HAVE_BDDCML=1) target_compile_definitions(amdis_parallel INTERFACE HAVE_BDDCML=1)
target_sources(amdis PRIVATE target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/BddcMlSolver.cc) ${SOURCE_DIR}/parallel/BddcMlSolver.cc)
endif (ENABLE_BDDCML) endif (ENABLE_BDDCML)
# add some more source-files that need petsc # add some more source-files that need petsc
......
macro(target_enable_mpi _TARGET_ _SCOPE_) macro(target_enable_mpi _TARGET_ _SCOPE_)
if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON)
else ()
set(LINK_EXECUTABLE OFF)
endif ()
find_package(MPI REQUIRED) find_package(MPI REQUIRED)
target_include_directories(${_TARGET_} ${_SCOPE_} target_include_directories(${_TARGET_} ${_SCOPE_}
${MPI_CXX_INCLUDE_PATH}) ${MPI_CXX_INCLUDE_PATH})
target_compile_options(${_TARGET_} ${_SCOPE_} target_compile_options(${_TARGET_} ${_SCOPE_}
${MPI_CXX_COMPILE_FLAGS}) ${MPI_CXX_COMPILE_FLAGS})
string(STRIP " ${MPI_CXX_LINK_FLAGS} " MPI_CXX_LINK_FLAGS_) string(STRIP " ${MPI_CXX_LINK_FLAGS} " MPI_CXX_LINK_FLAGS_)
target_link_libraries(${_TARGET_} ${_SCOPE_}
${MPI_CXX_LINK_FLAGS_} ${MPI_CXX_LIBRARIES}) if (LINK_EXECUTABLE)
target_link_libraries(${_TARGET_} ${_SCOPE_}
${MPI_CXX_LINK_FLAGS_} ${MPI_CXX_LIBRARIES})
endif (LINK_EXECUTABLE)
endmacro(target_enable_mpi) endmacro(target_enable_mpi)
macro(target_enable_petsc _TARGET_ _SCOPE_) macro(target_enable_petsc _TARGET_ _SCOPE_)
if (${ARGC} GREATER 2) if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON) set(LINK_EXECUTABLE ON)
...@@ -41,70 +51,81 @@ macro(target_enable_petsc _TARGET_ _SCOPE_) ...@@ -41,70 +51,81 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
set(PETSC_DEFINITIONS ${PETSC_CFLAGS} ${PETSC_CFLAGS_OTHER}) set(PETSC_DEFINITIONS ${PETSC_CFLAGS} ${PETSC_CFLAGS_OTHER})
endif (PETSc_FOUND) endif (PETSc_FOUND)
target_include_directories(${_TARGET_} ${_SCOPE_} ${PETSC_INCLUDE_DIRS})
target_compile_definitions(${_TARGET_} ${_SCOPE_}
HAVE_PARALLEL_PETSC=1
PETSC_VERSION=${PETSC_VERSION})
target_compile_options(${_TARGET_} ${_SCOPE_} ${PETSC_DEFINITIONS})
if (LINK_EXECUTABLE)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PETSC_LIBRARIES})
endif (LINK_EXECUTABLE)
# parmetis is required # parmetis is required
find_file(PARMETIS_HEADER_FILE "parmetis.h" find_file(PARMETIS_HEADER_FILE "parmetis.h"
HINTS ${PARMETIS_DIR}/include ${PETSC_INCLUDE_DIRS}) HINTS ${PARMETIS_DIR}/include ${PETSC_INCLUDE_DIRS})
if (PARMETIS_HEADER_FILE) if (PARMETIS_HEADER_FILE)
get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE) get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE)
target_include_directories(${_TARGET_} ${_SCOPE_} ${PARMETIS_INCLUDE_PATH}) target_include_directories(${_TARGET_} ${_SCOPE_} ${PARMETIS_INCLUDE_PATH})
else() else()
message(FATAL_ERROR "Could not find ParMetis header file 'parmetis.h'!") message(FATAL_ERROR "Could not find ParMetis header file 'parmetis.h'!")
endif (PARMETIS_HEADER_FILE) endif (PARMETIS_HEADER_FILE)
if (LINK_EXECUTABLE) if (LINK_EXECUTABLE)
find_library(PARMETIS_LIB parmetis find_library(PARMETIS_LIB parmetis
HINTS ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS}) HINTS ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS})
if (PARMETIS_LIB) if (NOT PARMETIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PARMETIS_LIB})
else (PARMETIS_LIB)
message(FATAL_ERROR "Could not find the ParMetis libraries needed by amdis") message(FATAL_ERROR "Could not find the ParMetis libraries needed by amdis")
endif (PARMETIS_LIB) endif (NOT PARMETIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PARMETIS_LIB})
endif (LINK_EXECUTABLE) endif (LINK_EXECUTABLE)
# metis is required # metis is required
find_file(METIS_HEADER_FILE "metis.h" find_file(METIS_HEADER_FILE "metis.h"
HINTS ${METIS_DIR}/include ${PARMETIS_DIR}/include ${PETSC_INCLUDE_DIRS}) HINTS ${METIS_DIR}/include ${PARMETIS_DIR}/include ${PETSC_INCLUDE_DIRS})
if (METIS_HEADER_FILE) if (METIS_HEADER_FILE)
get_filename_component(METIS_INCLUDE_PATH "${METIS_HEADER_FILE}" PATH CACHE) get_filename_component(METIS_INCLUDE_PATH "${METIS_HEADER_FILE}" PATH CACHE)
target_include_directories(${_TARGET_} ${_SCOPE_} ${METIS_INCLUDE_PATH}) target_include_directories(${_TARGET_} ${_SCOPE_} ${METIS_INCLUDE_PATH})
else() else()
message(FATAL_ERROR "Could not find Metis header file 'metis.h'!") message(FATAL_ERROR "Could not find Metis header file 'metis.h'!")
endif (METIS_HEADER_FILE) endif (METIS_HEADER_FILE)
if (LINK_EXECUTABLE) if (LINK_EXECUTABLE)
find_library(METIS_LIB metis find_library(METIS_LIB metis
HINTS ${METIS_DIR}/lib ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS}) HINTS ${METIS_DIR}/lib ${PARMETIS_DIR}/lib ${PETSC_LIBRARY_DIRS})
if (METIS_LIB) if (NOT METIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${METIS_LIB})
else (METIS_LIB)
message(FATAL_ERROR "Could not find the MEtis libraries needed by amdis") message(FATAL_ERROR "Could not find the MEtis libraries needed by amdis")
endif (METIS_LIB) endif (NOT METIS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${METIS_LIB})
endif (LINK_EXECUTABLE) endif (LINK_EXECUTABLE)
# blas library is required # blas library is required
find_library(BLAS_LIB if (LINK_EXECUTABLE)
NAMES blas fblas openblas find_library(BLAS_LIB
HINTS ${BLAS_DIR}/lib ${PETSC_LIBRARY_DIRS} /usr/lib/openblas-base /usr/lib/atlas-base) NAMES blas fblas openblas
if (BLAS_LIB) HINTS ${BLAS_DIR}/lib ${PETSC_LIBRARY_DIRS} /usr/lib/openblas-base /usr/lib/atlas-base)
set(BLAS_LIBRARIES ${BLAS_LIB}) if (BLAS_LIB)
else (BLAS_LIB) set(BLAS_LIBRARIES ${BLAS_LIB})
find_package(BLAS REQUIRED) else (BLAS_LIB)
endif (BLAS_LIB) find_package(BLAS REQUIRED)
endif (BLAS_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${BLAS_LIBRARIES})
endif (LINK_EXECUTABLE)
# lapack library is required
find_library(LAPACK_LIB
NAMES lapack flapack
HINTS ${LAPACK_DIR}/lib ${PETSC_LIBRARY_DIRS} ${PETSC_DIR}/lib)
if (LAPACK_LIB)
set(LAPACK_LIBRARIES ${LAPACK_LIB})
else (LAPACK_LIB)
find_package(LAPACK REQUIRED)
endif (LAPACK_LIB)
target_include_directories(${_TARGET_} ${_SCOPE_} ${PETSC_INCLUDE_DIRS}) # lapack library is required
target_compile_definitions(${_TARGET_} ${_SCOPE_} if (LINK_EXECUTABLE)
HAVE_PARALLEL_PETSC=1 find_library(LAPACK_LIB
PETSC_VERSION=${PETSC_VERSION}) NAMES lapack flapack
target_compile_options(${_TARGET_} ${_SCOPE_} ${PETSC_DEFINITIONS}) HINTS ${LAPACK_DIR}/lib ${PETSC_LIBRARY_DIRS} ${PETSC_DIR}/lib)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PETSC_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) if (LAPACK_LIB)
set(LAPACK_LIBRARIES ${LAPACK_LIB})
else (LAPACK_LIB)
find_package(LAPACK REQUIRED)
endif (LAPACK_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${LAPACK_LIBRARIES})
endif (LINK_EXECUTABLE)
endmacro(target_enable_petsc) endmacro(target_enable_petsc)
macro(target_enable_zoltan _TARGET_ _SCOPE_) macro(target_enable_zoltan _TARGET_ _SCOPE_)
if (${ARGC} GREATER 2) if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON) set(LINK_EXECUTABLE ON)
else () else ()
set(LINK_EXECUTABLE OFF) set(LINK_EXECUTABLE OFF)
endif () endif ()
find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" HINTS ${ZOLTAN_DIR}/include ${PETSC_INCLUDE_DIRS}) find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" HINTS ${ZOLTAN_DIR}/include ${PETSC_INCLUDE_DIRS})
if (ZOLTAN_HEADER_FILE) if (ZOLTAN_HEADER_FILE)
get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE) get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
target_include_directories(${_TARGET_} ${_SCOPE_} ${ZOLTAN_HEADER_DIR}) target_include_directories(${_TARGET_} ${_SCOPE_} ${ZOLTAN_HEADER_DIR})
else() else()
message(FATAL_ERROR "Could not find Zoltan include file 'zoltan_cpp.h'!") message(FATAL_ERROR "Could not find Zoltan include file 'zoltan_cpp.h'!")
endif(ZOLTAN_HEADER_FILE) endif(ZOLTAN_HEADER_FILE)
target_compile_definitions(${_TARGET_} ${_SCOPE_} HAVE_ZOLTAN=1) target_compile_definitions(${_TARGET_} ${_SCOPE_} HAVE_ZOLTAN=1)
if (LINK_EXECUTABLE) if (LINK_EXECUTABLE)
find_library(ZOLTAN_LIB zoltan find_library(ZOLTAN_LIB zoltan
HINTS ENV LIBRARY_PATH DOC "Full path to the zoltan library") HINTS ENV LIBRARY_PATH DOC "Full path to the zoltan library")
if (ZOLTAN_LIB) if (NOT ZOLTAN_LIB)
message(FATAL_ERROR "Could not find zoltan library!")
endif (NOT ZOLTAN_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${ZOLTAN_LIB}) target_link_libraries(${_TARGET_} ${_SCOPE_} ${ZOLTAN_LIB})
else() endif (LINK_EXECUTABLE)
message(FATAL_ERROR "Could not find zoltan library!")
endif()
endif (LINK_EXECUTABLE)
endmacro(target_enable_zoltan) endmacro(target_enable_zoltan)
\ No newline at end of file
Markdown is supported
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