ENH: improved granularity for MPI-rebuilds

- Provide Allwmake-mpi scripts for handling the MPI-only build segment.

- Adjust Make/options to support a FOAM_MPI_LIBBIN target location.
  This will simply default to FOAM_LIBBIN/FOAM_MPI, but allows different
  types of builds with out-of-tree targets.

Example,

Build OpenFOAM with default MPI settings (eg, system openmpi)
```
./Allwmake
```

Rebuild MPI-layers with different MPI.

For any given and known type
```
othermpi()
{
    export WM_MPLIB=OPENMPI
    export FOAM_MPI=openmpi-3.1.3

    export OPAL_PREFIX=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
    export MPI_ARCH_PATH="$OPAL_PREFIX"
}
```

May wish to build/rebuild ptscotch
```
(
    othermpi
    $WM_THIRD_PARTY_DIR/makeSCOTCH
)
```

Rebuild the mpi-dependent parts. Can also provide install location
```
for script in $(find src -name Allwmake-mpi)
do
(
    other_mpi
    export FOAM_MPI_LIBBIN="$HOME/tmp/install-prefix/lib/$FOAM_MPI"
)
done
```
This commit is contained in:
Mark Olesen 2020-05-11 12:28:04 +02:00 committed by Andrew Heather
parent d7db8f8292
commit f233595a7f
13 changed files with 75 additions and 18 deletions

View File

@ -1,11 +1,10 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------
wclean dummy
wcleanLibMpi mpi
./Allwclean-mpi
#------------------------------------------------------------------------------

9
src/Pstream/Allwclean-mpi Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------
wcleanLibMpi mpi
#------------------------------------------------------------------------------

View File

@ -1,13 +1,12 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------
echo "wmake $targetType dummy (mpi=$WM_MPLIB)"
wmake $targetType dummy
wmakeLibMpi mpi
./Allwmake-mpi $targetType $*
#------------------------------------------------------------------------------

13
src/Pstream/Allwmake-mpi Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
# No AllwmakeParseArguments [infinite loop via Allwmake]
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmake.wmake-args
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------
# Environment
# - FOAM_MPI_LIBBIN (optional: defaults to FOAM_LIBBIN/FOAM_MPI)
wmakeLibMpi mpi
#------------------------------------------------------------------------------

View File

@ -3,4 +3,4 @@ UIPread.C
UPstream.C
PstreamGlobals.C
LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libPstream
LIB = $(FOAM_MPI_LIBBIN)/libPstream

View File

@ -1,6 +1,11 @@
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
/* Default is PROJECT LIB/mpi target */
ifeq (,$(FOAM_MPI_LIBBIN))
FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
endif
EXE_INC = $(PFLAGS) $(PINC) $(c++LESSWARN)
LIB_LIBS = $(PLIBS)

View File

@ -1,6 +1,5 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------
@ -10,6 +9,6 @@ wclean scotchDecomp
wclean decompositionMethods
wclean decompose
wcleanLibMpi ptscotchDecomp
./Allwclean-mpi
#------------------------------------------------------------------------------

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------
wcleanLibMpi ptscotchDecomp
#------------------------------------------------------------------------------

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_kahip
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_metis
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_scotch
@ -27,12 +26,8 @@ fi
if have_scotch
then
wmake $targetType scotchDecomp
if have_ptscotch
then
wmakeLibMpi ptscotchDecomp "scotch=$SCOTCH_VERSION"
fi
fi
./Allwmake-mpi $targetType $*
#------------------------------------------------------------------------------

View File

@ -0,0 +1,24 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
# No AllwmakeParseArguments [infinite loop via Allwmake]
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmake.wmake-args
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_scotch
#------------------------------------------------------------------------------
# Environment
# - FOAM_MPI_LIBBIN (optional: defaults to FOAM_LIBBIN/FOAM_MPI)
: "${FOAM_EXT_LIBBIN:=/usr/lib$WM_COMPILER_LIB_ARCH}" # Extra safety?
export FOAM_EXT_LIBBIN
if have_scotch
then
if have_ptscotch
then
wmakeLibMpi ptscotchDecomp "scotch=$SCOTCH_VERSION"
fi
fi
#------------------------------------------------------------------------------

View File

@ -1,3 +1,3 @@
ptscotchDecomp.C
LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libptscotchDecomp
LIB = $(FOAM_MPI_LIBBIN)/libptscotchDecomp

View File

@ -5,6 +5,11 @@
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
/* Default is PROJECT LIB/mpi target */
ifeq (,$(strip $(FOAM_MPI_LIBBIN)))
FOAM_MPI_LIBBIN := $(FOAM_LIBBIN)/$(FOAM_MPI)
endif
EXE_INC = \
-I$(PTSCOTCH_INC_DIR) \
-I$(SCOTCH_INC_DIR) \
@ -22,8 +27,8 @@ LIB_LIBS = \
-lscotch \
-lptscotch
/* Combined into libptscotch for windows compile */
ifneq ($(WM_OSTYPE),MSwindows)
/* errexit, except for windows compile (already in library) */
ifeq (,$(findstring windows,$(WM_OSTYPE)))
LIB_LIBS += -lptscotcherrexit
endif

View File

@ -7,8 +7,8 @@ LIB_LIBS = \
-L$(SCOTCH_LIB_DIR) \
-lscotch
/* Combined into libscotch for windows compile */
ifneq ($(WM_OSTYPE),MSwindows)
/* errexit, except for windows compile (already in library) */
ifeq (,$(findstring windows,$(WM_OSTYPE)))
LIB_LIBS += -lscotcherrexit
endif