diff --git a/etc/config/settings.csh b/etc/config/settings.csh index 93f3e506ab..fbb9f04270 100644 --- a/etc/config/settings.csh +++ b/etc/config/settings.csh @@ -487,9 +487,31 @@ case QSMPI: breaksw case SGIMPI: - setenv FOAM_MPI ${MPI_ROOT##*/} + if ( ! $?MPI_ROOT) setenv MPI_ROOT /dummy + + if ( ! -d "$MPI_ROOT" ) then + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" + echo " MPI_ROOT not a valid mpt installation directory." + echo " Please set MPI_ROOT to the mpt installation directory." + echo " (usually done by loading the mpt module)" + echo " MPI_ROOT currently set to '$MPI_ROOT'" + endif + + if ( "${MPI_ROOT:h}/" == $MPI_ROOT ) then + setenv MPI_ROOT ${MPI_ROOT:h} + endif + + setenv FOAM_MPI ${MPI_ROOT:t} setenv MPI_ARCH_PATH $MPI_ROOT + + if ($?FOAM_VERBOSE && $?prompt) then + echo "Using SGI MPT:" + echo " MPI_ROOT : $MPI_ROOT" + echo " FOAM_MPI : $FOAM_MPI" + endif + + _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib breaksw diff --git a/etc/config/settings.sh b/etc/config/settings.sh index 5111ef405a..837dc7c5f9 100644 --- a/etc/config/settings.sh +++ b/etc/config/settings.sh @@ -511,9 +511,30 @@ QSMPI) ;; SGIMPI) + lastCharID=$(( ${#MPI_ROOT} - 1 )) + if [ "${MPI_ROOT:$lastCharID:1}" == '/' ] + then + MPI_ROOT=${MPI_ROOT:0:$lastCharID} + fi + export FOAM_MPI=${MPI_ROOT##*/} export MPI_ARCH_PATH=$MPI_ROOT + 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 " Please set MPI_ROOT to the mpt installation directory." 1>&2 + echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2 + fi + + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + echo "Using SGI MPT:" + echo " MPI_ROOT : $MPI_ROOT" + echo " FOAM_MPI : $FOAM_MPI" + fi + _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib ;;