PETSc/config/BuildSystem/config/packages/MPI.py

From Arbeitsgruppe Kuiper
Revision as of 16:48, 13 June 2025 by Lothar.brendel (talk | contribs) (→‎Patch: 1140850688)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Patch

 --- petsc-3.1-p8/config/BuildSystem/config/packages/MPI.py~     2025-06-13 10:40:37.944362909 +0200
 +++ petsc-3.1-p8/config/BuildSystem/config/packages/MPI.py      2025-06-13 10:51:54.113711183 +0200
 @@ -198,7 +198,7 @@
      oldLibs  = self.compilers.LIBS
      self.compilers.CPPFLAGS += ' '+self.headers.toString(self.include)
      self.compilers.LIBS = self.libraries.toString(self.lib)+' '+self.compilers.LIBS
 -    if self.checkLink('#include <mpi.h>\n', 'if (MPI_Comm_f2c(MPI_COMM_WORLD));\n'):
 +    if self.checkLink('#include <mpi.h>\n', 'if (MPI_Comm_f2c(1140850688));\n'):
        self.commf2c = 1
        self.addDefine('HAVE_MPI_COMM_F2C', 1)
      if self.checkLink('#include <mpi.h>\n', 'if (MPI_Comm_c2f(MPI_COMM_WORLD));\n'):

MPI_Comm_f2c() expects an int. A failure of this check makes HAVE_MPI_COMM_F2C not being defined, which in turn activates the dubious macro #define MPI_Comm_f2c(a) (a) (i.e. a substitution by the identity) in "conffix.h", which in turns ruins the prototype in <mpi.h>.

Remark: The number 1140850688 (=0x44000000) is not important, it's just that MPICH used it to mean MPI_COMM_WORLD in Fortran.