summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/py-pycompadre/package.py
blob: e205b8ef923dc73a18fd2bf11a6aadfdf8b1bb46 (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
# Copyright 2013-2023 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.package import *


class PyPycompadre(PythonPackage):
    """The Compadre Toolkit provides a performance portable solution for the
    parallel evaluation of computationally dense kernels. The toolkit
    specifically targets the Generalized Moving Least Squares (GMLS) approach,
    which requires the inversion of small dense matrices. The result is a set
    of weights that provide the information needed for remap or entries that
    constitute the rows of some globally sparse matrix.
    """

    homepage = "https://github.com/SNLComputation/compadre"
    git = "https://github.com/SNLComputation/compadre.git"
    url = "https://github.com/SNLComputation/compadre/archive/v1.3.0.tar.gz"
    maintainers("kuberry")

    version("master", branch="master", preferred=True)

    variant("trilinos", default=False, description="Use Kokkos from Trilinos")
    variant(
        "debug",
        default="0",
        values=["0", "1", "2"],
        multi=False,
        description="Debugging level 0) release 1) debug 2) extreme debugging",
    )

    depends_on("cmake@3.10.0:", type="build")
    depends_on("python@3.4:", type=("build", "link", "run"))
    depends_on("py-pip", type=("build", "link", "run"))
    depends_on("py-setuptools", type="build")
    depends_on("py-cython@0.23:", type="build")
    depends_on("trilinos@13.2:", when="+trilinos")

    @run_before("install")
    def set_cmake_from_variants(self):
        spec = self.spec
        with open("cmake_opts.txt", "w") as f:
            if "+trilinos" in spec:
                f.write("Trilinos_PREFIX:PATH=%s\n" % spec["trilinos"].prefix)
            if spec.variants["debug"].value == "0":
                f.write(
                    "CMAKE_CXX_FLAGS:STRING=%s\n"
                    % "' -Ofast -funroll-loops -march=native -mtune=native '"
                )
                f.write("Compadre_DEBUG:BOOL=OFF\n")
            else:
                f.write("CMAKE_CXX_FLAGS:STRING=%s\n" % "'-g -O0'")
                f.write("CMAKE_BUILD_TYPE:STRING=%s\n" % "DEBUG")
                f.write("Compadre_DEBUG:BOOL=ON\n")
                if spec.variants["debug"].value == "2":
                    f.write("Compadre_EXTREME_DEBUG:BOOL=ON\n")