legion: add HIP support (#31080)
This commit is contained in:
parent
d76f184430
commit
c72d51cb3a
1 changed files with 33 additions and 5 deletions
|
@ -8,7 +8,7 @@
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
class Legion(CMakePackage):
|
class Legion(CMakePackage, ROCmPackage):
|
||||||
"""Legion is a data-centric parallel programming system for writing
|
"""Legion is a data-centric parallel programming system for writing
|
||||||
portable high performance programs targeted at distributed heterogeneous
|
portable high performance programs targeted at distributed heterogeneous
|
||||||
architectures. Legion presents abstractions which allow programmers to
|
architectures. Legion presents abstractions which allow programmers to
|
||||||
|
@ -50,13 +50,29 @@ class Legion(CMakePackage):
|
||||||
# TODO: we could use a map here to clean up and use naming vs. numbers.
|
# TODO: we could use a map here to clean up and use naming vs. numbers.
|
||||||
cuda_arch_list = ('60', '70', '75', '80')
|
cuda_arch_list = ('60', '70', '75', '80')
|
||||||
for nvarch in cuda_arch_list:
|
for nvarch in cuda_arch_list:
|
||||||
depends_on('kokkos@3.3.01+cuda+cuda_lambda+wrapper cuda_arch={0}'.format(nvarch),
|
depends_on('kokkos@3.3.01:+cuda+cuda_lambda+wrapper cuda_arch={0}'.format(nvarch),
|
||||||
when='%gcc+kokkos+cuda cuda_arch={0}'.format(nvarch))
|
when='%gcc+kokkos+cuda cuda_arch={0}'.format(nvarch))
|
||||||
depends_on("kokkos@3.3.01+cuda+cuda_lambda~wrapper cuda_arch={0}".format(nvarch),
|
depends_on("kokkos@3.3.01:+cuda+cuda_lambda~wrapper cuda_arch={0}".format(nvarch),
|
||||||
when="%clang+kokkos+cuda cuda_arch={0}".format(nvarch))
|
when="%clang+kokkos+cuda cuda_arch={0}".format(nvarch))
|
||||||
|
|
||||||
depends_on('kokkos@3.3.01~cuda', when='+kokkos~cuda')
|
depends_on('kokkos@3.3.01:~cuda', when='+kokkos~cuda')
|
||||||
depends_on("kokkos@3.3.01~cuda+openmp", when='+kokkos+openmp')
|
depends_on("kokkos@3.3.01:~cuda+openmp", when='+kokkos+openmp')
|
||||||
|
|
||||||
|
# HIP specific
|
||||||
|
variant('hip_hijack', default=False,
|
||||||
|
description="Hijack application calls into the HIP runtime",
|
||||||
|
when='+rocm')
|
||||||
|
variant('hip_target', default='ROCM',
|
||||||
|
values=('ROCM', 'CUDA'),
|
||||||
|
description="API used by HIP",
|
||||||
|
multi=False,
|
||||||
|
when='+rocm')
|
||||||
|
|
||||||
|
for arch in ROCmPackage.amdgpu_targets:
|
||||||
|
depends_on('kokkos@3.3.01:+rocm amdgpu_target={0}'.format(arch),
|
||||||
|
when='+rocm amdgpu_target={0}'.format(arch))
|
||||||
|
|
||||||
|
depends_on('kokkos@3.3.01:+rocm', when='+kokkos+rocm')
|
||||||
|
|
||||||
depends_on('python@3', when='+python')
|
depends_on('python@3', when='+python')
|
||||||
depends_on('papi', when='+papi')
|
depends_on('papi', when='+papi')
|
||||||
|
@ -205,6 +221,11 @@ def validate_gasnet_root(value):
|
||||||
variant('max_fields', values=int, default=512,
|
variant('max_fields', values=int, default=512,
|
||||||
description="Maximum number of fields allowed in a logical region.")
|
description="Maximum number of fields allowed in a logical region.")
|
||||||
|
|
||||||
|
def setup_build_environment(self, build_env):
|
||||||
|
spec = self.spec
|
||||||
|
if '+rocm' in spec:
|
||||||
|
build_env.set("HIP_PATH", spec['hip'].prefix)
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
cmake_cxx_flags = []
|
cmake_cxx_flags = []
|
||||||
|
@ -273,6 +294,13 @@ def cmake_args(self):
|
||||||
if '+cuda_unsupported_compiler' in spec:
|
if '+cuda_unsupported_compiler' in spec:
|
||||||
options.append('-DCUDA_NVCC_FLAGS:STRING=--allow-unsupported-compiler')
|
options.append('-DCUDA_NVCC_FLAGS:STRING=--allow-unsupported-compiler')
|
||||||
|
|
||||||
|
if '+rocm' in spec:
|
||||||
|
options.append('-DLegion_USE_HIP=ON')
|
||||||
|
options.append('-DLegion_GPU_REDUCTIONS=ON')
|
||||||
|
options.append(from_variant('Legion_HIP_TARGET', 'hip_target'))
|
||||||
|
options.append(from_variant('Legion_HIP_ARCH', 'amdgpu_target'))
|
||||||
|
options.append(from_variant('Legion_HIJACK_HIP', 'hip_hijack'))
|
||||||
|
|
||||||
if '+fortran' in spec:
|
if '+fortran' in spec:
|
||||||
# default is off.
|
# default is off.
|
||||||
options.append('-DLegion_USE_Fortran=ON')
|
options.append('-DLegion_USE_Fortran=ON')
|
||||||
|
|
Loading…
Reference in a new issue