summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/netlib-lapack/package.py36
-rw-r--r--var/spack/repos/builtin/packages/plasma/add_netlib_lapacke_detection.patch11
-rw-r--r--var/spack/repos/builtin/packages/plasma/package.py41
3 files changed, 77 insertions, 11 deletions
diff --git a/var/spack/repos/builtin/packages/netlib-lapack/package.py b/var/spack/repos/builtin/packages/netlib-lapack/package.py
index 8166b75bf5..f6dfcd40a1 100644
--- a/var/spack/repos/builtin/packages/netlib-lapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-lapack/package.py
@@ -73,15 +73,47 @@ class NetlibLapack(Package):
@property
def blas_libs(self):
shared = True if '+shared' in self.spec else False
+ query_parameters = self.spec.last_query.extra_parameters
+ query2libraries = {
+ tuple(): ['libblas'],
+ ('c', 'fortran'): [
+ 'libcblas',
+ 'libblas',
+ ],
+ ('c',): [
+ 'libcblas',
+ ],
+ ('fortran',): [
+ 'libblas',
+ ]
+ }
+ key = tuple(sorted(query_parameters))
+ libraries = query2libraries[key]
return find_libraries(
- 'libblas', root=self.prefix, shared=shared, recurse=True
+ libraries, root=self.prefix, shared=shared, recurse=True
)
@property
def lapack_libs(self):
shared = True if '+shared' in self.spec else False
+ query_parameters = self.spec.last_query.extra_parameters
+ query2libraries = {
+ tuple(): ['liblapack'],
+ ('c', 'fortran'): [
+ 'liblapacke',
+ 'liblapack',
+ ],
+ ('c',): [
+ 'liblapacke',
+ ],
+ ('fortran',): [
+ 'liblapack',
+ ]
+ }
+ key = tuple(sorted(query_parameters))
+ libraries = query2libraries[key]
return find_libraries(
- 'liblapack', root=self.prefix, shared=shared, recurse=True
+ libraries, root=self.prefix, shared=shared, recurse=True
)
def install_one(self, spec, prefix, shared):
diff --git a/var/spack/repos/builtin/packages/plasma/add_netlib_lapacke_detection.patch b/var/spack/repos/builtin/packages/plasma/add_netlib_lapacke_detection.patch
new file mode 100644
index 0000000000..403dc8d40b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/plasma/add_netlib_lapacke_detection.patch
@@ -0,0 +1,11 @@
+--- a/include/core_lapack.h 2017-01-13 13:59:46.000000000 -0500
++++ b/include/core_lapack.h 2017-10-30 16:37:54.481966195 -0400
+@@ -27,7 +27,7 @@
+ // Netlib cblas.h does: enum CBLAS_ORDER {...};
+ // OpenBLAS cblas.h does: typedef enum CBLAS_ORDER {...} CBLAS_ORDER;
+ // We use (CBLAS_ORDER), so add these typedefs for Netlib.
+- #ifndef OPENBLAS_VERSION
++ #if ! defined(OPENBLAS_VERSION) && ! defined(F77_HEADER_INCLUDED)
+ typedef enum CBLAS_ORDER CBLAS_ORDER;
+ typedef enum CBLAS_TRANSPOSE CBLAS_TRANSPOSE;
+ typedef enum CBLAS_UPLO CBLAS_UPLO;
diff --git a/var/spack/repos/builtin/packages/plasma/package.py b/var/spack/repos/builtin/packages/plasma/package.py
index 46b662d63d..4565350303 100644
--- a/var/spack/repos/builtin/packages/plasma/package.py
+++ b/var/spack/repos/builtin/packages/plasma/package.py
@@ -27,18 +27,25 @@ class Plasma(MakefilePackage):
version("develop", hg="https://luszczek@bitbucket.org/icl/plasma")
+ variant('shared', default=True, description="Build shared library (disables static library)")
+
depends_on("blas")
depends_on("lapack")
conflicts("atlas") # does not have LAPACKE interface
- conflicts("netlib-lapack@:2.999") # missing LAPACKE features
+
+ # missing LAPACKE features and/or CBLAS headers
+ conflicts("netlib-lapack@:3.5.999")
+
# clashes with OpenBLAS declarations and has a problem compiling on its own
conflicts("cblas")
+
conflicts("openblas-with-lapack") # incomplete LAPACK implementation
conflicts("veclibfort")
- # only GCC 7+ and higher have sufficient support for OpenMP 4+ tasks+deps
- conflicts("%gcc@:6.999")
+ # only GCC 4.9+ and higher have sufficient support for OpenMP 4+ tasks+deps
+ conflicts("%gcc@:4.8.99")
+
conflicts("%cce")
conflicts("%clang")
conflicts("%intel")
@@ -48,6 +55,16 @@ class Plasma(MakefilePackage):
conflicts("%xl_r")
patch("remove_absolute_mkl_include.patch", when="@17.1")
+ patch("add_netlib_lapacke_detection.patch", when="@17.1")
+
+ def getblaslapacklibs(self):
+ if '^netlib-lapack' in self.spec:
+ bl_attr = ':c,fortran'
+ else:
+ bl_attr = ''
+ return self.spec['lapack' + bl_attr].libs + \
+ self.spec['blas' + bl_attr].libs + \
+ find_system_libraries(['libm'])
def edit(self, spec, prefix):
# copy "make.inc.mkl-gcc" provided by default into "make.inc"
@@ -55,7 +72,10 @@ class Plasma(MakefilePackage):
make_inc = FileFilter("make.inc")
- if not spec.satisfies("^mkl"):
+ if '~shared' in self.spec:
+ make_inc.filter("-fPIC", "") # not using fPIC
+
+ if "^mkl" not in spec:
make_inc.filter("-DPLASMA_WITH_MKL", "") # not using MKL
header_flags = ""
@@ -63,7 +83,7 @@ class Plasma(MakefilePackage):
for dep in ("blas", "lapack"):
try: # in case the dependency does not provide header flags
header_flags += " " + spec[dep].headers.cpp_flags
- except AttributeError:
+ except Exception:
pass
make_inc.filter("CFLAGS +[+]=", "CFLAGS += " + header_flags + " ")
@@ -74,6 +94,9 @@ class Plasma(MakefilePackage):
# make sure CC variable comes from build environment
make_inc.filter("CC *[?]*= * .*cc", "")
+ make_inc.filter("LIBS *[?]*= * .*", "LIBS = " +
+ self.getblaslapacklibs().ld_flags)
+
@property
def build_targets(self):
targets = list()
@@ -81,10 +104,10 @@ class Plasma(MakefilePackage):
# use $CC set by Spack
targets.append("CC = {0}".format(self.compiler.cc))
- if self.spec.satisfies("^mkl"):
- targets.append("MKLROOT = {0}/mkl".format(env["MKLROOT"]))
+ if "^mkl" in self.spec:
+ targets.append("MKLROOT = {0}".format(env["MKLROOT"]))
- # pass BLAS library flags
- targets.append("LIBS = {0}".format(self.spec["blas"].libs.ld_flags))
+ targets.append("LIBS = {0}".format(
+ self.getblaslapacklibs().ld_flags))
return targets