2021-01-02 15:10:28 +08:00
|
|
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
2020-10-10 06:25:06 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
|
|
|
from spack import *
|
|
|
|
|
|
|
|
|
2020-12-02 22:58:58 +08:00
|
|
|
class Camp(CMakePackage, CudaPackage, ROCmPackage):
|
2020-10-10 06:25:06 +08:00
|
|
|
"""
|
|
|
|
Compiler agnostic metaprogramming library providing concepts,
|
|
|
|
type operations and tuples for C++ and cuda
|
|
|
|
"""
|
|
|
|
|
|
|
|
homepage = "https://github.com/LLNL/camp"
|
|
|
|
git = "https://github.com/LLNL/camp.git"
|
2020-10-27 22:52:28 +08:00
|
|
|
url = "https://github.com/LLNL/camp/archive/v0.1.0.tar.gz"
|
2020-10-10 06:25:06 +08:00
|
|
|
|
2021-09-02 08:58:47 +08:00
|
|
|
maintainers = ['trws']
|
|
|
|
|
2020-10-10 06:25:06 +08:00
|
|
|
version('master', branch='master', submodules='True')
|
2021-09-02 08:58:47 +08:00
|
|
|
version('0.2.2', sha256='194d38b57e50e3494482a7f94940b27f37a2bee8291f2574d64db342b981d819')
|
2020-10-27 22:52:28 +08:00
|
|
|
version('0.1.0', sha256='fd4f0f2a60b82a12a1d9f943f8893dc6fe770db493f8fae5ef6f7d0c439bebcc')
|
2020-10-10 06:25:06 +08:00
|
|
|
|
2020-12-03 09:07:56 +08:00
|
|
|
# TODO: figure out gtest dependency and then set this default True.
|
|
|
|
variant('tests', default=False, description='Build tests')
|
|
|
|
|
2021-04-09 04:54:37 +08:00
|
|
|
depends_on('cub', when='+cuda')
|
2020-10-10 06:25:06 +08:00
|
|
|
|
|
|
|
def cmake_args(self):
|
|
|
|
spec = self.spec
|
|
|
|
|
|
|
|
options = []
|
|
|
|
|
|
|
|
if '+cuda' in spec:
|
|
|
|
options.extend([
|
|
|
|
'-DENABLE_CUDA=ON',
|
|
|
|
'-DCUDA_TOOLKIT_ROOT_DIR=%s' % (spec['cuda'].prefix)])
|
|
|
|
|
|
|
|
if not spec.satisfies('cuda_arch=none'):
|
|
|
|
cuda_arch = spec.variants['cuda_arch'].value
|
|
|
|
options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0]))
|
|
|
|
flag = '-arch sm_{0}'.format(cuda_arch[0])
|
|
|
|
options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag))
|
|
|
|
else:
|
|
|
|
options.append('-DENABLE_CUDA=OFF')
|
|
|
|
|
2020-12-02 22:58:58 +08:00
|
|
|
if '+rocm' in spec:
|
2020-10-31 04:33:54 +08:00
|
|
|
options.extend([
|
|
|
|
'-DENABLE_HIP=ON',
|
2020-12-02 22:58:58 +08:00
|
|
|
'-DHIP_ROOT_DIR={0}'.format(spec['hip'].prefix)
|
|
|
|
])
|
|
|
|
archs = self.spec.variants['amdgpu_target'].value
|
|
|
|
if archs != 'none':
|
|
|
|
arch_str = ",".join(archs)
|
|
|
|
options.append(
|
|
|
|
'-DHIP_HIPCC_FLAGS=--amdgpu-target={0}'.format(arch_str)
|
|
|
|
)
|
2020-10-31 04:33:54 +08:00
|
|
|
else:
|
|
|
|
options.append('-DENABLE_HIP=OFF')
|
|
|
|
|
2021-05-19 18:59:06 +08:00
|
|
|
options.append(self.define_from_variant('ENABLE_TESTS', 'tests'))
|
2020-10-10 06:25:06 +08:00
|
|
|
|
|
|
|
return options
|