From b09ad2cc8c5f371e39c61dac7fca3d89d6ffbc6c Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Thu, 16 Sep 2021 13:24:17 +0200 Subject: 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 --- var/spack/repos/builtin/packages/asio/package.py | 2 +- var/spack/repos/builtin/packages/hpx/package.py | 120 +++++++++++++++-------- 2 files changed, 82 insertions(+), 40 deletions(-) diff --git a/var/spack/repos/builtin/packages/asio/package.py b/var/spack/repos/builtin/packages/asio/package.py index 2e08b78eef..33e2faced5 100644 --- a/var/spack/repos/builtin/packages/asio/package.py +++ b/var/spack/repos/builtin/packages/asio/package.py @@ -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", diff --git a/var/spack/repos/builtin/packages/hpx/package.py b/var/spack/repos/builtin/packages/hpx/package.py index 1821d21b6e..7767744b42 100644 --- a/var/spack/repos/builtin/packages/hpx/package.py +++ b/var/spack/repos/builtin/packages/hpx/package.py @@ -9,7 +9,7 @@ import sys 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,61 +72,91 @@ 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') - - # 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') - - # 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 - depends_on('boost@:1.72.0', when='@:1.4') - - # COROUTINES - # ~generic_coroutines conflict is not fully implemented - # for additional information see: - # https://github.com/spack/spack/pull/17654 - # https://github.com/STEllAR-GROUP/hpx/issues/4829 - depends_on('boost+context', when='+generic_coroutines') - _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') + # 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), + ) - # 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') + # 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 + depends_on('boost@:1.72.0', when='@:1.4') + + # COROUTINES + # ~generic_coroutines conflict is not fully implemented + # for additional information see: + # https://github.com/spack/spack/pull/17654 + # https://github.com/STEllAR-GROUP/hpx/issues/4829 + depends_on('boost+context', when='+generic_coroutines') + _msg_generic_coroutines = 'This platform requires +generic_coroutines' + conflicts('~generic_coroutines', when='platform=darwin', msg=_msg_generic_coroutines) + # Patches APEX patch('git_external.patch', when='@1.3.0 instrumentation=apex') @@ -147,6 +178,7 @@ class Hpx(CMakePackage, CudaPackage): 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 @@ class Hpx(CMakePackage, CudaPackage): 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() -- cgit v1.2.3-70-g09d2