Commit 8dd98b6a authored by Marcus D. Hanwell's avatar Marcus D. Hanwell Committed by Chris Harris
Browse files

Updated CMake to do MPI stuff in Parallel/MPI

The CMake variables were never initialized, this logic needs to take
place in Parallel/MPI and be available to other modules that depend
on it.

Change-Id: Ib2218d7f22a9c9c46f3b6e02b55a7b8fcd81f85d
parent a9a0d3d2
......@@ -281,52 +281,6 @@ SET(VTK_HAS_EXODUS 1)
# Provide a few configuration options.
OPTION(BUILD_EXAMPLES "Build VTK examples." OFF)
IF(VTK_USE_MPI)
FIND_PACKAGE(MPI)
ENDIF(VTK_USE_MPI)
#-----------------------------------------------------------------------------
# Configure MPI testing support.
# FLAGS used and set for MPI testing
# VTK_MPIRUN_EXE - full path to mpirun command
# VTK_MPI_PRENUMPROC_FLAGS - flags used directly before the num. of procs flag
# VTK_MPI_NUMPROC_FLAG - flag that is used to tell this mpirun how many procs to start
# VTK_MPI_PREFLAGS - flags used directly before process to be run by mpirun
# VTK_MPI_POSTFLAGS - flags used after all other flags by mpirun
# So, tests will be run something like this:
# ${VTK_MPIRUN_EXE} ${VTK_MPI_PRENUMPROC_FLAGS} ${VTK_MPI_NUMPROC_FLAG} 2 ${VTK_MPI_PREFLAGS} executable ${VTK_MPI_POSTFLAGS}
#
IF(VTK_USE_MPI)
# Use MPI variables defined in the CMake (2.8) FindMPI module.
IF(${MPIEXEC})
SET(VTK_MPIRUN_EXE CACHE FILEPATH ${MPIEXEC} FORCE)
SET(VTK_MPI_PRENUMPROC_FLAGS ${MPIEXEC_PREFLAGS} CACHE STRING "These flags will be directly before the number of processess flag (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
IF(NOT ${MPI_NUMPROC_FLAG})
SET(VTK_MPI_NUMPROC_FLAG "-np" CACHE STRING "Flag used by mpi to specify the number of processes, the next option will be the number of processes. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
ELSE(NOT ${MPI_NUMPROC_FLAG})
SET(VTK_MPI_NUMPROC_FLAG ${MPIEXEC_NUMPROC_FLAG} CACHE STRING "Flag used by mpi to specify the number of processes, the next option will be the number of processes. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
ENDIF(NOT ${MPI_NUMPROC_FLAG})
SET(VTK_MPI_PREFLAGS ${MPIEXEC_PREFLAGS} CACHE STRING "These flags will be directly before the executable that is being run by VTK_MPIRUN_EXE. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
SET(VTK_MPI_POSTFLAGS ${MPIEXEC_POSTFLAGS} CACHE STRING "These flags will come after all flags given to MPIRun.(see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
SET(VTK_MPI_MAX_NUMPROCS ${MPIEXEC_MAX_NUMPROCS} CACHE STRING "Maximum number of processors available to run parallel applications. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
ELSE(${MPIEXEC})
# set to the default hardcoded values. This else can probably be deleted when VTK requires CMake 2.8+.
FIND_PROGRAM(VTK_MPIRUN_EXE NAMES mpiexec mpirun lamexec PATHS "C:/Program Files/MPICH/mpd/bin")
SET(VTK_MPI_PRENUMPROC_FLAGS "" CACHE STRING "These flags will be directly before the number of processess flag (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
SET(VTK_MPI_NUMPROC_FLAG "-np" CACHE STRING "Flag used by mpi to specify the number of processes, the next option will be the number of processes. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
SET(VTK_MPI_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by VTK_MPIRUN_EXE. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
SET(VTK_MPI_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIRun.(see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
SET(VTK_MPI_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run parallel applications. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)")
ENDIF(${MPIEXEC})
MARK_AS_ADVANCED(
VTK_MPI_PRENUMPROC_FLAGS VTK_MPI_NUMPROC_FLAG VTK_MPIRUN_EXE VTK_MPI_PREFLAGS VTK_MPI_POSTFLAGS VTK_MPI_MAX_NUMPROCS)
SEPARATE_ARGUMENTS(VTK_MPI_PRENUMPROC_FLAGS)
SEPARATE_ARGUMENTS(VTK_MPI_PREFLAGS)
SEPARATE_ARGUMENTS(VTK_MPI_POSTFLAGS)
ENDIF(VTK_USE_MPI)
#-----------------------------------------------------------------------------
# Configure files with settings for use by the build.
......
find_package(MPI)
find_package(MPI REQUIRED)
mark_as_advanced(MPI_LIBRARY MPI_EXTRA_LIBRARY)
include_directories(${MPI_INCLUDE_PATH})
#-----------------------------------------------------------------------------
# Configure MPI testing support.
# FLAGS used and set for MPI testing
# VTK_MPIRUN_EXE - full path to mpirun command
# VTK_MPI_PRENUMPROC_FLAGS - flags used directly before the num. of procs flag
# VTK_MPI_NUMPROC_FLAG - flag that is used to tell this mpirun how many procs to start
# VTK_MPI_PREFLAGS - flags used directly before process to be run by mpirun
# VTK_MPI_POSTFLAGS - flags used after all other flags by mpirun
# So, tests will be run something like this:
# ${VTK_MPIRUN_EXE} ${VTK_MPI_PRENUMPROC_FLAGS} ${VTK_MPI_NUMPROC_FLAG} 2 ${VTK_MPI_PREFLAGS} executable ${VTK_MPI_POSTFLAGS}
#
# Use MPI variables defined in the CMake (2.8) FindMPI module.
if(${MPIEXEC})
set(VTK_MPIRUN_EXE CACHE FILEPATH ${MPIEXEC} FORCE)
set(VTK_MPI_PRENUMPROC_FLAGS ${MPIEXEC_PREFLAGS} CACHE STRING
"These flags will be directly before the number of processess flag (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
if(NOT ${MPI_NUMPROC_FLAG})
set(VTK_MPI_NUMPROC_FLAG "-np" CACHE STRING
"Flag used by mpi to specify the number of processes, the next option will be the number of processes. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
else()
set(VTK_MPI_NUMPROC_FLAG ${MPIEXEC_NUMPROC_FLAG} CACHE STRING
"Flag used by mpi to specify the number of processes, the next option will be the number of processes. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
endif()
set(VTK_MPI_PREFLAGS ${MPIEXEC_PREFLAGS} CACHE STRING
"These flags will be directly before the executable that is being run by VTK_MPIRUN_EXE. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
set(VTK_MPI_POSTFLAGS ${MPIEXEC_POSTFLAGS} CACHE STRING
"These flags will come after all flags given to MPIRun.(see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
set(VTK_MPI_MAX_NUMPROCS ${MPIEXEC_MAX_NUMPROCS} CACHE STRING
"Maximum number of processors available to run parallel applications. (see ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt for more info.)" FORCE)
else()
message(WARNING "MPIEXEC was empty.")
endif()
mark_as_advanced(
VTK_MPI_PRENUMPROC_FLAGS
VTK_MPI_NUMPROC_FLAG
VTK_MPIRUN_EXE
VTK_MPI_PREFLAGS
VTK_MPI_POSTFLAGS
VTK_MPI_MAX_NUMPROCS
)
set(Module_SRCS
vtkMPICommunicator.cxx
vtkMPIController.cxx
......
Supports Markdown
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