Commit cad20d3c authored by Dave Moxey's avatar Dave Moxey

Refactor PETSc, ARPACK

parent 6b557e57
SET(ARPACK_SEARCH_PATHS ${CMAKE_SOURCE_DIR} /opt/local/lib/ ThirdParty/ARPACK
${CMAKE_SOURCE_DIR}/ThirdParty/build/dist/lib
${CMAKE_SOURCE_DIR}/../ThirdParty/build/dist/lib )
FIND_LIBRARY(ARPACK_LIB NAMES arpack.1 arpack PATHS ${ARPACK_SEARCH_PATHS})
SET(ARPACK_FOUND FALSE)
IF (ARPACK_LIB)
SET(ARPACK_FOUND TRUE)
MARK_AS_ADVANCED(ARPACK_LIB)
ENDIF (ARPACK_LIB)
IF (ARPACK_FOUND)
IF (NOT ARPACK_LIB_FIND_QUIETLY)
MESSAGE(STATUS "Found Arpack : ${ARPACK_LIB}")
GET_FILENAME_COMPONENT(ARPACK_PATH ${ARPACK_LIB} PATH CACHE)
SET(ARPACK_INCLUDE_DIR ${ARPACK_PATH}/../include CACHE FILEPATH "ARPACK include directory.")
MARK_AS_ADVANCED(ARPACK_PATH)
MARK_AS_ADVANCED(ARPACK_INCLUDE_DIR)
ENDIF (NOT ARPACK_LIB_FIND_QUIETLY)
ELSE(ARPACK_FOUND)
IF (ARPACK_LIB_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Arpack")
ENDIF (ARPACK_LIB_FIND_REQUIRED)
ENDIF (ARPACK_FOUND)
......@@ -44,8 +44,9 @@ SET(NEKTAR++_TP_INCLUDE_DIRS
"@Boost_CONFIG_INCLUDE_DIR@"
"@ZLIB_CONFIG_INCLUDE_DIR@"
"@FFTW_CONFIG_INCLUDE_DIR@"
"@MPI_INCLUDE_PATH@"
"@ARPACK_INCLUDE_DIR@"
"@MPI_INCLUDE_PATH@"
"@PETSC_CONFIG_INCLUDE_DIR@"
"@VTK_INCLUDE_DIRS@"
)
SET(NEKTAR++_TP_LIBRARIES @Boost_LIBRARIES@ "@MPI_LIBRARY@" "@MPI_EXTRA_LIBRARY@")
......
# Arpack
########################################################################
#
# ThirdParty configuration for Nektar++
#
# ARPACK
#
########################################################################
OPTION(NEKTAR_USE_ARPACK
"Use Arpack routines for evaluating the eigenvalues and eigenvectors" OFF)
"Use Arpack routines for evaluating eigenvalues and eigenvectors" OFF)
IF (NEKTAR_USE_ARPACK)
FIND_LIBRARY(ARPACK_LIBRARY NAMES "arpack.1" "arpack" PATHS /opt/local/lib)
IF( NEKTAR_USE_ARPACK )
INCLUDE (FindArpack)
INCLUDE_DIRECTORIES(${ARPACK_INCLUDE_DIR})
ADD_DEFINITIONS(-DNEKTAR_USING_ARPACK)
ENDIF( NEKTAR_USE_ARPACK)
IF (ARPACK_LIBRARY)
MESSAGE(STATUS "Found Arpack: ${ARPACK_LIBRARY}")
MARK_AS_ADVANCED(ARPACK_LIBRARY)
ELSE()
MESSAGE(FATAL_ERROR "Could not find Arpack")
ENDIF()
ENDIF()
OPTION(NEKTAR_USE_MPI "Use MPICH2 for parallelisation." OFF)
########################################################################
#
# ThirdParty configuration for Nektar++
#
# MPI
#
########################################################################
OPTION(NEKTAR_USE_MPI "Use MPI for parallelisation." OFF)
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_GSMPI
"Build GSMPI if needed" ON
......@@ -12,7 +20,7 @@ IF( NEKTAR_USE_MPI )
CHECK_FUNCTION_EXISTS(MPI_Send HAVE_MPI_SEND)
SET(MPI_BUILTIN OFF CACHE INTERNAL
"Determines whether MPI is built in")
"Determines whether MPI is built into the compiler")
IF (NOT "${HAVE_MPI_H}" OR NOT "${HAVE_MPI_SEND}")
INCLUDE (FindMPI)
MARK_AS_ADVANCED(MPI_LIBRARY)
......@@ -27,10 +35,12 @@ IF( NEKTAR_USE_MPI )
IF (HAVE_APRUN)
# Probably on Cray
SET(MPIEXEC "aprun" CACHE STRING "MPI job launching command")
SET(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "MPI job launcher flag to specify number of processes")
SET(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING
"MPI job launcher flag to specify number of processes")
ELSE()
SET(MPIEXEC "mpirun" CACHE STRING "MPI job launching command")
SET(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "MPI job launcher flag to specify number of processes")
SET(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING
"MPI job launcher flag to specify number of processes")
ENDIF()
MARK_AS_ADVANCED(MPIEXEC)
MARK_AS_ADVANCED(MPIEXEC_NUMPROC_FLAG)
......
########################################################################
#
# ThirdParty configuration for Nektar++
#
# PETSc
#
########################################################################
OPTION(NEKTAR_USE_PETSC
"Enable PETSc parallel matrix solver support." OFF)
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_PETSC
"Build PETSc if needed" OFF
"NEKTAR_USE_PETSC" OFF)
IF (NEKTAR_USE_PETSC)
ADD_DEFINITIONS(-DNEKTAR_USING_PETSC)
SET(PETSC_FIND_QUIETLY ON)
INCLUDE(FindPETSc)
IF (PETSC_FOUND)
SET(BUILD_PETSC OFF)
ELSE()
SET(BUILD_PETSC ON)
ENDIF()
CMAKE_DEPENDENT_OPTION(THIRDPARTY_BUILD_PETSC
"Build PETSc if needed" ${BUILD_PETSC}
"NEKTAR_USE_PETSC" OFF)
IF (THIRDPARTY_BUILD_PETSC)
INCLUDE(ExternalProject)
SET(PETSC_C_COMPILER "${CMAKE_C_COMPILER}")
SET(PETSC_C_COMPILER "${CMAKE_C_COMPILER}")
SET(PETSC_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
IF (NEKTAR_USE_MPI)
IF (NOT MPI_BUILTIN)
SET(PETSC_C_COMPILER "${MPI_C_COMPILER}")
SET(PETSC_C_COMPILER "${MPI_C_COMPILER}")
SET(PETSC_CXX_COMPILER "${MPI_CXX_COMPILER}")
ENDIF (NOT MPI_BUILTIN)
ELSE (NEKTAR_USE_MPI)
......@@ -44,20 +59,21 @@ IF (NEKTAR_USE_PETSC)
--with-petsc-arch=c-opt
--with-fc=0
${PETSC_NO_MPI}
)
)
INCLUDE_DIRECTORIES(${TPDIST}/include)
SET(PETSC_LIBRARIES "${TPDIST}/lib/libpetsc.a")
SET(PETSC_LIBRARIES petsc CACHE FILEPATH
"PETSc library" FORCE)
SET(PETSC_INCLUDES ${TPDIST}/include CACHE FILEPATH
"PETSc includes" FORCE)
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build PETSc: ${PETSC_LIBRARIES}")
ELSE (THIRDPARTY_BUILD_PETSC)
INCLUDE(FindPETSc)
IF (NOT PETSC_FOUND)
MESSAGE(FATAL_ERROR "Could not find PETSc")
ELSE (NOT PETSC_FOUND)
MESSAGE(STATUS "Found PETSc: ${PETSC_LIBRARIES}")
ENDIF (NOT PETSC_FOUND)
INCLUDE_DIRECTORIES(${PETSC_INCLUDES})
ENDIF (THIRDPARTY_BUILD_PETSC)
ENDIF( NEKTAR_USE_PETSC )
SET(PETSC_CONFIG_INCLUDE_DIR ${TPINC})
ELSE ()
MESSAGE(STATUS "Found PETSc: ${PETSC_LIBRARIES}")
SET(PETSC_CONFIG_INCLUDE_DIR ${PETSC_INCLUDES})
ENDIF ()
INCLUDE_DIRECTORIES(${PETSC_INCLUDES})
ADD_DEFINITIONS(-DNEKTAR_USING_PETSC)
INCLUDE_DIRECTORIES(SYSTEM ${PETSC_INCLUDES})
ENDIF( NEKTAR_USE_PETSC )
......@@ -373,7 +373,7 @@ ENDIF( NEKTAR_USE_FFTW )
# ARPACK
IF( NEKTAR_USE_ARPACK )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${ARPACK_LIB})
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${ARPACK_LIBRARY})
ENDIF( NEKTAR_USE_ARPACK )
# Boost
......
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