From 8e998247a3ddcc2f623772f4d467c16ac829a688 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 28 Mar 2018 10:13:56 +0200 Subject: [PATCH] openmpi: updated package (#7574) Modifications: * Added zlib dependency, starting from version 3.0.0 * Added memchecker support for debugging * Remove mpirun and similar links if slurm is selected as a scheduler --- .../repos/builtin/packages/openmpi/package.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index 0c6180923f..b019a118a9 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -201,6 +201,17 @@ class Openmpi(AutotoolsPackage): variant('cuda', default=False, description='Enable CUDA support') variant('ucx', default=False, description='Enable UCX support') variant('pmi', default=False, description='Enable PMI support') + # Adding support to build a debug version of OpenMPI that activates + # Memchecker, as described here: + # + # https://www.open-mpi.org/faq/?category=debugging#memchecker_what + # + # This option degrades run-time support, and thus is disabled by default + variant( + 'memchecker', + default=False, + description='Memchecker support for debugging [degrades performance]' + ) provides('mpi') provides('mpi@:2.2', when='@1.6.5') @@ -218,6 +229,8 @@ class Openmpi(AutotoolsPackage): depends_on('java', when='+java') depends_on('sqlite', when='+sqlite3@:1.11') depends_on('ucx', when='+ucx') + depends_on('zlib', when='@3.0.0:') + depends_on('valgrind~mpi', when='+memchecker') conflicts('+cuda', when='@:1.6') # CUDA support was added in 1.7 conflicts('fabrics=psm2', when='@:1.8') # PSM2 support was added in 1.10.0 @@ -320,6 +333,9 @@ def configure_args(self): # for Open-MPI 2.0:, C++ bindings are disabled by default. config_args.extend(['--enable-mpi-cxx']) + if spec.satisfies('@3.0.0:', strict=True): + config_args.append('--with-zlib={0}'.format(spec['zlib'].prefix)) + # Fabrics config_args.extend(self.with_or_without('fabrics')) # Schedulers @@ -327,6 +343,13 @@ def configure_args(self): # PMI config_args.extend(self.with_or_without('pmi')) + config_args.extend(self.enable_or_disable('memchecker')) + if spec.satisfies('+memchecker', strict=True): + config_args.extend([ + '--enable-debug', + '--with-valgrind={0}'.format(spec['valgrind'].prefix), + ]) + # Hwloc support if spec.satisfies('@1.5.2:'): config_args.append('--with-hwloc={0}'.format(spec['hwloc'].prefix)) @@ -398,3 +421,18 @@ def configure_args(self): config_args.append('--without-ucx') return config_args + + @run_after('install') + def delete_mpirun_mpiexec(self): + # The preferred way to run an application when Slurm is the + # scheduler is to let Slurm manage process spawning via PMI. + # + # Deleting the links to orterun avoids users running their + # applications via mpirun or mpiexec, and leaves srun as the + # only sensible choice (orterun is still present, but normal + # users don't know about that). + if '@1.6: schedulers=slurm' in self.spec: + os.remove(self.prefix.bin.mpirun) + os.remove(self.prefix.bin.mpiexec) + os.remove(self.prefix.bin.shmemrun) + os.remove(self.prefix.bin.oshrun)