summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/sys-sage/package.py
blob: c96dd329a39d0ac795741cb8f88e17d6b7054bda (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 2013-2024 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 SysSage(CMakePackage):
    """A library for capturing hardware topology and attributes of compute systems."""

    homepage = "https://github.com/caps-tum/sys-sage"
    url = "https://github.com/caps-tum/sys-sage/archive/refs/tags/v0.4.3.tar.gz"
    git = "https://github.com/caps-tum/sys-sage.git"

    maintainers("stepanvanecek")

    license("Apache-2.0")

    version("0.4.3", sha256="e24313c4274576c1511a62e1b27c86a78cea7e4c123b8a53303cfc70de978faa")
    version("master", branch="master")
    version("develop", branch="develop")

    conflicts("%gcc@:7", msg="gcc can be used from version 8 and above")

    variant(
        "nvidia_mig",
        default=False,
        description="Build and install functionality regarding NVidia MIG(multi-instance GPU, "
        "ampere or newer).",
    )
    variant(
        "cpuinfo",
        default=True,
        description="Build and install functionality regarding Linux cpuinfo (only x86) -- "
        "default ON.",
    )
    variant(
        "build_data_sources",
        default=False,
        when="platform=linux",
        description="Build all data sources (programs to collect data about the machine sys-sage "
        "runs on).",
    )
    variant(
        "ds_hwloc",
        default=False,
        description="Builds the hwloc data source for retrieving the CPU topology",
    )
    variant(
        "ds_numa",
        default=False,
        when="platform=linux",
        description="builds the caps-numa-benchmark. If turned on, includes Linux-specific "
        "libraries.",
    )

    depends_on("cmake@3.22:", type="build")
    depends_on("libxml2@2.9.13:")

    depends_on("numactl", when="+build_data_sources platform=linux")
    depends_on("numactl", when="+ds_numa platform=linux")
    depends_on("hwloc@2.9:", when="+build_data_sources")
    depends_on("hwloc@2.9:", when="+ds_hwloc")
    depends_on("cuda", when="+nvidia_mig platform=linux")
    depends_on("cuda", when="+build_data_sources platform=linux")

    def cmake_args(self):
        spec = self.spec
        args = []
        args.append(self.define_from_variant("NVIDIA_MIG", "nvidia_mig"))
        if "+cpuinfo" in spec and spec.target == "x86_64" and spec.platform == "linux":
            args.append(self.define("CPUINFO", True))
        else:
            args.append(self.define("CPUINFO", False))
        if "+ds_hwloc" in spec or "+build_data_sources" in spec:
            args.append(self.define("DS_HWLOC", True))
        if "+ds_numa" in spec or "+build_data_sources" in spec:
            args.append(self.define("DS_NUMA", True))
        return args