summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Junghans <christoph.junghans@gmail.com>2018-12-05 06:15:16 -0700
committerGitHub <noreply@github.com>2018-12-05 06:15:16 -0700
commitd149ab63a99151332f048452ad60bffd429a290e (patch)
tree1b1f3cd01f8e90ced9e70778387afcd6d18d19a4
parent583617ed6796c5a62aebfe15b6009a12669fb894 (diff)
downloadspack-d149ab63a99151332f048452ad60bffd429a290e.tar.gz
spack-d149ab63a99151332f048452ad60bffd429a290e.tar.bz2
spack-d149ab63a99151332f048452ad60bffd429a290e.tar.xz
spack-d149ab63a99151332f048452ad60bffd429a290e.zip
pfunit: add mpi-test patch (#9387)
-rw-r--r--var/spack/repos/builtin/packages/pfunit/mpi-test.patch35
-rw-r--r--var/spack/repos/builtin/packages/pfunit/package.py4
2 files changed, 39 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/pfunit/mpi-test.patch b/var/spack/repos/builtin/packages/pfunit/mpi-test.patch
new file mode 100644
index 0000000000..30fcd0c85a
--- /dev/null
+++ b/var/spack/repos/builtin/packages/pfunit/mpi-test.patch
@@ -0,0 +1,35 @@
+From Ferenbaugh, Charles <cferenba@lanl.gov>
+
+This patch modifies pfunit to be usable by codes that have MPI_COMM_WORLD hardcoded
+as their communicator, by skipping over any tests whose PE count does not match the
+size of the current MPI_COMM_WORLD.
+--- pFUnit-3.2.8/source/TestSuite.F90 2016-09-05 17:55:26.000000000 -0600
++++ pFUnit-3.2.8.mod1/source/TestSuite.F90 2017-01-04 12:41:24.818441000 -0700
+@@ -117,6 +117,9 @@
+ end subroutine run
+
+ recursive subroutine addTest(this, aTest)
++#ifdef USE_MPI
++ use MpiTestCase_mod
++#endif
+ class (TestSuite), intent(inout) :: this
+ class (Test), intent(in) :: aTest
+ #ifdef DEFERRED_LENGTH_CHARACTER
+@@ -129,6 +134,17 @@
+ integer :: suiteNameLength
+ integer :: testNameLength
+ #endif
++#ifdef USE_MPI
++ integer :: numpe, error
++ include 'mpif.h'
++
++ select type (t => aTest)
++ class is (MpiTestCase)
++ call MPI_Comm_size(MPI_COMM_WORLD, numpe, error)
++ if (t%getNumProcessesRequested() /= numpe) return
++ end select
++#endif
++
+ call extend(this%tests)
+ allocate(this%tests(this%getNumTests())%pTest, source=aTest)
+ #ifdef DEFERRED_LENGTH_CHARACTER
diff --git a/var/spack/repos/builtin/packages/pfunit/package.py b/var/spack/repos/builtin/packages/pfunit/package.py
index e9faaaebbf..62f7e44fe1 100644
--- a/var/spack/repos/builtin/packages/pfunit/package.py
+++ b/var/spack/repos/builtin/packages/pfunit/package.py
@@ -22,12 +22,16 @@ class Pfunit(CMakePackage):
variant('shared', default=True,
description='Build shared library in addition to static')
variant('mpi', default=False, description='Enable MPI')
+ variant('use_comm_world', default=False, description='Enable MPI_COMM_WORLD for testing')
variant('openmp', default=False, description='Enable OpenMP')
variant('docs', default=False, description='Build docs')
depends_on('python@2.7:', type=('build', 'run')) # python3 too!
depends_on('mpi', when='+mpi')
+ conflicts("use_comm_world", when="~mpi")
+ patch("mpi-test.patch", when="+use_comm_world")
+
def patch(self):
# The package tries to put .mod files in directory ./mod;
# spack needs to put them in a standard location: