|
| 1 | +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other |
| 2 | +# Spack Project Developers. See the top-level COPYRIGHT file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 5 | + |
| 6 | +from spack import * |
| 7 | + |
| 8 | + |
| 9 | +class Chai(CMakePackage, CudaPackage): |
| 10 | + """ |
| 11 | + Copy-hiding array interface for data migration between memory spaces |
| 12 | + """ |
| 13 | + |
| 14 | + homepage = "https://github.com/LLNL/CHAI" |
| 15 | + git = "https://github.com/LLNL/CHAI.git" |
| 16 | + |
| 17 | + version('develop', branch='develop', submodules='True') |
| 18 | + version('master', branch='main', submodules='True') |
| 19 | + version('2.2.0', tag='v2.2.0', submodules='True') |
| 20 | + version('2.1.1', tag='v2.1.1', submodules='True') |
| 21 | + version('2.1.0', tag='v2.1.0', submodules='True') |
| 22 | + version('2.0.0', tag='v2.0.0', submodules='True') |
| 23 | + version('1.2.0', tag='v1.2.0', submodules='True') |
| 24 | + version('1.1.0', tag='v1.1.0', submodules='True') |
| 25 | + version('1.0', tag='v1.0', submodules='True') |
| 26 | + |
| 27 | + variant('shared', default=True, description='Build Shared Libs') |
| 28 | + variant('raja', default=False, description='Build plugin for RAJA') |
| 29 | + variant('benchmarks', default=False, description='Build benchmarks.') |
| 30 | + variant('examples', default=False, description='Build examples.') |
| 31 | + |
| 32 | + depends_on( '[email protected]:', type='build') |
| 33 | + depends_on('umpire') |
| 34 | + depends_on('raja', when="+raja") |
| 35 | + |
| 36 | + depends_on( '[email protected]:', type='build', when="+cuda") |
| 37 | + depends_on('umpire+cuda', when="+cuda") |
| 38 | + depends_on('raja+cuda', when="+raja+cuda") |
| 39 | + |
| 40 | + def cmake_args(self): |
| 41 | + spec = self.spec |
| 42 | + |
| 43 | + options = [] |
| 44 | + |
| 45 | + if '+cuda' in spec: |
| 46 | + options.extend([ |
| 47 | + '-DENABLE_CUDA=ON', |
| 48 | + '-DCUDA_TOOLKIT_ROOT_DIR=' + spec['cuda'].prefix]) |
| 49 | + |
| 50 | + if not spec.satisfies('cuda_arch=none'): |
| 51 | + cuda_arch = spec.variants['cuda_arch'].value |
| 52 | + options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0])) |
| 53 | + flag = '-arch sm_{0}'.format(cuda_arch[0]) |
| 54 | + options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag)) |
| 55 | + else: |
| 56 | + options.append('-DENABLE_CUDA=OFF') |
| 57 | + |
| 58 | + if '+raja' in spec: |
| 59 | + options.extend(['-DENABLE_RAJA_PLUGIN=ON', |
| 60 | + '-DRAJA_DIR=' + spec['raja'].prefix]) |
| 61 | + |
| 62 | + options.append('-Dumpire_DIR:PATH=' |
| 63 | + + spec['umpire'].prefix.share.umpire.cmake) |
| 64 | + |
| 65 | + options.append('-DENABLE_TESTS={0}'.format( |
| 66 | + 'ON' if self.run_tests else 'OFF')) |
| 67 | + |
| 68 | + options.append('-DENABLE_BENCHMARKS={0}'.format( |
| 69 | + 'ON' if '+benchmarks' in spec else 'OFF')) |
| 70 | + |
| 71 | + options.append('-DENABLE_EXAMPLES={0}'.format( |
| 72 | + 'ON' if '+examples' in spec else 'OFF')) |
| 73 | + |
| 74 | + return options |
0 commit comments