COMP: define Scotch and Zoltan include dirs before mpi directories

- the local third-party headers are to be searched before any MPI
  include directories. This stops the situation where an mpi-specific
  version of ptscotch.h is installed into the MPI directories.

  This "system" version may well have a different SCOTCH_Num size
  (32 bit vs 64 bit) from the third-party library etc.
This commit is contained in:
Mark Olesen
2018-12-11 18:50:19 +01:00
parent 69f257adc7
commit a93a1abec7
6 changed files with 46 additions and 23 deletions

View File

@ -27,12 +27,23 @@ License
#include "addToRunTimeSelectionTable.H"
#include "Time.H"
extern "C"
{
// Probably not needed...
#define MPICH_SKIP_MPICXX
#define OMPI_SKIP_MPICXX
#include "metis.h"
}
#include "metis.h"
// Provide a clear error message if we have a size mismatch
//
// Metis has an 'idx_t' type, but the IDXTYPEWIDTH define is perhaps
// more future-proof?
#ifdef IDXTYPEWIDTH
static_assert
(
sizeof(Foam::label) == (IDXTYPEWIDTH/8),
"sizeof(Foam::label) == (IDXTYPEWIDTH/8), check your metis headers"
);
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,10 +1,15 @@
/*
* NB: mplib PINC must appear after the SCOTCH_ARCH_PATH/include/FOAM_MPI
* to ensure we do not accidentally get a ptscotch header from the
* mpi distribution.
*/
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
EXE_INC = \
$(PFLAGS) $(PINC) \
-I$(SCOTCH_INC_DIR) \
-I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
-I$(SCOTCH_INC_DIR) \
$(PFLAGS) $(PINC) \
-I../decompositionMethods/lnInclude
/*
@ -13,8 +18,8 @@ EXE_INC = \
*/
LIB_LIBS = \
-L$(SCOTCH_LIB_DIR) \
-L$(FOAM_EXT_LIBBIN) \
-L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) \
-L$(FOAM_EXT_LIBBIN) \
-lptscotch -lptscotcherrexit \
-lscotch

View File

@ -207,6 +207,7 @@ License
#include "globalIndex.H"
#include "SubField.H"
// Avoid too many warnings from mpi.h
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <cstdio>
@ -222,6 +223,13 @@ License
#include <fenv.h>
#endif
// Provide a clear error message if we have a size mismatch
static_assert
(
sizeof(Foam::label) == sizeof(SCOTCH_Num),
"sizeof(Foam::label) == sizeof(SCOTCH_Num), check your scotch headers"
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,12 +1,4 @@
/*
* Note including of mplib compilation rules.
* This is purely to avoid scotch.h including mpicxx.h, which causes problems.
*/
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
EXE_INC = \
$(PFLAGS) $(PINC) \
-I$(SCOTCH_INC_DIR) \
-I../decompositionMethods/lnInclude

View File

@ -127,13 +127,13 @@ License
#include "Time.H"
#include "OFstream.H"
extern "C"
{
// Probably not needed, but in case we pickup a ptscotch.h ...
#define MPICH_SKIP_MPICXX
#define OMPI_SKIP_MPICXX
#include "scotch.h"
}
// Hack: scotch generates floating point errors so need to switch of error
// Hack: scotch generates floating point errors so need to switch off error
// trapping!
#ifdef __GLIBC__
#ifndef _GNU_SOURCE
@ -142,6 +142,13 @@ extern "C"
#include <fenv.h>
#endif
// Provide a clear error message if we have a size mismatch
static_assert
(
sizeof(Foam::label) == sizeof(SCOTCH_Num),
"sizeof(Foam::label) == sizeof(SCOTCH_Num), check your scotch headers"
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,11 +2,11 @@ sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
EXE_INC = \
-I$(ZOLTAN_INC_DIR) \
$(PFLAGS) $(PINC) \
${c++LESSWARN} \
-I$(LIB_SRC)/renumber/renumberMethods/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(ZOLTAN_INC_DIR)
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-L$(ZOLTAN_LIB_DIR) -lzoltan \