Merge pull request #202 from rolk/202_mpi

Allow MPI to be found and opm-core configured the same way as DUNE
This commit is contained in:
Bård Skaflestad 2013-03-15 06:52:17 -07:00
commit 520d97c63a
5 changed files with 32 additions and 7 deletions

View File

@ -97,8 +97,13 @@ include (UseOptimization)
# dependencies, in case they alter the list of warnings
include (UseWarnings)
# parallel computing must be explicitly enabled
option (USE_MPI "Use Message Passing Interface for parallel computing" OFF)
if (NOT USE_MPI)
set (CMAKE_DISABLE_FIND_PACKAGE_MPI TRUE)
endif (NOT USE_MPI)
### --- begin opm-core specific --- ###
# parallel programming
include (UseOpenMP)
find_openmp (${project})
### --- end opm-core specific --- ###

View File

@ -18,7 +18,8 @@ find_opm_package (
# dependencies
"CXX11Features REQUIRED;
BLAS REQUIRED;
LAPACK REQUIRED
LAPACK REQUIRED;
MPI
"
# header to search for
"dune/common/fvector.hh"

View File

@ -81,6 +81,12 @@ macro (find_and_append_package_to prefix name)
message (STATUS "Finding package ${name} using module mode")
find_package (${name} ${ARGN})
endif (${name}_DIR)
# the variable "NAME" may be replaced during find_package (as this is
# now a macro, and not a function anymore), so we must reinitialize
string (TOUPPER "${name}" NAME)
string (REPLACE "-" "_" NAME "${NAME}")
if (${name}_FOUND OR ${NAME}_FOUND)
foreach (var IN LISTS _opm_proj_vars)
if (DEFINED ${name}_${var})
@ -92,9 +98,9 @@ macro (find_and_append_package_to prefix name)
# some packages define _PATH instead of _DIRS (Hi, MPI!)
if ("${var}" STREQUAL "INCLUDE_DIRS")
if (DEFINED ${name}_INCLUDE_PATH)
list (APPEND ${prefix}_INCLUDE_DIRS ${name}_INCLUDE_PATH)
list (APPEND ${prefix}_INCLUDE_DIRS ${${name}_INCLUDE_PATH})
elseif (DEFINED ${NAME}_INCLUDE_PATH)
list (APPEND ${prefix}_INCLUDE_DIRS ${NAME}_INCLUDE_PATH)
list (APPEND ${prefix}_INCLUDE_DIRS ${${NAME}_INCLUDE_PATH})
endif (DEFINED ${name}_INCLUDE_PATH)
endif ("${var}" STREQUAL "INCLUDE_DIRS")
# cleanup lists

View File

@ -79,7 +79,8 @@ macro (find_opm_package module deps header lib defs prog conf)
# in standard system locations either, then start to wander
# about and look for it in proximity to ourself. Qt Creator likes
# to put the build-directories as siblings to the source trees,
# but with a -build suffix
# but with a -build suffix, DUNE likes to have the the build tree
# in a "build-cmake" sub-directory of each module
if (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
string (TOLOWER "${module}" _module_lower)
set (_guess
@ -87,6 +88,8 @@ macro (find_opm_package module deps header lib defs prog conf)
"../${module}-build"
"../${_module_lower}"
"../${_module_lower}-build"
"../../${module}/build-cmake"
"../../${_module_lower}/build-cmake"
)
set (_guess_bin)
foreach (_item IN ITEMS ${_guess})
@ -127,7 +130,6 @@ macro (find_opm_package module deps header lib defs prog conf)
foreach (_dep IN ITEMS ${deps})
separate_arguments (_args UNIX_COMMAND ${_dep})
find_and_append_package_to (${module} ${_args} ${${module}_QUIET})
find_package (${_args} QUIET)
list (GET _args 0 _name_only)
list (APPEND _deps ${_name_only})
endforeach (_dep)

13
configure vendored
View File

@ -22,6 +22,7 @@ Optional Features:
--disable-silent-rules print every compilation statement as executed
--enable-system-debug put .debug files in global GDB debug dir
[default=yes if prefix=/usr, no otherwise]
--enable-parallel process in parallel using MPI [default=no]
--enable-openmp activate experimental support for OpenMP
--disable-option-checking ignore unrecognized --enable/--with options
@ -93,6 +94,7 @@ buildtype=Debug
pch_use=
#use_openmp=" -DUSE_OPENMP=OFF"
use_openmp=
use_mpi=
#silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=OFF"
silent_rules=
#debug_loc=" -DSYSTEM_DEBUG=OFF"
@ -226,6 +228,10 @@ for OPT in "$@"; do
use_openmp=" -DUSE_OPENMP=OFF"
pkgname=""
;;
parallel)
use_mpi=" -DUSE_MPI=OFF"
pkgname=""
;;
agmg |\
ert |\
superlu)
@ -260,6 +266,11 @@ for OPT in "$@"; do
# special flag; don't set shared/static
shared=""
;;
parallel)
use_openmp=" -DUSE_MPI=ON"
# special flag; don't set shared/static
shared=""
;;
# this flag is just for compatibility with the deprecation
# flag in DUNE, so we can build without warnings
fieldvector-size-is-method)
@ -308,7 +319,7 @@ for a in "${VARS[@]}"; do
done
# pass everything on to CMake
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp} ${FEATURES}"
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\" -DCMAKE_BUILD_TYPE=${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi} ${FEATURES}"
echo --- calling CMake ---
echo ${CMDLINE}
eval exec ${CMDLINE}