From 7e8b17b177aa0ca5e8aab5020f5bbf26ca6b34bf Mon Sep 17 00:00:00 2001
From: "Mark W. Krentel" <krentel@rice.edu>
Date: Thu, 10 Jan 2019 14:50:58 -0600
Subject: [PATCH] hpctoolkit: variants to build for cray and blue gene (#10223)

Add variants 'cray' and 'bgq' to build for Cray and Blue Gene compute
nodes.  These systems need separate options to find the MPI compiler
for hpcprof-mpi.
---
 .../builtin/packages/hpctoolkit/package.py    | 45 ++++++++++++++-----
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/var/spack/repos/builtin/packages/hpctoolkit/package.py b/var/spack/repos/builtin/packages/hpctoolkit/package.py
index f7666260de..83ff35ead1 100644
--- a/var/spack/repos/builtin/packages/hpctoolkit/package.py
+++ b/var/spack/repos/builtin/packages/hpctoolkit/package.py
@@ -18,17 +18,22 @@ class Hpctoolkit(AutotoolsPackage):
     git      = "https://github.com/HPCToolkit/hpctoolkit.git"
 
     version('develop', branch='master')
+    version('2018.12.28', commit='8dbf0d543171ffa9885344f32f23cc6f7f6e39bc')
     version('2018.11.05', commit='d0c43e39020e67095b1f1d8bb89b75f22b12aee9')
 
-    # We can't build with both PAPI and perfmon for risk of segfault
-    # from mismatched header files (unless PAPI installs the perfmon
-    # headers).
-    variant('papi', default=False,
-            description='Use PAPI instead of perfmon for access to '
-            'the hardware performance counters.')
+    # Options for MPI and hpcprof-mpi.  We always support profiling
+    # MPI applications.  These options add hpcprof-mpi, the MPI
+    # version of hpcprof.  Cray and Blue Gene need separate options
+    # because an MPI module in packages.yaml doesn't work on these
+    # systems.
+    variant('cray', default=False,
+            description='Build for Cray compute nodes, including '
+            'hpcprof-mpi.')
+
+    variant('bgq', default=False,
+            description='Build for Blue Gene compute nodes, including '
+            'hpcprof-mpi.')
 
-    # We always support profiling MPI applications.  +mpi builds
-    # hpcprof-mpi, the MPI version of hpcprof.
     variant('mpi', default=False,
             description='Build hpcprof-mpi, the MPI version of hpcprof.')
 
@@ -36,6 +41,13 @@ class Hpctoolkit(AutotoolsPackage):
             description='Needed when MPICXX builds static binaries '
             'for the compute nodes.')
 
+    # We can't build with both PAPI and perfmon for risk of segfault
+    # from mismatched header files (unless PAPI installs the perfmon
+    # headers).
+    variant('papi', default=False,
+            description='Use PAPI instead of perfmon for access to '
+            'the hardware performance counters.')
+
     boost_libs = '+atomic +graph +regex +serialization'  \
         '+shared +multithreaded'
 
@@ -46,7 +58,8 @@ class Hpctoolkit(AutotoolsPackage):
     depends_on('elfutils~nls')
     depends_on('intel-tbb')
     depends_on('libdwarf')
-    depends_on('libmonitor+hpctoolkit')
+    depends_on('libmonitor+hpctoolkit', when='~bgq')
+    depends_on('libmonitor+hpctoolkit+bgq', when='+bgq')
     depends_on('libunwind@2018.10.0:')
     depends_on('xerces-c transcoder=iconv')
     depends_on('xz')
@@ -86,7 +99,19 @@ def configure_args(self):
         else:
             args.append('--with-perfmon=%s' % spec['libpfm4'].prefix)
 
-        if '+mpi' in spec:
+        # MPI options for hpcprof-mpi.
+        if '+cray' in spec:
+            args.extend([
+                '--enable-mpi-search=cray',
+                '--enable-all-static',
+            ])
+        elif '+bgq' in spec:
+            args.extend([
+                '--enable-mpi-search=bgq',
+                '--enable-all-static',
+                '--enable-bgq',
+            ])
+        elif '+mpi' in spec:
             args.append('MPICXX=%s' % spec['mpi'].mpicxx)
 
         if '+all-static' in spec:
-- 
GitLab