diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2024-09-11 17:43:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-11 17:43:20 +0200 |
commit | 5fa8890bd3f239464fc8375f934c692cec599a70 (patch) | |
tree | 9af4dc3f66655d4d9e97d625108f8a2f71cf921f /lib | |
parent | 122c3c2dbb4269869b12b3b6175d731cd8301b6e (diff) | |
download | spack-5fa8890bd3f239464fc8375f934c692cec599a70.tar.gz spack-5fa8890bd3f239464fc8375f934c692cec599a70.tar.bz2 spack-5fa8890bd3f239464fc8375f934c692cec599a70.tar.xz spack-5fa8890bd3f239464fc8375f934c692cec599a70.zip |
CUDA: support Grace Hopper 9.0a compute capability (#45540)
* CUDA: support Grace Hopper 9.0a compute capability
* Fix other packages
* Add type annotations
* Support ancient Python versions
* isort
* spec -> self.spec
Co-authored-by: Andrew W Elble <aweits@rit.edu>
* [@spackbot] updating style on behalf of adamjstewart
---------
Co-authored-by: Andrew W Elble <aweits@rit.edu>
Co-authored-by: adamjstewart <adamjstewart@users.noreply.github.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/cuda.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/cuda.py b/lib/spack/spack/build_systems/cuda.py index 20f7ede139..9320a137a5 100644 --- a/lib/spack/spack/build_systems/cuda.py +++ b/lib/spack/spack/build_systems/cuda.py @@ -3,6 +3,9 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import re +from typing import Iterable, List + import spack.variant from spack.directives import conflicts, depends_on, variant from spack.multimethod import when @@ -44,6 +47,7 @@ class CudaPackage(PackageBase): "87", "89", "90", + "90a", ) # FIXME: keep cuda and cuda_arch separate to make usage easier until @@ -70,6 +74,27 @@ class CudaPackage(PackageBase): for s in arch_list ] + @staticmethod + def compute_capabilities(arch_list: Iterable[str]) -> List[str]: + """Adds a decimal place to each CUDA arch. + + >>> compute_capabilities(['90', '90a']) + ['9.0', '9.0a'] + + Args: + arch_list: A list of integer strings, optionally followed by a suffix. + + Returns: + A list of float strings, optionally followed by a suffix + """ + pattern = re.compile(r"(\d+)") + capabilities = [] + for arch in arch_list: + _, number, letter = re.split(pattern, arch) + number = "{0:.1f}".format(float(number) / 10.0) + capabilities.append(number + letter) + return capabilities + depends_on("cuda", when="+cuda") # CUDA version vs Architecture |