Update and exetend VecGeom (#14520)

* Add new vecgeom versions, add cuda support, automate target options

* Add ROOT, GDML, and external VecCore support to VecGeom

* Address reviewer comments

* Update vecgeom for CUDA

* Update versions
This commit is contained in:
Seth R. Johnson 2020-03-17 06:18:40 -04:00 committed by GitHub
parent 402d89afa2
commit 05d0c7b477
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,49 +5,96 @@
from spack import * from spack import *
import platform
class Vecgeom(CMakePackage): class Vecgeom(CMakePackage, CudaPackage):
"""The vectorized geometry library for particle-detector simulation """The vectorized geometry library for particle-detector simulation
(toolkits).""" (toolkits)."""
homepage = "https://gitlab.cern.ch/VecGeom/VecGeom" homepage = "https://gitlab.cern.ch/VecGeom/VecGeom"
url = "https://gitlab.cern.ch/api/v4/projects/VecGeom%2FVecGeom/repository/archive.tar.gz?sha=v0.3.rc" url = "https://gitlab.cern.ch/VecGeom/VecGeom/-/archive/v1.1.6/VecGeom-v1.1.6.tar.gz"
git = "https://gitlab.cern.ch/VecGeom/VecGeom.git"
version('01.01.03', git='https://gitlab.cern.ch/VecGeom/VecGeom.git', tag='v01.01.03', preferred=True) maintainers = ['drbenmorgan', 'sethrj']
version('01.00.00', git='https://gitlab.cern.ch/VecGeom/VecGeom.git', tag='v01.00.00')
version('00.05.00', git='https://gitlab.cern.ch/VecGeom/VecGeom.git', tag='v00.05.00') version('master', branch='master')
version('1.1.6', sha256='c4806a6b67d01b40074b8cc6865d78574a6a1c573be51696f2ecdf98b9cb954a')
version('1.1.5', sha256='da674f3bbc75c30f56c1a2d251fa8930c899f27fa64b03a36569924030d87b95')
version('1.1.3', sha256='ada09e8b6b2fa6c058290302b2cb5a6c2e644192aab1623c31d18c6a2f4c01c8')
version('1.0.1', sha256='1eae7ac9014c608e8d8db5568058b8c0fea1a1dc7a8f54157a3a1c997b6fd9eb')
version('0.5.2', tag='v00.05.02',
commit='a7e0828c915ff936a79e672d1dd84b087a323b51')
version('0.3.rc', sha256='a87a9ea4ab126b59ff9c79182bc0911ead3d76dd197194742e2a35ccd341299d') version('0.3.rc', sha256='a87a9ea4ab126b59ff9c79182bc0911ead3d76dd197194742e2a35ccd341299d')
variant('cxxstd', _cxxstd_values = ('11', '14', '17')
default='17', variant('cxxstd', default='11', values=_cxxstd_values, multi=False,
values=('11', '14', '17'), description='Use the specified C++ standard when building')
multi=False, variant('gdml', default=True,
description='Use the specified C++ standard when building.') description='Support native GDML geometry descriptions')
variant('vector', variant('geant4', default=False,
default='native', description='Support Geant4 geometry construction')
values=('sse3', 'sse4.2', 'native'), variant('root', default=False,
multi=False, description='Support ROOT geometry construction')
description='Specify the instruction set for vectorization.') variant('shared', default=True,
description='Build shared libraries')
depends_on('cmake@3.5:', type='build') depends_on('veccore@0.5.2:', type=('build', 'link'), when='@1.1.0:')
depends_on('veccore@0.4.2', type=('build', 'link'), when='@:1.0')
depends_on('veccore+cuda', type=('build', 'link'), when='+cuda')
conflicts('+cuda', when='@:1.1.5')
for std in _cxxstd_values:
depends_on('geant4 cxxstd=' + std, when='+geant4 cxxstd=' + std)
depends_on('root cxxstd=' + std, when='+root cxxstd=' + std)
depends_on('veccore cxxstd=' + std, when='cxxstd=' + std)
depends_on('xerces-c cxxstd=' + std, when='+gdml cxxstd=' + std)
def cmake_args(self): def cmake_args(self):
options = [ # Possible target options are from the main CMakeLists.txt, assuming
'-DBACKEND=Scalar', # "best" is last
'-DGEANT4=OFF', target = self.spec.target
'-DUSOLIDS=ON', vecgeom_arch = "sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2".split()
'-DUSOLIDS_VECGEOM=ON', for feature in reversed(vecgeom_arch):
'-DROOT=OFF', if feature.replace('.', '_') in target:
'-DNO_SPECIALIZATION=ON', target_instructions = feature
'-DCMAKE_VERBOSE_MAKEFILE=TRUE'] break
options.append('-DCMAKE_CXX_STANDARD={0}'.
format(self.spec.variants['cxxstd'].value))
arch = platform.machine()
if arch == 'x86_64':
options.append('-DVECGEOM_VECTOR={0}'.
format(self.spec.variants['vector'].value))
else: else:
options.append('-DVECGEOM_VECTOR=' + arch) # No features available (could be 'generic' arch)
target_instructions = 'empty'
define = CMakePackage.define
options = [
define('BACKEND', 'Scalar'),
define('BUILTIN_VECCORE', False),
define('NO_SPECIALIZATION', True),
define('VECGEOM_VECTOR', target_instructions),
self.define_from_variant('BUILD_SHARED_LIBS', 'shared'),
self.define_from_variant('CMAKE_CXX_STANDARD', 'cxxstd'),
self.define_from_variant('CUDA'),
self.define_from_variant('GDML'),
self.define_from_variant('GEANT4'),
self.define_from_variant('ROOT'),
]
# Set testing flags
build_tests = self.run_tests
options.extend([
define('BUILD_TESTING', build_tests),
define('CTEST', build_tests),
define('GDMLTESTING', build_tests and '+gdml' in self.spec),
])
if '+cuda' in self.spec:
arch = self.spec.variants['cuda_arch'].value
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_VECGEOM', True),
])
return options return options