summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/py-pykokkos-base/package.py
blob: cfe0744fb949317e1a05e7990e8e68f86b862c9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
# ----------------------------------------------------------------------------

from spack import *


class PyPykokkosBase(CMakePackage, PythonPackage):
    '''Minimal set of bindings for Kokkos interoperability with Python
    (initialize, finalize, View, DynRankView, Kokkos-tools)'''

    homepage = 'https://github.com/kokkos/pykokkos-base.git'
    git = 'https://github.com/kokkos/pykokkos-base.git'
    maintainers = ['jrmadsen']

    version('main', branch='main', submodules=False)
    version('0.0.5', commit='45f6e892c007ab124fabb3a545f4744537eafb55', submodules=False)
    version('0.0.4', commit='2efe1220d0128d3f2d371c9ed5234c4978d73a77', submodules=False)
    version('0.0.3', commit='4fe4421ac624ba2efe1eee265153e690622a18a5', submodules=False)

    variant(
        'layouts',
        default=True,
        description='Build Kokkos View/DynRankView with layout variants',
    )
    variant(
        'memory_traits',
        default=True,
        description='Build Kokkos View/DynRankView with memory trait variants',
    )
    variant(
        'view_ranks',
        default='4',
        description='Max Kokkos View dimensions',
        values=('1', '2', '3', '4', '5', '6', '7'),
        multi=False,
    )

    extends('python')
    depends_on('cmake@3.16:', type='build')
    depends_on('py-pybind11', type='build')
    depends_on('kokkos@3.4.00:', type=('build', 'run'))
    depends_on('python@3:', type=('build', 'run'))

    def cmake_args(self):
        spec = self.spec

        args = [
            self.define('ENABLE_INTERNAL_KOKKOS', False),
            self.define('ENABLE_INTERNAL_PYBIND11', False),
            self.define('PYTHON_EXECUTABLE', spec['python'].command.path),
            self.define('Python3_EXECUTABLE', spec['python'].command.path),
            self.define_from_variant('ENABLE_VIEW_RANKS', 'view_ranks'),
        ]

        for dep in ('layouts', 'memory_traits'):
            args.append(self.define_from_variant('ENABLE_' + dep.upper(), dep))

        return args