[arrayfire] 350/408: Compilation fixes for OSX

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit ed9e1be815421c04d50c850ad4350f1b6c16d1b3
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Aug 25 14:38:06 2015 -0400

    Compilation fixes for OSX
---
 src/backend/lapacke.cpp                     | 168 ++++++++++++++++++++++++++++
 src/backend/lapacke.hpp                     |  93 ++++++++++++++-
 src/backend/opencl/magma/magma_cpu_lapack.h |   3 -
 3 files changed, 260 insertions(+), 4 deletions(-)

diff --git a/src/backend/lapacke.cpp b/src/backend/lapacke.cpp
index ec3439c..1cb3856 100644
--- a/src/backend/lapacke.cpp
+++ b/src/backend/lapacke.cpp
@@ -12,6 +12,8 @@
 #include "lapacke.hpp"
 #include <cstdint>
 #include <algorithm>
+#include <traits.hpp>
+#include <vector>
 
 #if INTPTR_MAX == INT16MAX
     #define BS 16
@@ -165,4 +167,170 @@ LAPACK_MQR_WORK(ormqr, d, double, double*)
 LAPACK_MQR_WORK(unmqr, c, cfloat, __CLPK_complex*)
 LAPACK_MQR_WORK(unmqr, z, cdouble, __CLPK_doublecomplex*)
 
+
+#define LAPACK_GESDD_REAL(P, X, T, Tr, TO)          \
+    int LAPACKE_##X##P(int layout,                  \
+                       char jobz,                   \
+                       int m, int n,                \
+                       T* in, int ldin,             \
+                       Tr* s,                       \
+                       T* u, int ldu,               \
+                       T* vt, int ldvt)             \
+    {                                               \
+        int info = 0;                               \
+        int lwork = -1;                             \
+        T work_param = 0;                           \
+        X##P##_(&jobz, &m, &n, (TO)in, &ldin,       \
+                s, (TO)u, &ldu, (TO)vt, &ldvt,      \
+                &work_param, &lwork,                \
+                NULL, &info);                       \
+        lwork = work_param;                         \
+        std::vector<T> work(lwork);                 \
+        std::vector<int> iwork(8 * std::min(m, n)); \
+        X##P##_(&jobz, &m, &n, (TO)in, &ldin,       \
+                s, (TO)u, &ldu, (TO)vt, &ldvt,      \
+                (TO)&work[0], &lwork,               \
+                &iwork[0], &info);                  \
+        return info;                                \
+    }
+
+#define LAPACK_GESDD_CPLX(P, X, T, Tr, TO)          \
+    int LAPACKE_##X##P(int layout,                  \
+                       char jobz,                   \
+                       int m, int n,                \
+                       T* in, int ldin,             \
+                       Tr* s,                       \
+                       T* u, int ldu,               \
+                       T* vt, int ldvt)             \
+    {                                               \
+        int info = 0;                               \
+        int max_mn = std::max(m, n);                \
+        int min_mn = std::max(m, n);                \
+        int lwork = 5 * max_mn;                     \
+        std::vector<T> work(lwork);                 \
+        std::vector<int> iwork(8 * std::min(m, n)); \
+        int irwork = std::max(1,                    \
+                              min_mn *              \
+                              std::max(5*min_mn+7,  \
+                                       2*max_mn+2*  \
+                                       min_mn+1));  \
+        std::vector<Tr> rwork(irwork);              \
+        X##P##_(&jobz, &m, &n, (TO)in, &ldin,       \
+                s, (TO)u, &ldu, (TO)vt, &ldvt,      \
+                (TO)&work[0], &lwork,               \
+                &rwork[0], &iwork[0], &info);       \
+        return info;                                \
+    }
+
+
+LAPACK_GESDD_REAL(gesdd, s, float  , float , float*)
+LAPACK_GESDD_REAL(gesdd, d, double , double, double*)
+LAPACK_GESDD_CPLX(gesdd, c, cfloat , float ,__CLPK_complex*)
+LAPACK_GESDD_CPLX(gesdd, z, cdouble, double,__CLPK_doublecomplex*)
+
+#define LAPACK_LAMCH(X, T) T LAPACKE_##X##lamch(char cmach) { return X##lamch_(&cmach); }
+
+LAPACK_LAMCH(s, float )
+LAPACK_LAMCH(d, double)
+
+#define LAPACK_LACPY(X, T, TO)                                  \
+    int LAPACKE_##X##lacpy(int matrix_order, char uplo, int m,  \
+                           int n, const T* a,                   \
+                           int lda, T* b,                       \
+                           int ldb )                            \
+    {                                                           \
+        int info = 0;                                           \
+        X##lacpy_(&uplo, &m, &n, (TO)a, &lda, (TO)b, &ldb);     \
+        return info;                                            \
+    }
+
+LAPACK_LACPY(s, float, float*)
+LAPACK_LACPY(d, double, double*)
+LAPACK_LACPY(c, cfloat,__CLPK_complex*)
+LAPACK_LACPY(z, cdouble,__CLPK_doublecomplex*)
+
+#define LAPACK_GBR_WORK(P, X, T, TO)                                \
+    int LAPACKE_##X##P##_work(int matrix_order, char vect, int m,   \
+                              int n, int k, T* a,                   \
+                              int lda, const T* tau, T* work,       \
+                              int lwork )                           \
+    {                                                               \
+        int info = 0;                                               \
+        X##P##_(&vect, &m, &n, &k, (TO)a, &lda,                     \
+                (TO)tau, (TO)work, &lwork, &info);                  \
+        return info;                                                \
+    }
+
+LAPACK_GBR_WORK(orgbr, s, float, float*)
+LAPACK_GBR_WORK(orgbr, d, double, double*)
+LAPACK_GBR_WORK(ungbr, c, cfloat,__CLPK_complex*)
+LAPACK_GBR_WORK(ungbr, z, cdouble,__CLPK_doublecomplex*)
+
+#define LAPACK_BDSQR_WORK(X, T, Tr, TO)                                 \
+    int LAPACKE_##X##bdsqr_work( int matrix_order, char uplo, int n,    \
+                                 int ncvt, int nru, int ncc,            \
+                                 Tr* d, Tr* e, T* vt,                   \
+                                 int ldvt, T* u,                        \
+                                 int ldu, T* c,                         \
+                                 int ldc, Tr* work)                     \
+    {                                                                   \
+        int info = 0;                                                   \
+        X##bdsqr_(&uplo, &n, &ncvt, &nru, &ncc, d, e,                   \
+                  (TO)vt, &ldvt, (TO)u, &ldu,                           \
+                  (TO)c, &ldc, work, &info);                            \
+        return info;                                                    \
+    }                                                                   \
+
+
+LAPACK_BDSQR_WORK(s, float, float, float*)
+LAPACK_BDSQR_WORK(d, double, double, double*)
+LAPACK_BDSQR_WORK(c, cfloat, float,__CLPK_complex*)
+LAPACK_BDSQR_WORK(z, cdouble, double,__CLPK_doublecomplex*)
+
+
+#define LAPACK_GEBRD_WORK(X, T, Tr, TO)                             \
+    int LAPACKE_##X##gebrd_work( int matrix_order, int m, int n,    \
+                                 T* a, int lda,                     \
+                                 Tr* d, Tr* e, T* tauq,             \
+                                 T* taup,                           \
+                                 T* work, int lwork )               \
+    {                                                               \
+        int info = 0;                                               \
+        X##gebrd_(&m, &n, (TO)a, &lda, d, e, (TO)tauq, (TO)taup,    \
+                  (TO)work, &lwork, &info);                         \
+        return info;                                                \
+    }
+
+LAPACK_GEBRD_WORK(s, float, float, float*)
+LAPACK_GEBRD_WORK(d, double, double, double*)
+LAPACK_GEBRD_WORK(c, cfloat, float, __CLPK_complex*)
+LAPACK_GEBRD_WORK(z, cdouble, double,__CLPK_doublecomplex*)
+
+#define LAPACK_LARFG_WORK(X, T, TO)                         \
+    int LAPACKE_##X##larfg_work( int n, T* alpha,           \
+                                 T* x, int incx,            \
+                                 T* tau )                   \
+    {                                                       \
+        int info = 0;                                       \
+        X##larfg_(&n, (TO)alpha, (TO)x, &incx, (TO)tau);    \
+        return info;                                        \
+    }
+
+LAPACK_LARFG_WORK(s, float, float*)
+LAPACK_LARFG_WORK(d, double, double*)
+LAPACK_LARFG_WORK(c, cfloat, __CLPK_complex*)
+LAPACK_LARFG_WORK(z, cdouble, __CLPK_doublecomplex*)
+
+#define LAPACK_LACGV_WORK(X, T, TO)             \
+    int LAPACKE_##X##lacgv_work( int n, T* x,   \
+                                 int incx)      \
+    {                                           \
+        X##lacgv_(&n, (TO)x, &incx);            \
+        return 0;                               \
+    }
+
+LAPACK_LACGV_WORK(c, cfloat, __CLPK_complex*)
+LAPACK_LACGV_WORK(z, cdouble, __CLPK_doublecomplex*)
+
+
 #endif
diff --git a/src/backend/lapacke.hpp b/src/backend/lapacke.hpp
index 9954fe1..a9e885c 100644
--- a/src/backend/lapacke.hpp
+++ b/src/backend/lapacke.hpp
@@ -68,9 +68,100 @@ LAPACK_MQR_WORK(ormqr, d, double)
 LAPACK_MQR_WORK(unmqr, c, cfloat)
 LAPACK_MQR_WORK(unmqr, z, cdouble)
 
+#define LAPACK_GESDD(P, X, T, Tr)               \
+    int LAPACKE_##X##P(int layout,              \
+                       char jobz,               \
+                       int m, int n,            \
+                       T* in, int ldin,         \
+                       Tr* s,                   \
+                       T* u, int ldu,           \
+                       T* vt, int ldvt);        \
+
+LAPACK_GESDD(gesdd, s, float  , float )
+LAPACK_GESDD(gesdd, d, double , double)
+LAPACK_GESDD(gesdd, c, cfloat , float )
+LAPACK_GESDD(gesdd, z, cdouble, double)
+
+#define LAPACK_LAMCH(X, T) T LAPACKE_##X##lamch(char cmach);
+
+LAPACK_LAMCH(s, float )
+LAPACK_LAMCH(d, double)
+
+#define LAPACK_LACPY(X, T)                                      \
+    int LAPACKE_##X##lacpy(int matrix_order, char uplo, int m,  \
+                           int n, const T* a,                   \
+                           int lda, T* b,                       \
+                           int ldb );                           \
+
+
+LAPACK_LACPY(s, float)
+LAPACK_LACPY(d, double)
+LAPACK_LACPY(c, cfloat)
+LAPACK_LACPY(z, cdouble)
+
+#define LAPACK_GBR_WORK(P, X, T)                                    \
+    int LAPACKE_##X##P##_work(int matrix_order, char vect, int m,   \
+                              int n, int k, T* a,                   \
+                              int lda, const T* tau, T* work,       \
+                              int lwork );                          \
+
+LAPACK_GBR_WORK(orgbr, s, float)
+LAPACK_GBR_WORK(orgbr, d, double)
+LAPACK_GBR_WORK(ungbr, c, cfloat)
+LAPACK_GBR_WORK(ungbr, z, cdouble)
+
+#define LAPACK_BDSQR_WORK(X, T, Tr)                                     \
+    int LAPACKE_##X##bdsqr_work( int matrix_order, char uplo, int n,    \
+                                 int ncvt, int nru, int ncc,            \
+                                 Tr* d, Tr* e, T* vt,                   \
+                                 int ldvt, T* u,                        \
+                                 int ldu, T* c,                         \
+                                 int ldc, Tr* work );                   \
+
+LAPACK_BDSQR_WORK(s, float, float)
+LAPACK_BDSQR_WORK(d, double, double)
+LAPACK_BDSQR_WORK(c, cfloat, float)
+LAPACK_BDSQR_WORK(z, cdouble, double)
+
+#define LAPACK_GEBRD_WORK(X, T, Tr)                                 \
+    int LAPACKE_##X##gebrd_work( int matrix_order, int m, int n,    \
+                                 T* a, int lda,                     \
+                                 Tr* d, Tr* e, T* tauq,             \
+                                 T* taup,                           \
+                                 T* work, int lwork );              \
+
+LAPACK_GEBRD_WORK(s, float, float)
+LAPACK_GEBRD_WORK(d, double, double)
+LAPACK_GEBRD_WORK(c, cfloat, float)
+LAPACK_GEBRD_WORK(z, cdouble, double)
+
+#define LAPACK_LARFG_WORK(X, T)                     \
+    int LAPACKE_##X##larfg_work( int n, T* alpha,   \
+                                 T* x, int incx,    \
+                                 T* tau );          \
+
+LAPACK_LARFG_WORK(s, float)
+LAPACK_LARFG_WORK(d, double)
+LAPACK_LARFG_WORK(c, cfloat)
+LAPACK_LARFG_WORK(z, cdouble)
+
+#define LAPACK_LACGV_WORK(X, T)                 \
+    int LAPACKE_##X##lacgv_work( int n, T* x,   \
+                                 int incx );    \
+
+LAPACK_LACGV_WORK(c, cfloat)
+LAPACK_LACGV_WORK(z, cdouble)
+
 #undef LAPACK_FUNC
 #undef LAPACK_GQR
 #undef LAPACK_GQR_WORK
 #undef LAPACK_MQR_WORK
-
+#undef LAPACK_GESDD
+#undef LAPACK_LAMCH
+#undef LAPACK_LACPY
+#undef LAPACK_GBR_WORK
+#undef LAPACK_BDSQR_WORK
+#undef LAPACK_GEBRD_WORK
+#undef LAPACK_LARFG_WORK
+#undef LAPACK_LACGV_WORK
 #endif
diff --git a/src/backend/opencl/magma/magma_cpu_lapack.h b/src/backend/opencl/magma/magma_cpu_lapack.h
index 445defd..f737acb 100644
--- a/src/backend/opencl/magma/magma_cpu_lapack.h
+++ b/src/backend/opencl/magma/magma_cpu_lapack.h
@@ -121,7 +121,6 @@ int LAPACKE_dlacgv_work(Args... args) { return 0; }
     CPU_LAPACK_FUNC3(NAME, double,     d)       \
 
 CPU_LAPACK_DECL1(getrf)
-CPU_LAPACK_DECL1(gebrd)
 CPU_LAPACK_DECL1(gebrd_work)
 CPU_LAPACK_DECL1(potrf)
 CPU_LAPACK_DECL1(trtri)
@@ -134,9 +133,7 @@ CPU_LAPACK_DECL1(bdsqr_work)
 CPU_LAPACK_DECL1(laswp)
 CPU_LAPACK_DECL1(laset)
 
-CPU_LAPACK_DECL2(lacgv)
 CPU_LAPACK_DECL2(lacgv_work)
-CPU_LAPACK_DECL2(larfg)
 CPU_LAPACK_DECL2(larfg_work)
 CPU_LAPACK_DECL1(lacpy)
 CPU_LAPACK_DECL3(lamch)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list