summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/essl/package.py
blob: bda77a149fa4dbf92ea410d43b2e446404ad1dac (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
# 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 Essl(BundlePackage):
    """IBM's Engineering and Scientific Subroutine Library (ESSL)."""

    homepage = "https://www.ibm.com/systems/power/software/essl/"

    # https://www.ibm.com/docs/en/essl/6.2?topic=whats-new
    version("6.2.1.1")

    variant("ilp64", default=False, description="64 bit integers")
    variant(
        "threads",
        default="openmp",
        description="Multithreading support",
        values=("openmp", "none"),
        multi=False,
    )
    variant("cuda", default=False, description="CUDA acceleration")
    variant("lapackforessl", default=False, description="Provides lapackforessl lapack library")

    provides("blas")
    provides("lapack", when="+lapackforessl")

    conflicts(
        "+cuda",
        when="+ilp64",
        msg="ESSL+cuda+ilp64 cannot combine CUDA acceleration 64 bit integers",
    )

    conflicts(
        "+cuda",
        when="threads=none",
        msg="ESSL+cuda threads=none cannot combine CUDA acceleration"
        " without multithreading support",
    )

    @property
    def blas_libs(self):
        spec = self.spec
        prefix = self.prefix

        if "+ilp64" in spec:
            essl_lib = ["libessl6464"]
        else:
            essl_lib = ["libessl"]

        if spec.satisfies("threads=openmp"):
            # ESSL SMP support requires XL or Clang OpenMP library
            if "%xl" in spec or "%xl_r" in spec or "%clang" in spec:
                if "+ilp64" in spec:
                    essl_lib = ["libesslsmp6464"]
                else:
                    if "+cuda" in spec:
                        essl_lib = ["libesslsmpcuda"]
                    else:
                        essl_lib = ["libesslsmp"]

        essl_root = prefix.lib64
        essl_libs = find_libraries(essl_lib, root=essl_root, shared=True)

        return essl_libs

    @property
    def lapack_libs(self):
        essl_libs = find_libraries(
            ["liblapackforessl", "liblapackforessl_"], root=self.prefix.lib64, shared=True
        )
        return essl_libs