vecgeom: fix cuda arch (#29582)
* vecgeom: fix cuda arch * vecgeom: change 'options' to 'args' * vecgeom: add spec to locals * vecgeom: suppress architecture specializations when cuda
This commit is contained in:
parent
b4b8aaf3bc
commit
fa554d763e
@ -74,20 +74,20 @@ class Vecgeom(CMakePackage, CudaPackage):
|
|||||||
depends_on('xerces-c cxxstd=' + std, when='+gdml cxxstd=' + std)
|
depends_on('xerces-c cxxstd=' + std, when='+gdml cxxstd=' + std)
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
# Possible target options are from the main CMakeLists.txt, assuming
|
# Possible target args are from the main CMakeLists.txt, assuming
|
||||||
# "best" is last
|
# "best" is last
|
||||||
target = self.spec.target
|
spec = self.spec
|
||||||
|
|
||||||
|
target_instructions = 'empty'
|
||||||
|
if '~cuda' in spec:
|
||||||
vecgeom_arch = "sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2".split()
|
vecgeom_arch = "sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2".split()
|
||||||
for feature in reversed(vecgeom_arch):
|
for feature in reversed(vecgeom_arch):
|
||||||
if feature.replace('.', '_') in target:
|
if feature.replace('.', '_') in spec.target:
|
||||||
target_instructions = feature
|
target_instructions = feature
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
# No features available (could be 'generic' arch)
|
|
||||||
target_instructions = 'empty'
|
|
||||||
|
|
||||||
define = CMakePackage.define
|
define = CMakePackage.define
|
||||||
options = [
|
args = [
|
||||||
define('BACKEND', 'Scalar'),
|
define('BACKEND', 'Scalar'),
|
||||||
define('BUILTIN_VECCORE', False),
|
define('BUILTIN_VECCORE', False),
|
||||||
define('NO_SPECIALIZATION', True),
|
define('NO_SPECIALIZATION', True),
|
||||||
@ -99,29 +99,32 @@ def cmake_args(self):
|
|||||||
self.define_from_variant('ROOT'),
|
self.define_from_variant('ROOT'),
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.spec.satisfies('@:1.1.18'):
|
if spec.satisfies('@:1.1.18'):
|
||||||
options.append(self.define_from_variant('CUDA'))
|
args.append(self.define_from_variant('CUDA'))
|
||||||
|
arch = spec.variants['cuda_arch'].value
|
||||||
|
if len(arch) != 1 or arch[0] == 'none':
|
||||||
|
raise InstallError("Exactly one cuda_arch must be specified")
|
||||||
|
args.append(define('CUDA_ARCH', arch[0]))
|
||||||
else:
|
else:
|
||||||
options.append(self.define_from_variant('VECGEOM_ENABLE_CUDA', 'cuda'))
|
args.append(self.define_from_variant('VECGEOM_ENABLE_CUDA', 'cuda'))
|
||||||
|
# This will add an (ignored) empty string if no values are
|
||||||
|
# selected, otherwise will add a CMake list of arch values
|
||||||
|
args.append(self.define(
|
||||||
|
'CMAKE_CUDA_ARCHITECTURES', spec.variants['cuda_arch'].value
|
||||||
|
))
|
||||||
|
|
||||||
# Set testing flags
|
# Set testing flags
|
||||||
build_tests = self.run_tests
|
build_tests = self.run_tests
|
||||||
options.extend([
|
args.extend([
|
||||||
define('BUILD_TESTING', build_tests),
|
define('BUILD_TESTING', build_tests),
|
||||||
define('CTEST', build_tests),
|
define('CTEST', build_tests),
|
||||||
define('GDMLTESTING', build_tests and '+gdml' in self.spec),
|
define('GDMLTESTING', build_tests and '+gdml' in spec),
|
||||||
])
|
])
|
||||||
|
|
||||||
if '+cuda' in self.spec:
|
if spec.satisfies("@:0.5.2"):
|
||||||
arch = self.spec.variants['cuda_arch'].value
|
args.extend([
|
||||||
if len(arch) != 1 or arch[0] == 'none':
|
|
||||||
raise InstallError("Exactly one cuda_arch must be specified")
|
|
||||||
options.append(define('CUDA_ARCH', arch[0]))
|
|
||||||
|
|
||||||
if self.spec.satisfies("@:0.5.2"):
|
|
||||||
options.extend([
|
|
||||||
define('USOLIDS', True),
|
define('USOLIDS', True),
|
||||||
define('USOLIDS_VECGEOM', True),
|
define('USOLIDS_VECGEOM', True),
|
||||||
])
|
])
|
||||||
|
|
||||||
return options
|
return args
|
||||||
|
Loading…
Reference in New Issue
Block a user