33#
44# SPDX-License-Identifier: (Apache-2.0 OR MIT)
55
6+ import os
7+
68import llnl .util .tty as tty
79
810from spack .package import *
@@ -43,13 +45,19 @@ class Hpctoolkit(AutotoolsPackage):
4345
4446 # Options for MPI and hpcprof-mpi. We always support profiling
4547 # MPI applications. These options add hpcprof-mpi, the MPI
46- # version of hpcprof. Cray and Blue Gene need separate options
47- # because an MPI module in packages.yaml doesn't work on these
48- # systems.
48+ # version of hpcprof. Cray needs a separate option because an
49+ # external MPI module in packages.yaml doesn't work.
4950 variant (
5051 "cray" ,
5152 default = False ,
52- description = "Build for Cray compute nodes, including hpcprof-mpi." ,
53+ description = "Build hpcprof-mpi for Cray systems (requires --dirty)." ,
54+ )
55+
56+ variant (
57+ "cray-static" ,
58+ default = False ,
59+ description = "Build old rev of hpcprof-mpi statically on Cray systems." ,
60+ when = "@:2022.09" ,
5361 )
5462
5563 variant (
@@ -120,7 +128,7 @@ class Hpctoolkit(AutotoolsPackage):
120128 depends_on ("mbedtls+pic" , when = "@:2022.03" )
121129 depends_on ("xerces-c transcoder=iconv" )
122130 depends_on ("xz+pic@:5.2.6" , type = "link" )
123- depends_on (
"[email protected] :" ,
when = "@2022.10:" )
131+ depends_on (
"[email protected] : +shared " ,
when = "@2022.10:" )
124132 depends_on ("zlib+shared" )
125133
126134 depends_on ("cuda" , when = "+cuda" )
@@ -150,12 +158,15 @@ class Hpctoolkit(AutotoolsPackage):
150158
151159 conflicts (
"^[email protected] :2.35.1" ,
msg = "avoid binutils 2.35 and 2.35.1 (spews errors)" )
152160
161+ conflicts ("+cray" , when = "@2022.10.01" , msg = "hpcprof-mpi is not available in 2022.10.01" )
162+ conflicts ("+mpi" , when = "@2022.10.01" , msg = "hpcprof-mpi is not available in 2022.10.01" )
163+
153164 # Fix the build for old revs with gcc 10.x.
154165 patch (
"gcc10-enum.patch" ,
when = "@2020.01.01:2020.08 %[email protected] :" )
155166
156167 patch (
157- "https://github .com/HPCToolkit /hpctoolkit/commit/511afd95b01d743edc5940c84e0079f462b2c23e.patch?full_index=1 " ,
158- sha256 = "c8371b929f45dafae37d2ef17880fcfb86de893beebaec501a282bc04b61ef64 " ,
168+ "https://gitlab .com/hpctoolkit /hpctoolkit/-/ commit/511afd95b01d743edc5940c84e0079f462b2c23e.patch" ,
169+ sha256 = "8da18df88a80847c092da8d0892de51ea2bf2523124148b6305ab8717707d897 " ,
159170 when = "@2019.08.01:2021.03 %[email protected] :" ,
160171 )
161172
@@ -171,6 +182,13 @@ class Hpctoolkit(AutotoolsPackage):
171182 depends_on (
"[email protected] :" ,
type = "build" ,
when = "@2020.03:2020.08" )
172183 patch ("python3.patch" , when = "@2020.03:2020.08" )
173184
185+ # Fix a bug where make would mistakenly overwrite hpcrun-fmt.h.
186+ # https://gitlab.com/hpctoolkit/hpctoolkit/-/merge_requests/751
187+ def patch (self ):
188+ with working_dir (join_path ("src" , "lib" , "prof-lean" )):
189+ if os .access ("hpcrun-fmt.txt" , os .F_OK ):
190+ os .rename ("hpcrun-fmt.txt" , "hpcrun-fmt.readme" )
191+
174192 flag_handler = AutotoolsPackage .build_system_flags
175193
176194 def configure_args (self ):
@@ -239,18 +257,16 @@ def configure_args(self):
239257 ]
240258 )
241259
242- # MPI options for hpcprof-mpi.
243- if "+cray" in spec :
260+ # MPI options for hpcprof-mpi. +cray supersedes +mpi.
261+ if spec . satisfies ( "+cray" ) :
244262 args .append ("--enable-mpi-search=cray" )
245- args .append ("--enable-all-static" )
246-
247- elif "+mpi" in spec :
248- if spec .satisfies ("@2022.10.01" ):
249- # temporary hack to disable +mpi for one rev
250- tty .warn ("hpcprof-mpi is not available in version 2022.10.01" )
251- args .append ("MPICXX=" )
263+ if spec .satisfies ("@:2022.09 +cray-static" ):
264+ args .append ("--enable-all-static" )
252265 else :
253- args .append ("MPICXX=%s" % spec ["mpi" ].mpicxx )
266+ args .append ("HPCPROFMPI_LT_LDFLAGS=-dynamic" )
267+
268+ elif spec .satisfies ("+mpi" ):
269+ args .append ("MPICXX=%s" % spec ["mpi" ].mpicxx )
254270
255271 # Make sure MPICXX is not picked up through the environment.
256272 else :
0 commit comments