From 1b5410b87b613cea4c44153fcd440a9ab8cca746 Mon Sep 17 00:00:00 2001 From: Piotr Luszczek Date: Sun, 8 Oct 2017 19:59:41 -0400 Subject: [PATCH] Add PLASMA package (#5540) --- .../repos/builtin/packages/plasma/package.py | 90 +++++++++++++++++++ .../plasma/remove_absolute_mkl_include.patch | 55 ++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 var/spack/repos/builtin/packages/plasma/package.py create mode 100644 var/spack/repos/builtin/packages/plasma/remove_absolute_mkl_include.patch diff --git a/var/spack/repos/builtin/packages/plasma/package.py b/var/spack/repos/builtin/packages/plasma/package.py new file mode 100644 index 0000000000..ffe0254651 --- /dev/null +++ b/var/spack/repos/builtin/packages/plasma/package.py @@ -0,0 +1,90 @@ +############################################################################## +# Copyright (c) 2017, Innovative Computing Laboratory +# Produced at the Innovative Computing Laboratory. +# +# Created by Piotr Luszczek, luszczek@icl.utk.edu, All rights reserved. +# +# For details, see https://github.com/llnl/spack +# +############################################################################## +# +from spack import * + + +class Plasma(MakefilePackage): + """Parallel Linear Algebra Software for Multicore Architectures, PLASMA is + a software package for solving problems in dense linear algebra using + multicore processors and Xeon Phi coprocessors. PLASMA provides + implementations of state-of-the-art algorithms using cutting-edge task + scheduling techniques. PLASMA currently offers a collection of routines for + solving linear systems of equations, least squares problems, eigenvalue + problems, and singular value problems.""" + + homepage = "https://bitbucket.org/icl/plasma/" + url = "https://bitbucket.org/icl/plasma/downloads/plasma-17.1.tar.gz" + + version("17.1", "64b410b76023a41b3f07a5f0dca554e1") + + version("develop", hg="https://luszczek@bitbucket.org/icl/plasma") + + depends_on("blas") + depends_on("lapack") + + conflicts("atlas") # does not have LAPACKE interface + conflicts("netlib-lapack@:2.999") # missing LAPACKE features + # 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") + conflicts("%cce") + conflicts("%clang") + conflicts("%intel") + conflicts("%nag") + conflicts("%pgi") + conflicts("%xl") + conflicts("%xl_r") + + patch("remove_absolute_mkl_include.patch", when="@17.1") + + def edit(self, spec, prefix): + # copy "make.inc.mkl-gcc" provided by default into "make.inc" + open("make.inc", "w").write(open("make.inc.mkl-gcc").read()) + + make_inc = FileFilter("make.inc") + + if not spec.satisfies("^mkl"): + make_inc.filter("-DPLASMA_WITH_MKL", "") # not using MKL + + header_flags = "" + # accumulate CPP flags for headers: and + for dep in ("blas", "lapack"): + try: # in case the dependency does not provide header flags + header_flags += " " + spec[dep].headers.cpp_flags + except: + pass + + make_inc.filter("CFLAGS +[+]=", "CFLAGS += " + header_flags + " ") + + # pass prefix variable from "make.inc" to "Makefile" + make_inc.filter("# --*", "prefix={0}".format(self.prefix)) + + # make sure CC variable comes from build environment + make_inc.filter("CC *[?]*= * .*cc", "") + + @property + def build_targets(self): + targets = list() + + # 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"])) + + # pass BLAS library flags + targets.append("LIBS = {0}".format(self.spec["blas"].libs.ld_flags)) + + return targets diff --git a/var/spack/repos/builtin/packages/plasma/remove_absolute_mkl_include.patch b/var/spack/repos/builtin/packages/plasma/remove_absolute_mkl_include.patch new file mode 100644 index 0000000000..2c9ef151e8 --- /dev/null +++ b/var/spack/repos/builtin/packages/plasma/remove_absolute_mkl_include.patch @@ -0,0 +1,55 @@ +--- a/compute/zgbtrf.c 2017-01-13 13:59:46.000000000 -0500 ++++ b/compute/zgbtrf.c 2017-09-21 17:18:46.550538802 -0400 +@@ -18,7 +18,7 @@ + #include "plasma_types.h" + #include "plasma_workspace.h" + +-#include "mkl_lapacke.h" ++#include "core_lapack.h" + + /***************************************************************************//** + * +--- a/compute/zgetrf.c 2017-01-13 13:59:46.000000000 -0500 ++++ b/compute/zgetrf.c 2017-09-21 17:18:46.550538802 -0400 +@@ -18,7 +18,7 @@ + #include "plasma_types.h" + #include "plasma_workspace.h" + +-#include "mkl_lapacke.h" ++#include "core_lapack.h" + + /***************************************************************************//** + * +--- a/compute/zgetrs.c 2017-01-13 13:59:46.000000000 -0500 ++++ b/compute/zgetrs.c 2017-09-21 17:18:46.550538802 -0400 +@@ -18,7 +18,7 @@ + #include "plasma_types.h" + #include "plasma_workspace.h" + +-#include "mkl_lapacke.h" ++#include "core_lapack.h" + + /***************************************************************************//** + * +--- a/compute/zgesv.c 2017-01-13 13:59:46.000000000 -0500 ++++ b/compute/zgesv.c 2017-09-21 17:18:46.550538802 -0400 +@@ -18,7 +18,7 @@ + #include "plasma_types.h" + #include "plasma_workspace.h" + +-#include "mkl_lapacke.h" ++#include "core_lapack.h" + + /***************************************************************************//** + * +--- a/compute/zgbsv.c 2017-01-13 13:59:46.000000000 -0500 ++++ b/compute/zgbsv.c 2017-09-21 17:18:46.550538802 -0400 +@@ -18,7 +18,7 @@ + #include "plasma_types.h" + #include "plasma_workspace.h" + +-#include "mkl_lapacke.h" ++#include "core_lapack.h" + + /***************************************************************************//** + *