package sanity: ensure all variant defaults are allowed values (#20373)
This commit is contained in:
parent
c6c1af4969
commit
e7f4c2b49e
@ -19,7 +19,7 @@ class CudaPackage(PackageBase):
|
|||||||
# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list
|
# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-feature-list
|
||||||
# https://developer.nvidia.com/cuda-gpus
|
# https://developer.nvidia.com/cuda-gpus
|
||||||
# https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
# https://en.wikipedia.org/wiki/CUDA#GPUs_supported
|
||||||
cuda_arch_values = [
|
cuda_arch_values = (
|
||||||
'10', '11', '12', '13',
|
'10', '11', '12', '13',
|
||||||
'20', '21',
|
'20', '21',
|
||||||
'30', '32', '35', '37',
|
'30', '32', '35', '37',
|
||||||
@ -27,7 +27,7 @@ class CudaPackage(PackageBase):
|
|||||||
'60', '61', '62',
|
'60', '61', '62',
|
||||||
'70', '72', '75',
|
'70', '72', '75',
|
||||||
'80', '86'
|
'80', '86'
|
||||||
]
|
)
|
||||||
|
|
||||||
# FIXME: keep cuda and cuda_arch separate to make usage easier until
|
# FIXME: keep cuda and cuda_arch separate to make usage easier until
|
||||||
# Spack has depends_on(cuda, when='cuda_arch!=None') or alike
|
# Spack has depends_on(cuda, when='cuda_arch!=None') or alike
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
"""This test does sanity checks on Spack's builtin package database."""
|
"""This test does sanity checks on Spack's builtin package database."""
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
@ -14,6 +13,7 @@
|
|||||||
import spack.paths
|
import spack.paths
|
||||||
import spack.repo
|
import spack.repo
|
||||||
import spack.util.executable as executable
|
import spack.util.executable as executable
|
||||||
|
import spack.variant
|
||||||
# A few functions from this module are used to
|
# A few functions from this module are used to
|
||||||
# do sanity checks only on packagess modified by a PR
|
# do sanity checks only on packagess modified by a PR
|
||||||
import spack.cmd.flake8 as flake8
|
import spack.cmd.flake8 as flake8
|
||||||
@ -257,3 +257,15 @@ def test_variant_defaults_are_parsable_from_cli():
|
|||||||
if not default_is_parsable:
|
if not default_is_parsable:
|
||||||
failing.append((pkg.name, variant_name))
|
failing.append((pkg.name, variant_name))
|
||||||
assert not failing
|
assert not failing
|
||||||
|
|
||||||
|
|
||||||
|
def test_variant_defaults_listed_explicitly_in_values():
|
||||||
|
failing = []
|
||||||
|
for pkg in spack.repo.path.all_packages():
|
||||||
|
for variant_name, variant in pkg.variants.items():
|
||||||
|
vspec = variant.make_default()
|
||||||
|
try:
|
||||||
|
variant.validate_or_raise(vspec, pkg=pkg)
|
||||||
|
except spack.variant.InvalidVariantValueError:
|
||||||
|
failing.append((pkg.name, variant.name))
|
||||||
|
assert not failing
|
||||||
|
@ -82,8 +82,7 @@ def isa_type(v):
|
|||||||
else:
|
else:
|
||||||
# Otherwise assume values is the set of allowed explicit values
|
# Otherwise assume values is the set of allowed explicit values
|
||||||
self.values = values
|
self.values = values
|
||||||
allowed = tuple(self.values) + (self.default,)
|
self.single_value_validator = lambda x: x in tuple(self.values)
|
||||||
self.single_value_validator = lambda x: x in allowed
|
|
||||||
|
|
||||||
self.multi = multi
|
self.multi = multi
|
||||||
self.group_validator = validator
|
self.group_validator = validator
|
||||||
|
@ -27,7 +27,7 @@ class CbtfArgonavis(CMakePackage):
|
|||||||
to point to target build.")
|
to point to target build.")
|
||||||
variant('runtime', default=False,
|
variant('runtime', default=False,
|
||||||
description="build only the runtime libraries and collectors.")
|
description="build only the runtime libraries and collectors.")
|
||||||
variant('build_type', default='None', values=('None'),
|
variant('build_type', default='None', values=('None',),
|
||||||
description='CMake build type')
|
description='CMake build type')
|
||||||
|
|
||||||
depends_on("cmake@3.0.2:", type='build')
|
depends_on("cmake@3.0.2:", type='build')
|
||||||
|
@ -39,7 +39,7 @@ class CbtfKrell(CMakePackage):
|
|||||||
description="Build mpi experiment collector for mpich MPI.")
|
description="Build mpi experiment collector for mpich MPI.")
|
||||||
variant('runtime', default=False,
|
variant('runtime', default=False,
|
||||||
description="build only the runtime libraries and collectors.")
|
description="build only the runtime libraries and collectors.")
|
||||||
variant('build_type', default='None', values=('None'),
|
variant('build_type', default='None', values=('None',),
|
||||||
description='CMake build type')
|
description='CMake build type')
|
||||||
variant('cti', default=False,
|
variant('cti', default=False,
|
||||||
description="Build MRNet with the CTI startup option")
|
description="Build MRNet with the CTI startup option")
|
||||||
|
@ -20,7 +20,7 @@ class CbtfLanl(CMakePackage):
|
|||||||
version('1.9.1.1', branch='1.9.1.1')
|
version('1.9.1.1', branch='1.9.1.1')
|
||||||
version('1.9.1.0', branch='1.9.1.0')
|
version('1.9.1.0', branch='1.9.1.0')
|
||||||
|
|
||||||
variant('build_type', default='None', values=('None'),
|
variant('build_type', default='None', values=('None',),
|
||||||
description='CMake build type')
|
description='CMake build type')
|
||||||
|
|
||||||
variant('runtime', default=False,
|
variant('runtime', default=False,
|
||||||
|
@ -29,7 +29,7 @@ class Cbtf(CMakePackage):
|
|||||||
variant('runtime', default=False,
|
variant('runtime', default=False,
|
||||||
description="build only the runtime libraries and collectors.")
|
description="build only the runtime libraries and collectors.")
|
||||||
|
|
||||||
variant('build_type', default='None', values=('None'),
|
variant('build_type', default='None', values=('None',),
|
||||||
description='CMake build type')
|
description='CMake build type')
|
||||||
|
|
||||||
depends_on("cmake@3.0.2:", type='build')
|
depends_on("cmake@3.0.2:", type='build')
|
||||||
|
@ -25,7 +25,7 @@ class Elsi(CMakePackage):
|
|||||||
)
|
)
|
||||||
variant(
|
variant(
|
||||||
'elpa2_kernel', default="none", description="ELPA2 Kernel",
|
'elpa2_kernel', default="none", description="ELPA2 Kernel",
|
||||||
values=('AVX', 'AVX2', 'AVX512'), multi=False
|
values=('none', 'AVX', 'AVX2', 'AVX512'), multi=False
|
||||||
)
|
)
|
||||||
variant(
|
variant(
|
||||||
'enable_pexsi', default=False, description='Enable PEXSI support'
|
'enable_pexsi', default=False, description='Enable PEXSI support'
|
||||||
|
@ -36,7 +36,7 @@ class Fairlogger(CMakePackage):
|
|||||||
multi=False,
|
multi=False,
|
||||||
description='CMake build type')
|
description='CMake build type')
|
||||||
variant('cxxstd', default='default',
|
variant('cxxstd', default='default',
|
||||||
values=('11', '14', '17'),
|
values=('default', '11', '14', '17'),
|
||||||
multi=False,
|
multi=False,
|
||||||
description='Use the specified C++ standard when building.')
|
description='Use the specified C++ standard when building.')
|
||||||
variant('pretty',
|
variant('pretty',
|
||||||
|
@ -31,7 +31,7 @@ class GpuBurn(MakefilePackage, CudaPackage):
|
|||||||
'cuda_arch',
|
'cuda_arch',
|
||||||
description='CUDA architecture',
|
description='CUDA architecture',
|
||||||
default='none',
|
default='none',
|
||||||
values=cuda_arch_values,
|
values=('none',) + cuda_arch_values,
|
||||||
multi=False
|
multi=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class Hdf5(AutotoolsPackage):
|
|||||||
variant('pic', default=True,
|
variant('pic', default=True,
|
||||||
description='Produce position-independent code (for shared libs)')
|
description='Produce position-independent code (for shared libs)')
|
||||||
# Build HDF5 with API compaitibility.
|
# Build HDF5 with API compaitibility.
|
||||||
variant('api', default='none', description='choose api compatibility', values=('v114', 'v112', 'v110', 'v18', 'v16'), multi=False)
|
variant('api', default='none', description='choose api compatibility', values=('none', 'v114', 'v112', 'v110', 'v18', 'v16'), multi=False)
|
||||||
|
|
||||||
conflicts('api=v114', when='@1.6:1.12.99', msg='v114 is not compatible with this release')
|
conflicts('api=v114', when='@1.6:1.12.99', msg='v114 is not compatible with this release')
|
||||||
conflicts('api=v112', when='@1.6:1.10.99', msg='v112 is not compatible with this release')
|
conflicts('api=v112', when='@1.6:1.10.99', msg='v112 is not compatible with this release')
|
||||||
|
@ -30,7 +30,8 @@ class Jube(PythonPackage):
|
|||||||
variant(
|
variant(
|
||||||
'resource_manager', default='none',
|
'resource_manager', default='none',
|
||||||
description='Select resource manager templates',
|
description='Select resource manager templates',
|
||||||
values=('loadleveler', 'lsf', 'moab', 'pbs', 'slurm'), multi=False
|
values=('none', 'loadleveler', 'lsf', 'moab', 'pbs', 'slurm'),
|
||||||
|
multi=False
|
||||||
)
|
)
|
||||||
|
|
||||||
depends_on('py-setuptools', type='build')
|
depends_on('py-setuptools', type='build')
|
||||||
|
@ -77,9 +77,8 @@ class KokkosLegacy(Package):
|
|||||||
'Volta70', 'Volta72')
|
'Volta70', 'Volta72')
|
||||||
|
|
||||||
# C++ standard variant
|
# C++ standard variant
|
||||||
variant('cxxstd', default='none',
|
cxx_stds = ('none', 'c++11', 'c++14', 'c++17', 'c++1y', 'c++1z', 'c++2a')
|
||||||
values=('c++11', 'c++14', 'c++17', 'c++1y', 'c++1z', 'c++2a'),
|
variant('cxxstd', default='none', values=cxx_stds, multi=False,
|
||||||
multi=False,
|
|
||||||
description='set cxxstandard Kokkos option')
|
description='set cxxstandard Kokkos option')
|
||||||
|
|
||||||
# Host architecture variant
|
# Host architecture variant
|
||||||
|
@ -72,13 +72,13 @@ class Kokkos(CMakePackage, CudaPackage):
|
|||||||
'tests': [False, 'Build for tests'],
|
'tests': [False, 'Build for tests'],
|
||||||
}
|
}
|
||||||
|
|
||||||
amd_gpu_arches = [
|
amd_gpu_arches = (
|
||||||
'fiji',
|
'fiji',
|
||||||
'gfx901',
|
'gfx901',
|
||||||
'vega900',
|
'vega900',
|
||||||
'vega906',
|
'vega906',
|
||||||
]
|
)
|
||||||
variant("amd_gpu_arch", default='none', values=amd_gpu_arches,
|
variant("amd_gpu_arch", default='none', values=('none',) + amd_gpu_arches,
|
||||||
description="AMD GPU architecture")
|
description="AMD GPU architecture")
|
||||||
conflicts("+hip", when="amd_gpu_arch=none")
|
conflicts("+hip", when="amd_gpu_arch=none")
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class Libbeagle(AutotoolsPackage, CudaPackage):
|
|||||||
'cuda_arch',
|
'cuda_arch',
|
||||||
description='CUDA architecture',
|
description='CUDA architecture',
|
||||||
default='none',
|
default='none',
|
||||||
values=cuda_arch_values,
|
values=('none',) + cuda_arch_values,
|
||||||
multi=False
|
multi=False
|
||||||
)
|
)
|
||||||
conflicts('cuda_arch=none', when='+cuda',
|
conflicts('cuda_arch=none', when='+cuda',
|
||||||
|
@ -51,7 +51,7 @@ class OpenspeedshopUtils(CMakePackage):
|
|||||||
variant('cuda', default=False,
|
variant('cuda', default=False,
|
||||||
description="build with cuda packages included.")
|
description="build with cuda packages included.")
|
||||||
|
|
||||||
variant('build_type', default='None', values=('None'),
|
variant('build_type', default='None', values=('None',),
|
||||||
description='CMake build type')
|
description='CMake build type')
|
||||||
|
|
||||||
# MPI variants
|
# MPI variants
|
||||||
|
@ -46,7 +46,7 @@ class Openspeedshop(CMakePackage):
|
|||||||
variant('gui', default='qt3', values=('none', 'qt3', 'qt4'),
|
variant('gui', default='qt3', values=('none', 'qt3', 'qt4'),
|
||||||
description='Build or not build a GUI of choice')
|
description='Build or not build a GUI of choice')
|
||||||
|
|
||||||
variant('build_type', default='None', values=('None'),
|
variant('build_type', default='None', values=('None',),
|
||||||
description='CMake build type')
|
description='CMake build type')
|
||||||
|
|
||||||
# MPI variants
|
# MPI variants
|
||||||
|
@ -29,7 +29,7 @@ class Rr(CMakePackage):
|
|||||||
# Only 'Release' is supported at the moment
|
# Only 'Release' is supported at the moment
|
||||||
variant('build_type', default='Release',
|
variant('build_type', default='Release',
|
||||||
description='The build type to build',
|
description='The build type to build',
|
||||||
values=('Release'))
|
values=('Release',))
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
# because otherwise CMake would try and fail to set RPATH of
|
# because otherwise CMake would try and fail to set RPATH of
|
||||||
|
@ -67,7 +67,7 @@ class VtkM(CMakePackage, CudaPackage):
|
|||||||
'gfx908': 'vega908'
|
'gfx908': 'vega908'
|
||||||
}
|
}
|
||||||
|
|
||||||
variant('amdgpu_target', default='none', multi=True, values=amdgpu_targets)
|
variant('amdgpu_target', default='none', multi=True, values=('none',) + amdgpu_targets)
|
||||||
conflicts("+hip", when="amdgpu_target=none")
|
conflicts("+hip", when="amdgpu_target=none")
|
||||||
|
|
||||||
depends_on("cmake@3.12:", type="build") # CMake >= 3.12
|
depends_on("cmake@3.12:", type="build") # CMake >= 3.12
|
||||||
|
Loading…
Reference in New Issue
Block a user