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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# Copyright 2013-2022 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)
import sys
from spack.package import *
class ScalapackBase(CMakePackage):
"""Base class for building ScaLAPACK, shared with the AMD optimized version
of the library in the 'amdscalapack' package.
"""
variant(
"build_type",
default="Release",
description="CMake build type",
values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
)
variant("shared", default=True, description="Build the shared library version")
variant("pic", default=False, description="Build position independent code")
provides("scalapack")
depends_on("mpi")
depends_on("lapack")
depends_on("blas")
depends_on("cmake", when="@2.0.0:", type="build")
# See: https://github.com/Reference-ScaLAPACK/scalapack/issues/9
patch("cmake_fortran_mangle.patch", when="@2.0.2:2.0")
# See: https://github.com/Reference-ScaLAPACK/scalapack/pull/10
patch("mpi2-compatibility.patch", when="@2.0.2:2.0")
# See: https://github.com/Reference-ScaLAPACK/scalapack/pull/16
patch("int_overflow.patch", when="@2.0.0:2.1.0")
# See: https://github.com/Reference-ScaLAPACK/scalapack/pull/23
patch("gcc10-compatibility.patch", when="@2.0.0:2.2.0")
# See: https://github.com/Reference-ScaLAPACK/scalapack/pull/57
patch(
"https://github.com/Reference-ScaLAPACK/scalapack/commit/d4d0066c041cf19a23f8b3aa62fbcf5f0a33c166.patch?full_index=1",
sha256="072b006e485f0ca4cba56096912a986e4d3da73aae51c2205928aa5eb842cefd",
when="@2.2.0",
)
def flag_handler(self, name, flags):
iflags = []
if name == "fflags":
if self.spec.satisfies("%cce"):
iflags.append("-hnopattern")
return (iflags, None, None)
@property
def libs(self):
# Note that the default will be to search
# for 'libnetlib-scalapack.<suffix>'
shared = True if "+shared" in self.spec else False
return find_libraries("libscalapack", root=self.prefix, shared=shared, recursive=True)
def cmake_args(self):
spec = self.spec
options = [
"-DBUILD_SHARED_LIBS:BOOL=%s" % ("ON" if "+shared" in spec else "OFF"),
"-DBUILD_STATIC_LIBS:BOOL=%s" % ("OFF" if "+shared" in spec else "ON"),
]
# Make sure we use Spack's Lapack:
blas = spec["blas"].libs
lapack = spec["lapack"].libs
options.extend(
[
"-DLAPACK_FOUND=true",
"-DLAPACK_INCLUDE_DIRS=%s" % spec["lapack"].prefix.include,
"-DLAPACK_LIBRARIES=%s" % (lapack.joined(";")),
"-DBLAS_LIBRARIES=%s" % (blas.joined(";")),
]
)
c_flags = []
if "+pic" in spec:
c_flags.append(self.compiler.cc_pic_flag)
options.append("-DCMAKE_Fortran_FLAGS=%s" % self.compiler.fc_pic_flag)
# Work around errors of the form:
# error: implicit declaration of function 'BI_smvcopy' is
# invalid in C99 [-Werror,-Wimplicit-function-declaration]
if spec.satisfies("%clang") or spec.satisfies("%apple-clang") or spec.satisfies("%oneapi"):
c_flags.append("-Wno-error=implicit-function-declaration")
options.append(self.define("CMAKE_C_FLAGS", " ".join(c_flags)))
return options
@run_after("install")
def fix_darwin_install(self):
# The shared libraries are not installed correctly on Darwin:
if (sys.platform == "darwin") and ("+shared" in self.spec):
fix_darwin_install_name(self.spec.prefix.lib)
class NetlibScalapack(ScalapackBase):
"""ScaLAPACK is a library of high-performance linear algebra routines for
parallel distributed memory machines
"""
homepage = "https://www.netlib.org/scalapack/"
url = "https://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
tags = ["e4s"]
version("2.2.0", sha256="40b9406c20735a9a3009d863318cb8d3e496fb073d201c5463df810e01ab2a57")
version("2.1.0", sha256="61d9216cf81d246944720cfce96255878a3f85dec13b9351f1fa0fd6768220a6")
version("2.0.2", sha256="0c74aeae690fe5ee4db7926f49c5d0bb69ce09eea75beb915e00bba07530395c")
version("2.0.1", sha256="a9b34278d4e10b40cbe084c6d87d09af8845e874250719bfbbc497b2a88bfde1")
version("2.0.0", sha256="e51fbd9c3ef3a0dbd81385b868e2355900148eea689bf915c5383d72daf73114")
# versions before 2.0.0 are not using cmake and requires blacs as
# a separated package
|