Make CUDA and ROCm architecture conditional (#27185)

* Make CUDA and ROCm architecture conditional

fixes #14337

The variant to specify which architecture to use
for CUDA and ROCm are now conditional on +cuda and
+rocm respectively.

* cp2k: make all CUDA related variants conditional on +cuda
This commit is contained in:
Massimiliano Culpo 2021-11-22 13:54:19 +01:00 committed by GitHub
parent 5f10562ad1
commit 5eba5dc271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View File

@ -35,7 +35,8 @@ class CudaPackage(PackageBase):
variant('cuda_arch', variant('cuda_arch',
description='CUDA architecture', description='CUDA architecture',
values=spack.variant.any_combination_of(*cuda_arch_values)) values=spack.variant.any_combination_of(*cuda_arch_values),
when='+cuda')
# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-examples # https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-examples
# https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code # https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code

View File

@ -100,7 +100,8 @@ class ROCmPackage(PackageBase):
# possible amd gpu targets for rocm builds # possible amd gpu targets for rocm builds
variant('amdgpu_target', variant('amdgpu_target',
description='AMD GPU architecture', description='AMD GPU architecture',
values=spack.variant.any_combination_of(*amdgpu_targets)) values=spack.variant.any_combination_of(*amdgpu_targets),
when='+rocm')
depends_on('llvm-amdgpu', when='+rocm') depends_on('llvm-amdgpu', when='+rocm')
depends_on('hsa-rocr-dev', when='+rocm') depends_on('hsa-rocr-dev', when='+rocm')

View File

@ -53,14 +53,15 @@ class Cp2k(MakefilePackage, CudaPackage):
' and BQB compression')) ' and BQB compression'))
variant('spglib', default=False, description='Enable support for spglib') variant('spglib', default=False, description='Enable support for spglib')
variant('cuda_arch_35_k20x', default=False, with when('+cuda'):
description=('CP2K (resp. DBCSR) has specific parameter sets for' variant('cuda_arch_35_k20x', default=False,
' different GPU models. Enable this when building' description=('CP2K (resp. DBCSR) has specific parameter sets for'
' with cuda_arch=35 for a K20x instead of a K40')) ' different GPU models. Enable this when building'
variant('cuda_fft', default=False, ' with cuda_arch=35 for a K20x instead of a K40'))
description=('Use CUDA also for FFTs in the PW part of CP2K')) variant('cuda_fft', default=False,
variant('cuda_blas', default=False, description=('Use CUDA also for FFTs in the PW part of CP2K'))
description=('Use CUBLAS for general matrix operations in DBCSR')) variant('cuda_blas', default=False,
description=('Use CUBLAS for general matrix operations in DBCSR'))
HFX_LMAX_RANGE = range(4, 8) HFX_LMAX_RANGE = range(4, 8)
@ -167,8 +168,6 @@ class Cp2k(MakefilePackage, CudaPackage):
depends_on('python@3.6:', when='@7:+cuda', type='build') depends_on('python@3.6:', when='@7:+cuda', type='build')
depends_on('spglib', when='+spglib') depends_on('spglib', when='+spglib')
conflicts('~cuda', '+cuda_fft')
conflicts('~cuda', '+cuda_blas')
# Apparently cp2k@4.1 needs an "experimental" version of libwannier.a # Apparently cp2k@4.1 needs an "experimental" version of libwannier.a
# which is only available contacting the developer directly. See INSTALL # which is only available contacting the developer directly. See INSTALL