Added magma package (#3273)
* Added magma package * Incorporated Serban's change * Removed cmake dependency
This commit is contained in:
parent
f34cd4be2b
commit
c4e7cfe02b
2 changed files with 315 additions and 0 deletions
248
var/spack/repos/builtin/packages/magma/ibm-xl.patch
Normal file
248
var/spack/repos/builtin/packages/magma/ibm-xl.patch
Normal file
|
@ -0,0 +1,248 @@
|
||||||
|
diff -Naur magma-2.2.0/src/dlaex3_m.cpp magma-2.2.0-patched/src/dlaex3_m.cpp
|
||||||
|
--- magma-2.2.0/src/dlaex3_m.cpp 2016-11-20 20:20:06.000000000 -0500
|
||||||
|
+++ magma-2.2.0/src/dlaex3_m.cpp 2017-01-06 15:54:29.423668874 -0500
|
||||||
|
@@ -197,7 +197,7 @@
|
||||||
|
magmaDouble_ptr dwork[],
|
||||||
|
magma_queue_t queues[MagmaMaxGPUs][2],
|
||||||
|
magma_range_t range, double vl, double vu, magma_int_t il, magma_int_t iu,
|
||||||
|
- magma_int_t *info )
|
||||||
|
+ magma_int_t *infom )
|
||||||
|
{
|
||||||
|
#define Q(i_,j_) (Q + (i_) + (j_)*ldq)
|
||||||
|
|
||||||
|
@@ -209,8 +209,8 @@
|
||||||
|
magma_setdevice(0);
|
||||||
|
magma_dlaex3( k, n, n1, d, Q, ldq, rho,
|
||||||
|
dlamda, Q2, indx, ctot, w, s, indxq,
|
||||||
|
- *dwork, range, vl, vu, il, iu, info );
|
||||||
|
- return *info;
|
||||||
|
+ *dwork, range, vl, vu, il, iu, infom );
|
||||||
|
+ return *infom;
|
||||||
|
}
|
||||||
|
double d_one = 1.;
|
||||||
|
double d_zero = 0.;
|
||||||
|
@@ -229,37 +229,37 @@
|
||||||
|
valeig = (range == MagmaRangeV);
|
||||||
|
indeig = (range == MagmaRangeI);
|
||||||
|
|
||||||
|
- *info = 0;
|
||||||
|
+ *infom = 0;
|
||||||
|
|
||||||
|
if (k < 0)
|
||||||
|
- *info=-1;
|
||||||
|
+ *infom=-1;
|
||||||
|
else if (n < k)
|
||||||
|
- *info=-2;
|
||||||
|
+ *infom=-2;
|
||||||
|
else if (ldq < max(1,n))
|
||||||
|
- *info=-6;
|
||||||
|
+ *infom=-6;
|
||||||
|
else if (! (alleig || valeig || indeig))
|
||||||
|
- *info = -15;
|
||||||
|
+ *infom = -15;
|
||||||
|
else {
|
||||||
|
if (valeig) {
|
||||||
|
if (n > 0 && vu <= vl)
|
||||||
|
- *info = -17;
|
||||||
|
+ *infom = -17;
|
||||||
|
}
|
||||||
|
else if (indeig) {
|
||||||
|
if (il < 1 || il > max(1,n))
|
||||||
|
- *info = -18;
|
||||||
|
+ *infom = -18;
|
||||||
|
else if (iu < min(n,il) || iu > n)
|
||||||
|
- *info = -19;
|
||||||
|
+ *infom = -19;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (*info != 0) {
|
||||||
|
- magma_xerbla( __func__, -(*info) );
|
||||||
|
- return *info;
|
||||||
|
+ if (*infom != 0) {
|
||||||
|
+ magma_xerbla( __func__, -(*infom) );
|
||||||
|
+ return *infom;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quick return if possible
|
||||||
|
if (k == 0)
|
||||||
|
- return *info;
|
||||||
|
+ return *infom;
|
||||||
|
|
||||||
|
magma_device_t orig_dev;
|
||||||
|
magma_getdevice( &orig_dev );
|
||||||
|
@@ -360,15 +360,15 @@
|
||||||
|
lapackf77_dlaed4( &k, &tmpp, dlamda, w, Q(0,j), &rho, &d[j], &iinfo );
|
||||||
|
// If the zero finder fails, the computation is terminated.
|
||||||
|
if (iinfo != 0) {
|
||||||
|
- #pragma omp critical (info)
|
||||||
|
- *info = iinfo;
|
||||||
|
+ #pragma omp critical (infom)
|
||||||
|
+ *infom = iinfo;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma omp barrier
|
||||||
|
|
||||||
|
- if (*info == 0) {
|
||||||
|
+ if (*infom == 0) {
|
||||||
|
#pragma omp single
|
||||||
|
{
|
||||||
|
// Prepare the INDXQ sorting permutation.
|
||||||
|
@@ -452,8 +452,8 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end omp parallel
|
||||||
|
- if (*info != 0)
|
||||||
|
- return *info;
|
||||||
|
+ if (*infom != 0)
|
||||||
|
+ return *infom;
|
||||||
|
|
||||||
|
timer_stop( time );
|
||||||
|
timer_printf( "eigenvalues/vector D+zzT = %6.2f\n", time );
|
||||||
|
@@ -474,10 +474,10 @@
|
||||||
|
lapackf77_dlaed4( &k, &tmpp, dlamda, w, Q(0,j), &rho, &d[j], &iinfo );
|
||||||
|
// If the zero finder fails, the computation is terminated.
|
||||||
|
if (iinfo != 0)
|
||||||
|
- *info=iinfo;
|
||||||
|
+ *infom=iinfo;
|
||||||
|
}
|
||||||
|
- if (*info != 0)
|
||||||
|
- return *info;
|
||||||
|
+ if (*infom != 0)
|
||||||
|
+ return *infom;
|
||||||
|
|
||||||
|
// Prepare the INDXQ sorting permutation.
|
||||||
|
magma_int_t nk = n - k;
|
||||||
|
@@ -688,5 +688,5 @@
|
||||||
|
|
||||||
|
magma_setdevice( orig_dev );
|
||||||
|
|
||||||
|
- return *info;
|
||||||
|
+ return *infom;
|
||||||
|
} /* magma_dlaed3_m */
|
||||||
|
diff -Naur magma-2.2.0/src/slaex3_m.cpp magma-2.2.0-patched/src/slaex3_m.cpp
|
||||||
|
--- magma-2.2.0/src/slaex3_m.cpp 2016-11-20 20:20:24.000000000 -0500
|
||||||
|
+++ magma-2.2.0/src/slaex3_m.cpp 2017-01-06 10:20:13.200783151 -0500
|
||||||
|
@@ -197,7 +197,7 @@
|
||||||
|
magmaFloat_ptr dwork[],
|
||||||
|
magma_queue_t queues[MagmaMaxGPUs][2],
|
||||||
|
magma_range_t range, float vl, float vu, magma_int_t il, magma_int_t iu,
|
||||||
|
- magma_int_t *info )
|
||||||
|
+ magma_int_t *infom )
|
||||||
|
{
|
||||||
|
#define Q(i_,j_) (Q + (i_) + (j_)*ldq)
|
||||||
|
|
||||||
|
@@ -209,8 +209,8 @@
|
||||||
|
magma_setdevice(0);
|
||||||
|
magma_slaex3( k, n, n1, d, Q, ldq, rho,
|
||||||
|
dlamda, Q2, indx, ctot, w, s, indxq,
|
||||||
|
- *dwork, range, vl, vu, il, iu, info );
|
||||||
|
- return *info;
|
||||||
|
+ *dwork, range, vl, vu, il, iu, infom );
|
||||||
|
+ return *infom;
|
||||||
|
}
|
||||||
|
float d_one = 1.;
|
||||||
|
float d_zero = 0.;
|
||||||
|
@@ -229,37 +229,37 @@
|
||||||
|
valeig = (range == MagmaRangeV);
|
||||||
|
indeig = (range == MagmaRangeI);
|
||||||
|
|
||||||
|
- *info = 0;
|
||||||
|
+ *infom = 0;
|
||||||
|
|
||||||
|
if (k < 0)
|
||||||
|
- *info=-1;
|
||||||
|
+ *infom=-1;
|
||||||
|
else if (n < k)
|
||||||
|
- *info=-2;
|
||||||
|
+ *infom=-2;
|
||||||
|
else if (ldq < max(1,n))
|
||||||
|
- *info=-6;
|
||||||
|
+ *infom=-6;
|
||||||
|
else if (! (alleig || valeig || indeig))
|
||||||
|
- *info = -15;
|
||||||
|
+ *infom = -15;
|
||||||
|
else {
|
||||||
|
if (valeig) {
|
||||||
|
if (n > 0 && vu <= vl)
|
||||||
|
- *info = -17;
|
||||||
|
+ *infom = -17;
|
||||||
|
}
|
||||||
|
else if (indeig) {
|
||||||
|
if (il < 1 || il > max(1,n))
|
||||||
|
- *info = -18;
|
||||||
|
+ *infom = -18;
|
||||||
|
else if (iu < min(n,il) || iu > n)
|
||||||
|
- *info = -19;
|
||||||
|
+ *infom = -19;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (*info != 0) {
|
||||||
|
- magma_xerbla( __func__, -(*info) );
|
||||||
|
- return *info;
|
||||||
|
+ if (*infom != 0) {
|
||||||
|
+ magma_xerbla( __func__, -(*infom) );
|
||||||
|
+ return *infom;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quick return if possible
|
||||||
|
if (k == 0)
|
||||||
|
- return *info;
|
||||||
|
+ return *infom;
|
||||||
|
|
||||||
|
magma_device_t orig_dev;
|
||||||
|
magma_getdevice( &orig_dev );
|
||||||
|
@@ -360,15 +360,15 @@
|
||||||
|
lapackf77_slaed4( &k, &tmpp, dlamda, w, Q(0,j), &rho, &d[j], &iinfo );
|
||||||
|
// If the zero finder fails, the computation is terminated.
|
||||||
|
if (iinfo != 0) {
|
||||||
|
- #pragma omp critical (info)
|
||||||
|
- *info = iinfo;
|
||||||
|
+ #pragma omp critical (infom)
|
||||||
|
+ *infom = iinfo;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma omp barrier
|
||||||
|
|
||||||
|
- if (*info == 0) {
|
||||||
|
+ if (*infom == 0) {
|
||||||
|
#pragma omp single
|
||||||
|
{
|
||||||
|
// Prepare the INDXQ sorting permutation.
|
||||||
|
@@ -452,8 +452,8 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // end omp parallel
|
||||||
|
- if (*info != 0)
|
||||||
|
- return *info;
|
||||||
|
+ if (*infom != 0)
|
||||||
|
+ return *infom;
|
||||||
|
|
||||||
|
timer_stop( time );
|
||||||
|
timer_printf( "eigenvalues/vector D+zzT = %6.2f\n", time );
|
||||||
|
@@ -474,10 +474,10 @@
|
||||||
|
lapackf77_slaed4( &k, &tmpp, dlamda, w, Q(0,j), &rho, &d[j], &iinfo );
|
||||||
|
// If the zero finder fails, the computation is terminated.
|
||||||
|
if (iinfo != 0)
|
||||||
|
- *info=iinfo;
|
||||||
|
+ *infom=iinfo;
|
||||||
|
}
|
||||||
|
- if (*info != 0)
|
||||||
|
- return *info;
|
||||||
|
+ if (*infom != 0)
|
||||||
|
+ return *infom;
|
||||||
|
|
||||||
|
// Prepare the INDXQ sorting permutation.
|
||||||
|
magma_int_t nk = n - k;
|
||||||
|
@@ -688,5 +688,5 @@
|
||||||
|
|
||||||
|
magma_setdevice( orig_dev );
|
||||||
|
|
||||||
|
- return *info;
|
||||||
|
+ return *infom;
|
||||||
|
} /* magma_slaed3_m */
|
67
var/spack/repos/builtin/packages/magma/package.py
Normal file
67
var/spack/repos/builtin/packages/magma/package.py
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
##############################################################################
|
||||||
|
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
|
||||||
|
# Produced at the Lawrence Livermore National Laboratory.
|
||||||
|
#
|
||||||
|
# This file is part of Spack.
|
||||||
|
# Created by Serban Maerean, serban@us.ibm.com, All rights reserved.
|
||||||
|
# LLNL-CODE-647188
|
||||||
|
#
|
||||||
|
# For details, see https://github.com/llnl/spack
|
||||||
|
# Please also see the LICENSE file for our notice and the LGPL.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License (as
|
||||||
|
# published by the Free Software Foundation) version 2.1, February 1999.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
|
||||||
|
# conditions of the GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
##############################################################################
|
||||||
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
|
class Magma(CMakePackage):
|
||||||
|
"""The MAGMA project aims to develop a dense linear algebra library
|
||||||
|
similar to LAPACK but for heterogeneous/hybrid architectures,
|
||||||
|
starting with current "Multicore+GPU" systems.
|
||||||
|
"""
|
||||||
|
|
||||||
|
homepage = "http://icl.cs.utk.edu/magma/"
|
||||||
|
url = "http://icl.cs.utk.edu/projectsfiles/magma/downloads/magma-2.2.0.tar.gz"
|
||||||
|
|
||||||
|
version('2.2.0', '6c1ebf4cdf63eb302ff6258ff8c49217')
|
||||||
|
|
||||||
|
variant('fortran', default=True,
|
||||||
|
description='Enable Fortran bindings support')
|
||||||
|
|
||||||
|
depends_on('lapack')
|
||||||
|
|
||||||
|
patch('ibm-xl.patch', when='@2.2:%xl')
|
||||||
|
patch('ibm-xl.patch', when='@2.2:%xl_r')
|
||||||
|
|
||||||
|
def cmake_args(self):
|
||||||
|
spec = self.spec
|
||||||
|
options = []
|
||||||
|
|
||||||
|
options.extend([
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=%s' % prefix,
|
||||||
|
'-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix,
|
||||||
|
'-DLAPACK_LIBRARIES=%s;%s' % (spec['blas'].blas_libs,
|
||||||
|
spec['lapack'].lapack_libs)
|
||||||
|
])
|
||||||
|
|
||||||
|
if '+fortran' in spec:
|
||||||
|
options.extend([
|
||||||
|
'-DUSE_FORTRAN=yes'
|
||||||
|
])
|
||||||
|
if spec.satisfies('%xl') or spec.satisfies('%xl_r'):
|
||||||
|
options.extend([
|
||||||
|
'-DCMAKE_Fortran_COMPILER=%s' % self.compiler.f77
|
||||||
|
])
|
||||||
|
|
||||||
|
return options
|
Loading…
Reference in a new issue