Update HPX package (#25775)

* Add support for C++20 to HPX package

* Enable unity builds in HPX package when available

* Add support for HIP/ROCm to HPX package

* Rearrange and update required versions for HPX package

* Add C++20 option to asio package
This commit is contained in:
Mikael Simberg 2021-09-16 13:24:17 +02:00 committed by GitHub
parent ccfdac8402
commit b09ad2cc8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 40 deletions

View File

@ -26,7 +26,7 @@ class Asio(AutotoolsPackage):
depends_on("m4", type="build")
depends_on("libtool", type="build")
stds = ("11", "14", "17")
stds = ("11", "14", "17", "2a")
variant(
"cxxstd",
default="11",

View File

@ -9,7 +9,7 @@
from spack import *
class Hpx(CMakePackage, CudaPackage):
class Hpx(CMakePackage, CudaPackage, ROCmPackage):
"""C++ runtime system for parallel and distributed applications."""
homepage = "https://hpx.stellar-group.org/"
@ -31,11 +31,12 @@ class Hpx(CMakePackage, CudaPackage):
version('1.1.0', sha256='1f28bbe58d8f0da600d60c3a74a644d75ac777b20a018a5c1c6030a470e8a1c9')
generator = 'Ninja'
depends_on('ninja', type='build')
map_cxxstd = lambda cxxstd: '2a' if cxxstd == '20' else cxxstd
cxxstds = ('11', '14', '17', '20')
variant('cxxstd',
default='17',
values=('11', '14', '17', '20'),
values=cxxstds,
description='Use the specified C++ standard when building.')
variant(
@ -71,19 +72,77 @@ class Hpx(CMakePackage, CudaPackage):
variant('async_mpi', default=False, description='Enable MPI Futures.')
variant('async_cuda', default=False, description='Enable CUDA Futures.')
depends_on('hwloc')
# Build dependencies
depends_on('python', type=('build', 'test', 'run'))
depends_on('ninja', type='build')
depends_on('pkgconfig', type='build')
depends_on('git', type='build')
depends_on('cmake', type='build')
# Recommended dependency versions for 1.2.X
depends_on('cmake@3.9.0:', when='@:1.2.1', type='build')
depends_on('boost@1.62.0:', when='@:1.2.1')
depends_on('hwloc@1.11:', when='@:1.2.1')
# Other dependecies
depends_on('hwloc')
depends_on('boost')
for cxxstd in cxxstds:
depends_on(
"boost cxxstd={0}".format(map_cxxstd(cxxstd)),
when="cxxstd={0}".format(cxxstd)
)
depends_on('asio', when='@1.7:')
for cxxstd in cxxstds:
depends_on(
"asio cxxstd={0}".format(map_cxxstd(cxxstd)),
when="cxxstd={0} ^asio".format(cxxstd),
)
# Recommended dependency versions before 1.2
depends_on('boost@1.55.0:', when='@:1.1.0')
depends_on('hwloc@1.6:', when='@:1.1.0')
depends_on('gperftools', when='malloc=tcmalloc')
depends_on('jemalloc', when='malloc=jemalloc')
depends_on('tbb', when='malloc=tbbmalloc')
depends_on('mpi', when='networking=mpi')
depends_on('mpi', when='+async_mpi')
depends_on('cuda', when='+async_cuda')
depends_on('otf2', when='instrumentation=apex')
depends_on('gperftools', when='instrumentation=google_perftools')
depends_on('papi', when='instrumentation=papi')
depends_on('valgrind', when='instrumentation=valgrind')
# Restrictions for stable/master
with when("@master"):
conflicts("cxxstd=14")
depends_on("cuda@11:", when="+cuda")
with when("@stable"):
conflicts("cxxstd=14")
depends_on("cuda@11:", when="+cuda")
# Restrictions for 1.7.X
with when('@1.7:'):
depends_on('cmake@3.18.0:', type='build')
depends_on('boost@1.71.0:')
depends_on('asio@1.12.0:')
conflicts('%gcc@:6')
conflicts('%clang@:6')
# Restrictions for 1.6.X
conflicts('+rocm', when='@:1.5')
# Restrictions for 1.5.x
conflicts('cxxstd=11', when='@1.5:')
# Restrictions for 1.2.X
with when('@:1.2.1'):
depends_on('cmake@3.9.0:', type='build')
depends_on('boost@1.62.0:')
depends_on('hwloc@1.11:')
# Restrictions before 1.2
with when('@:1.1.0'):
depends_on('boost@1.55.0:')
depends_on('hwloc@1.6:')
# Patches and one-off conflicts
# boost 1.73.0 build problem with HPX 1.4.0 and 1.4.1
# https://github.com/STEllAR-GROUP/hpx/issues/4728#issuecomment-640685308
@ -98,34 +157,6 @@ class Hpx(CMakePackage, CudaPackage):
_msg_generic_coroutines = 'This platform requires +generic_coroutines'
conflicts('~generic_coroutines', when='platform=darwin', msg=_msg_generic_coroutines)
# Asio
depends_on('asio cxxstd=11', when='@1.7: cxxstd=11')
depends_on('asio cxxstd=14', when='@1.7: cxxstd=14')
depends_on('asio cxxstd=17', when='@1.7: cxxstd=17')
# CXX Standard
depends_on('boost cxxstd=11', when='cxxstd=11')
depends_on('boost cxxstd=14', when='cxxstd=14')
depends_on('boost cxxstd=17', when='cxxstd=17')
# Malloc
depends_on('gperftools', when='malloc=tcmalloc')
depends_on('jemalloc', when='malloc=jemalloc')
depends_on('tbb', when='malloc=tbbmalloc')
# MPI
depends_on('mpi', when='networking=mpi')
depends_on('mpi', when='+async_mpi')
# CUDA
depends_on('cuda', when='+async_cuda')
# Instrumentation
depends_on('otf2', when='instrumentation=apex')
depends_on('gperftools', when='instrumentation=google_perftools')
depends_on('papi', when='instrumentation=papi')
depends_on('valgrind', when='instrumentation=valgrind')
# Patches APEX
patch('git_external.patch', when='@1.3.0 instrumentation=apex')
@ -147,6 +178,7 @@ def cmake_args(self):
self.define_from_variant('HPX_WITH_MALLOC', 'malloc'),
self.define_from_variant('HPX_WITH_CUDA', 'cuda'),
self.define_from_variant('HPX_WITH_HIP', 'rocm'),
self.define_from_variant('HPX_WITH_TOOLS', 'tools'),
self.define_from_variant('HPX_WITH_EXAMPLES', 'examples'),
self.define_from_variant('HPX_WITH_ASYNC_MPI', 'async_mpi'),
@ -169,6 +201,16 @@ def cmake_args(self):
self.define('HPX_DATASTRUCTURES_WITH_ADAPT_STD_TUPLE', False),
]
# Enable unity builds when available
if spec.satisfies("@1.7:"):
args += [self.define('HPX_WITH_UNITY_BUILD', True)]
# HIP support requires compiling with hipcc
if '+rocm' in self.spec:
args += [self.define('CMAKE_CXX_COMPILER', self.spec['hip'].hipcc)]
if self.spec.satisfies('^cmake@3.21:'):
args += [self.define('__skip_rocmclang', True)]
# Instrumentation
args += self.instrumentation_args()