list (APPEND CMAKE_MODULE_PATH "${SOLVERLAB_SOURCE_DIR}/cmake_files")
-#####################
-# Detection of MPI #
-#####################
-if ( DEFINED ENV{MPI_ROOT_DIR} OR DEFINED MPI_ROOT_DIR )
- if ( DEFINED ENV{MPI_ROOT_DIR} )
- set(MPI_HOME $ENV{MPI_ROOT_DIR})
- else ( DEFINED ENV{MPI_ROOT_DIR} )
- set(MPI_HOME ${MPI_ROOT_DIR})
- endif( DEFINED ENV{MPI_ROOT_DIR} )
-endif( DEFINED ENV{MPI_ROOT_DIR} OR DEFINED MPI_ROOT_DIR )
+#############################
+# Detection of MPI + MPI4PY #
+#############################
+if ( DEFINED MPI_ROOT_DIR )
+ set(MPI_HOME ${MPI_ROOT_DIR})
+endif( DEFINED MPI_ROOT_DIR )
# Definition of SOLVERLAB_WITH_MPI
if( DEFINED ENV{MPI_HOME} OR MPI_HOME )
set(SOLVERLAB_WITH_MPI OFF)
endif( DEFINED ENV{MPI_HOME} OR MPI_HOME )
-# Definition of MPI4PY_ROOT_DIR
+# Definition of MPI4PY_ROOT_DIR from either the environment or petsc
if( ${SOLVERLAB_WITH_PYTHON} AND ${SOLVERLAB_WITH_MPI} AND NOT ${MPI4PY_ROOT_DIR})
message(STATUS "Defining MPI4PY directory" )
if( DEFINED ENV{MPI4PY_ROOT_DIR})
if( MPI4PY_ROOT_DIR)
message(STATUS "MPI4PY directory is ${MPI4PY_ROOT_DIR}" )
- SET(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DMPI4PY_ROOT_DIR=${MPI4PY_ROOT_DIR})
+ SET(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DMPI4PY_ROOT_DIR=${MPI4PY_ROOT_DIR})#Necessary for swig generation of mpi structures
endif( MPI4PY_ROOT_DIR)
############################
set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib)
set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include)
- #define MPI variables
- #set(SOLVERLAB_WITH_MPI ON)
- #set(MPI_HOME ${PETSC_INSTALL} )
- #set(MPI_LIBRARY ${PETSC_INSTALL}/lib/libmpi.so)
- #set(MPIEXEC ${PETSC_INSTALL}/bin/mpiexec)
- #set(MPI4PY_ROOT_DIR ${PETSC_INSTALL}/lib/mpi4py )
-
endif ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" )
endif ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR )
add_definitions(-DPETSC_VERSION_GREATER_3_5)
endif( ${PETSC_VERSION} VERSION_GREATER 3.5 )
+if ( ${SOLVERLAB_WITH_PYTHON} )
+ set(SLEPC4PY_ROOT_DIR ${PETSC_DIR}/${PETSC_ARCH}/lib/slepc4py)# or use FindSLEPC4PY
+ set(PETSC4PY_ROOT_DIR ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc4py)# or use FindPETSC4PY
+endif( ${SOLVERLAB_WITH_PYTHON} )
+
string(REPLACE ";" ":" PETSC_INCLUDES_INSTALL "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_SOLVERLAB.sh
add_library(petsc SHARED IMPORTED)
${PETSC_INCLUDES}
${SLEPC_INCLUDES}
)
+
+ if(EXISTS ${MPI4PY_ROOT_DIR}/mpi4py/include/mpi4py/mpi4py.i)
+ INCLUDE_DIRECTORIES( ${MPI4PY_ROOT_DIR}/mpi4py/include
+ ${MPI4PY_ROOT_DIR}/mpi4py/include/mpi4py )
+ elseif (EXISTS ${MPI4PY_ROOT_DIR}/include/mpi4py/mpi4py.i )
+ INCLUDE_DIRECTORIES( ${MPI4PY_ROOT_DIR}/include
+ ${MPI4PY_ROOT_DIR}/include/mpi4py )
+ endif()
ENDIF( ${SOLVERLAB_WITH_MPI} )
-if(EXISTS ${MPI4PY_ROOT_DIR}/mpi4py/include/mpi4py/mpi4py.i)
- INCLUDE_DIRECTORIES( ${MPI4PY_ROOT_DIR}/mpi4py/include
- ${MPI4PY_ROOT_DIR}/mpi4py/include/mpi4py )
-elseif (EXISTS ${MPI4PY_ROOT_DIR}/include/mpi4py/mpi4py.i )
- INCLUDE_DIRECTORIES( ${MPI4PY_ROOT_DIR}/include
- ${MPI4PY_ROOT_DIR}/include/mpi4py )
+if(EXISTS ${PETSC4PY_ROOT_DIR}/petsc4py/include/petsc4py/petsc4py.i)
+ INCLUDE_DIRECTORIES( ${PETSC4PY_ROOT_DIR}/petsc4py/include
+ ${PETSC4PY_ROOT_DIR}/petsc4py/include/petsc4py )
+elseif (EXISTS ${PETSC4PY_ROOT_DIR}/include/petsc4py/petsc4py.i )
+ INCLUDE_DIRECTORIES( ${PETSC4PY_ROOT_DIR}/include
+ ${PETSC4PY_ROOT_DIR}/include/petsc4py )
+endif()
+
+if(EXISTS ${SLEPC4PY_ROOT_DIR}/slepc4py/include/slepc4py/slepc4py.i)
+ INCLUDE_DIRECTORIES( ${SLEPC4PY_ROOT_DIR}/slepc4py/include
+ ${SLEPC4PY_ROOT_DIR}/slepc4py/include/slepc4py )
+elseif (EXISTS ${SLEPC4PY_ROOT_DIR}/include/slepc4py/slepc4py.i )
+ INCLUDE_DIRECTORIES( ${SLEPC4PY_ROOT_DIR}/include
+ ${SLEPC4PY_ROOT_DIR}/include/slepc4py )
endif()
IF (${CMAKE_VERSION} VERSION_LESS "3.8.0")