sci-mathematics/petsc: do not run mpiexec during configure
authorMatthias Maier <tamiko@gentoo.org>
Thu, 14 Nov 2019 22:27:16 +0000 (16:27 -0600)
committerMatthias Maier <tamiko@gentoo.org>
Thu, 14 Nov 2019 22:27:16 +0000 (16:27 -0600)
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Matthias Maier <tamiko@gentoo.org>
sci-mathematics/petsc/files/petsc-3.12.1-do_not_run_mpiexec.patch [new file with mode: 0644]
sci-mathematics/petsc/petsc-3.12.1.ebuild

diff --git a/sci-mathematics/petsc/files/petsc-3.12.1-do_not_run_mpiexec.patch b/sci-mathematics/petsc/files/petsc-3.12.1-do_not_run_mpiexec.patch
new file mode 100644 (file)
index 0000000..9c3d504
--- /dev/null
@@ -0,0 +1,32 @@
+diff --git a/config/BuildSystem/config/packages/MPI.py b/config/BuildSystem/config/packages/MPI.py
+index c85bb504..7720eba9 100644
+--- a/config/BuildSystem/config/packages/MPI.py
++++ b/config/BuildSystem/config/packages/MPI.py
+@@ -209,26 +209,11 @@ shared libraries and run with --known-mpi-shared-libraries=1')
+           raise RuntimeError('Could not locate MPIEXEC - please specify --with-mpiexec option')
+       # Support for spaces and () in executable names; also needs to handle optional arguments at the end
+       # TODO: This support for spaces and () should be moved to core BuildSystem
+-      self.mpiexec = self.mpiexec.replace(' ', '\\ ').replace('(', '\\(').replace(')', '\\)').replace('\ -',' -')
+-      if (hasattr(self, 'ompi_major_version') and int(self.ompi_major_version) >= 3):
+-        (out, err, ret) = Configure.executeShellCommand(self.mpiexec+' -help all', checkCommand = noCheck, timeout = 10, log = self.log)
+-        if out.find('--oversubscribe') >=0:
+-          self.mpiexec = self.mpiexec + ' --oversubscribe'
++      self.mpiexec = self.mpiexec + ' --oversubscribe'
+     # using mpiexec environmental variables make sure mpiexec matches the MPI libraries and save the variables for testing in PetscInitialize()
+     # the variable HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE is not currently used. PetscInitialize() can check the existence of the environmental variable to
+     # determine if the program has been started with the correct mpiexec (will only be set for parallel runs so not clear how to check appropriately)
+-    (out, err, ret) = Configure.executeShellCommand(self.mpiexec+' -n 1 printenv', checkCommand = noCheck, timeout = 10, log = self.log)
+-    if ret: raise RuntimeError('Unable to run '+self.mpiexec+' with option "-n 1"\n'+err)
+-    if out.find('MPIR_CVAR_CH3') > -1:
+-      if hasattr(self,'ompi_major_version'): raise RuntimeError("Your libraries are from OpenMPI but it appears your mpiexec is from MPICH");
+-      self.addDefine('HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE', 'MPIR_CVAR_CH3')
+-    elif  out.find('MPIR_CVAR_CH3') > -1:
+-      if hasattr(self,'ompi_major_version'): raise RuntimeError("Your libraries are from OpenMPI but it appears your mpiexec is from MPICH");
+-      self.addDefine('HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE', 'MPICH')
+-    elif out.find('OMPI_COMM_WORLD_SIZE') > -1:
+-      if hasattr(self,'mpich_numversion'): raise RuntimeError("Your libraries are from MPICH but it appears your mpiexec is from OpenMPI");
+-      self.addDefine('HAVE_MPIEXEC_ENVIRONMENTAL_VARIABLE', 'OMP')
+     self.addMakeMacro('MPIEXEC', self.mpiexec)
+     self.mpiexec = self.mpiexec + ' -n 1'
index c2b32ce1afbf232d5bb8e027abd444db3b6174b5..2e5365823ea644d5e46f1f26b1c7b0dc1be7c58d 100644 (file)
@@ -56,6 +56,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-3.7.0-disable-rpath.patch
        "${FILESDIR}"/${PN}-3.9.0-fix_sandbox_violation.patch
        "${FILESDIR}"/${PN}-3.12.1-make_hypre_configure.patch
+       "${FILESDIR}"/${PN}-3.12.1-do_not_run_mpiexec.patch
 )
 
 src_prepare() {