MPI configuration: Added support for SYSTEMMPI

Provided by Bruno Santos
Also some general cleaning and update of comment.
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1167
This commit is contained in:
Henry
2015-03-08 21:04:38 +00:00
parent b6e5ecc45f
commit ad7053d560
12 changed files with 170 additions and 1190 deletions

View File

@ -30,11 +30,11 @@
#
#------------------------------------------------------------------------------
# prefix to PATH
# Prefix to PATH
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
# prefix to LD_LIBRARY_PATH
# Prefix to LD_LIBRARY_PATH
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# prefix to MANPATH
# Prefix to MANPATH
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
#------------------------------------------------------------------------------
@ -136,7 +136,7 @@ endsw
#------------------------------------------------------------------------------
# location of the jobControl directory
# Location of the jobControl directory
setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl
# wmake configuration
@ -145,34 +145,34 @@ setenv WM_LINK_LANGUAGE c++
setenv WM_LABEL_OPTION Int$WM_LABEL_SIZE
setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION$WM_COMPILE_OPTION
# base executables/libraries
# Base executables/libraries
setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# external (ThirdParty) libraries
# External (ThirdParty) libraries
setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# site-specific directory
# Site-specific directory
if ( $?WM_PROJECT_SITE ) then
set siteDir=$WM_PROJECT_SITE
else
set siteDir=$WM_PROJECT_INST_DIR/site
endif
# shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion
# Shared site executables/libraries
# Similar naming convention as ~OpenFOAM expansion
setenv FOAM_SITE_APPBIN $siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# user executables/libraries
# User executables/libraries
setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
# dynamicCode templates
# DynamicCode templates
# - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
# setenv FOAM_CODE_TEMPLATES $WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
# convenience
# Convenience
setenv FOAM_APP $WM_PROJECT_DIR/applications
setenv FOAM_SRC $WM_PROJECT_DIR/src
setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
@ -180,12 +180,12 @@ setenv FOAM_UTILITIES $FOAM_APP/utilities
setenv FOAM_SOLVERS $FOAM_APP/solvers
setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
# add wmake to the path - not required for runtime-only environment
# Add wmake to the path - not required for runtime-only environment
if ( -d "${WM_DIR}" ) setenv PATH ${WM_DIR}:${PATH}
# add OpenFOAM scripts to the path
# Add OpenFOAM scripts to the path
setenv PATH ${WM_PROJECT_DIR}/bin:${PATH}
# add site-specific scripts to path - only if they exist
# Add site-specific scripts to path - only if they exist
if ( -d "$siteDir/bin" ) then # generic
_foamAddPath "$siteDir/bin"
endif
@ -254,7 +254,7 @@ case ThirdParty:
set mpc_version=mpc-1.0.1
breaksw
case Clang:
# using clang - not gcc
# Using clang - not gcc
setenv WM_CC 'clang'
setenv WM_CXX 'clang++'
set clang_version=llvm-3.5.1
@ -268,7 +268,7 @@ case ThirdParty:
breaksw
endsw
# optional configuration tweaks:
# Optional configuration tweaks:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.csh`
if ( $?gcc_version ) then
@ -284,7 +284,8 @@ case ThirdParty:
echo
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
echo " Cannot find $gccDir installation."
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " Please install this compiler version or if you wish to" \
" use the system compiler,"
echo " change the 'foamCompiler' setting to 'system'"
echo
endif
@ -292,19 +293,19 @@ case ThirdParty:
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
# add compiler libraries to run-time environment
# Add compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# add gmp/mpfr libraries to run-time environment
# Add gmp/mpfr libraries to run-time environment
_foamAddLib $gmpDir/lib
_foamAddLib $mpfrDir/lib
# add mpc libraries (not need for older gcc) to run-time environment
# Add mpc libraries (not need for older gcc) to run-time environment
if ( $?mpc_version ) then
_foamAddLib $mpcDir/lib
endif
# used by boost/CGAL:
# Used by boost/CGAL:
setenv MPFR_ARCH_PATH $mpfrDir
setenv GMP_ARCH_PATH $gmpDir
endif
@ -319,7 +320,8 @@ case ThirdParty:
echo
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
echo " Cannot find $clangDir installation."
echo " Please install this compiler version or if you wish to use the system compiler,"
echo " Please install this compiler version or if you wish to" \
" use the system compiler,"
echo " change the 'foamCompiler' setting to 'system'"
echo
endif
@ -332,7 +334,7 @@ case ThirdParty:
breaksw
case system:
# okay, use system compiler
# Use system compiler
breaksw
default:
@ -343,7 +345,7 @@ endsw
#
# add c++0x flags for external programs
# Add c++0x flags for external programs
#
if ( $?WM_CXXFLAGS ) then
switch ("$WM_COMPILER")
@ -368,7 +370,7 @@ case SYSTEMOPENMPI:
set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
# Bit of a hack: strip off 'lib' and hope this is the path to openmpi
# include files and libraries.
# Include files and libraries.
setenv MPI_ARCH_PATH "${libDir:h}"
_foamAddLib $libDir
@ -377,7 +379,7 @@ case SYSTEMOPENMPI:
case OPENMPI:
setenv FOAM_MPI openmpi-1.8.4
# optional configuration tweaks:
# Optional configuration tweaks:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.csh`
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
@ -394,6 +396,50 @@ case OPENMPI:
_foamAddMan $MPI_ARCH_PATH/share/man
breaksw
case SYSTEMMPI:
setenv FOAM_MPI mpi-system
if ( ! ($?MPI_ROOT) ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
echo " Please set the environment variable MPI_ROOT to point to" \
" the base folder for the system MPI in use."
echo " Example:"
echo
echo " setenv MPI_ROOT /opt/mpi"
echo
else
setenv MPI_ARCH_PATH $MPI_ROOT
if ( ! ($?MPI_ARCH_FLAGS) ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
echo " MPI_ARCH_FLAGS is not set. Example:"
echo
echo ' setenv MPI_ARCH_FLAGS "-DOMPI_SKIP_MPICXX"'
echo
endif
if ( ! ($?MPI_ARCH_INC) ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
echo " MPI_ARCH_INC is not set. Example:"
echo
echo ' setenv MPI_ARCH_INC "-I$MPI_ROOT/include"'
echo
endif
if ( ! ($?MPI_ARCH_LIBS) ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
echo " MPI_ARCH_LIBS is not set. Example:"
echo
echo ' setenv MPI_ARCH_LIBS "-L$MPI_ROOT/lib -lmpi"'
echo
endif
endif
breaksw
case MPICH:
setenv FOAM_MPI mpich2-1.1.1p1
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$FOAM_MPI
@ -446,11 +492,6 @@ case HPMPI:
endsw
breaksw
case GAMMA:
setenv FOAM_MPI gamma
setenv MPI_ARCH_PATH /usr
breaksw
case MPI:
setenv FOAM_MPI mpi
setenv MPI_ARCH_PATH /opt/mpi
@ -540,8 +581,8 @@ default:
endsw
# add (non-dummy) MPI implementation
# dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
# Add (non-dummy) MPI implementation
# Dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if ( "$FOAM_MPI" != dummy ) then
_foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}:${FOAM_EXT_LIBBIN}/${FOAM_MPI}
endif
@ -561,7 +602,7 @@ else
endif
# cleanup environment:
# Cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
#- keep _foamAddPath _foamAddLib _foamAddMan
unset minBufferSize

View File

@ -30,7 +30,7 @@
#
#------------------------------------------------------------------------------
# prefix to PATH
# Prefix to PATH
_foamAddPath()
{
while [ $# -ge 1 ]
@ -40,7 +40,7 @@ _foamAddPath()
done
}
# prefix to LD_LIBRARY_PATH
# Prefix to LD_LIBRARY_PATH
_foamAddLib()
{
while [ $# -ge 1 ]
@ -50,7 +50,7 @@ _foamAddLib()
done
}
# prefix to MANPATH
# Prefix to MANPATH
_foamAddMan()
{
while [ $# -ge 1 ]
@ -93,7 +93,8 @@ Linux)
export WM_LDFLAGS='-m64'
;;
*)
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64" 1>&2
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"\
1>&2
;;
esac
;;
@ -164,7 +165,7 @@ esac
#------------------------------------------------------------------------------
# location of the jobControl directory
# Location of the jobControl directory
export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
# wmake configuration
@ -173,30 +174,30 @@ export WM_LINK_LANGUAGE=c++
export WM_LABEL_OPTION=Int$WM_LABEL_SIZE
export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION$WM_COMPILE_OPTION
# base executables/libraries
# Base executables/libraries
export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# external (ThirdParty) libraries
# External (ThirdParty) libraries
export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# site-specific directory
# Site-specific directory
siteDir="${WM_PROJECT_SITE:-$WM_PROJECT_INST_DIR/site}"
# shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion
# Shared site executables/libraries
# Similar naming convention as ~OpenFOAM expansion
export FOAM_SITE_APPBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# user executables/libraries
# User executables/libraries
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
# dynamicCode templates
# DynamicCode templates
# - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
# export FOAM_CODE_TEMPLATES=$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
# convenience
# Convenience
export FOAM_APP=$WM_PROJECT_DIR/applications
export FOAM_SRC=$WM_PROJECT_DIR/src
export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
@ -204,9 +205,9 @@ export FOAM_UTILITIES=$FOAM_APP/utilities
export FOAM_SOLVERS=$FOAM_APP/solvers
export FOAM_RUN=$WM_PROJECT_USER_DIR/run
# add wmake to the path - not required for runtime-only environment
# Add wmake to the path - not required for runtime-only environment
[ -d "$WM_DIR" ] && PATH=$WM_DIR:$PATH
# add OpenFOAM scripts to the path
# Add OpenFOAM scripts to the path
export PATH=$WM_PROJECT_DIR/bin:$PATH
# add site-specific scripts to path - only if they exist
@ -292,7 +293,7 @@ OpenFOAM | ThirdParty)
;;
esac
# optional configuration tweaks:
# Optional configuration tweaks:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.sh`
if [ -n "$gcc_version" ]
@ -307,7 +308,8 @@ OpenFOAM | ThirdParty)
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " Cannot find $gccDir installation." 1>&2
echo " Please install this compiler version or if you wish to use the system compiler," 1>&2
echo " Please install this compiler version or if you wish to" \
" use the system compiler," 1>&2
echo " change the 'foamCompiler' setting to 'system'" 1>&2
echo
}
@ -315,20 +317,20 @@ OpenFOAM | ThirdParty)
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
# add compiler libraries to run-time environment
# Add compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# add gmp/mpfr libraries to run-time environment
# Add gmp/mpfr libraries to run-time environment
_foamAddLib $gmpDir/lib
_foamAddLib $mpfrDir/lib
# add mpc libraries (not need for older gcc) to run-time environment
# Add mpc libraries (not need for older gcc) to run-time environment
if [ -n "$mpc_version" ]
then
_foamAddLib $mpcDir/lib
fi
# used by boost/CGAL:
# Used by boost/CGAL:
export MPFR_ARCH_PATH=$mpfrDir
export GMP_ARCH_PATH=$gmpDir
fi
@ -344,7 +346,8 @@ OpenFOAM | ThirdParty)
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " Cannot find $clangDir installation." 1>&2
echo " Please install this compiler version or if you wish to use the system compiler," 1>&2
echo " Please install this compiler version or if you wish to" \
" use the system compiler," 1>&2
echo " change the 'foamCompiler' setting to 'system'" 1>&2
echo 1>&2
}
@ -355,7 +358,7 @@ OpenFOAM | ThirdParty)
unset clang_version clangDir
;;
system)
# okay, use system compiler
# Use system compiler
;;
*)
echo "Warn: foamCompiler='$foamCompiler' is unsupported" 1>&2
@ -365,7 +368,7 @@ esac
#
# add c++0x flags for external programs
# Add c++0x flags for external programs
#
if [ -n "$WM_CXXFLAGS" ]
then
@ -400,7 +403,7 @@ SYSTEMOPENMPI)
OPENMPI)
export FOAM_MPI=openmpi-1.8.4
# optional configuration tweaks:
# Optional configuration tweaks:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.sh`
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
@ -417,6 +420,54 @@ OPENMPI)
_foamAddMan $MPI_ARCH_PATH/share/man
;;
SYSTEMMPI)
export FOAM_MPI=mpi-system
if [ -z "$MPI_ROOT" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " Please set the environment variable MPI_ROOT to point to" \
" the base folder for the system MPI in use." 1>&2
echo " Example:" 1>&2
echo 1>&2
echo " export MPI_ROOT=/opt/mpi" 1>&2
echo 1>&2
else
export MPI_ARCH_PATH=$MPI_ROOT
if [ -z "$MPI_ARCH_FLAGS" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " MPI_ARCH_FLAGS is not set. Example:" 1>&2
echo 1>&2
echo " export MPI_ARCH_FLAGS=\"-DOMPI_SKIP_MPICXX\"" 1>&2
echo 1>&2
fi
if [ -z "$MPI_ARCH_INC" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " MPI_ARCH_INC is not set. Example:" 1>&2
echo 1>&2
echo " export MPI_ARCH_INC=\"-I\$MPI_ROOT/include\"" 1>&2
echo 1>&2
fi
if [ -z "$MPI_ARCH_LIBS" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " MPI_ARCH_LIBS is not set. Example:" 1>&2
echo 1>&2
echo " export MPI_ARCH_LIBS=\"-L\$MPI_ROOT/lib -lmpi\"" 1>&2
echo 1>&2
fi
fi
;;
MPICH)
export FOAM_MPI=mpich2-1.1.1p1
export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
@ -470,11 +521,6 @@ HPMPI)
esac
;;
GAMMA)
export FOAM_MPI=gamma
export MPI_ARCH_PATH=/usr
;;
MPI)
export FOAM_MPI=mpi
export MPI_ARCH_PATH=/opt/mpi
@ -499,7 +545,7 @@ QSMPI)
;;
SGIMPI)
# no trailing slash
# No trailing slash
[ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
export FOAM_MPI="${MPI_ROOT##*/}"
@ -508,7 +554,8 @@ SGIMPI)
if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
then
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " MPI_ROOT not a valid mpt installation directory or ending in a '/'." 1>&2
echo " MPI_ROOT not a valid mpt installation directory or ending" \
" in a '/'." 1>&2
echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
fi
@ -525,7 +572,7 @@ SGIMPI)
;;
INTELMPI)
# no trailing slash
# No trailing slash
[ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
export FOAM_MPI="${MPI_ROOT##*/}"
@ -534,7 +581,8 @@ INTELMPI)
if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
then
echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
echo " MPI_ROOT not a valid mpt installation directory or ending in a '/'." 1>&2
echo " MPI_ROOT not a valid mpt installation directory or ending" \
" in a '/'." 1>&2
echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
fi
@ -554,8 +602,8 @@ INTELMPI)
;;
esac
# add (non-dummy) MPI implementation
# dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
# Add (non-dummy) MPI implementation
# Dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if [ "$FOAM_MPI" != dummy ]
then
_foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI
@ -574,7 +622,7 @@ fi
export MPI_BUFFER_SIZE
# cleanup environment:
# Cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
#keep _foamAddPath _foamAddLib _foamAddMan
unset foamCompiler minBufferSize