[arrayfire] 15/29: Fix windows builds when not using MKL

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Oct 19 17:48:53 UTC 2015


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

ghisvail-guest pushed a commit to branch master
in repository arrayfire.

commit 8856529cffae6f2a2859863398fc01156d432754
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Tue Oct 6 19:23:02 2015 -0400

    Fix windows builds when not using MKL
---
 src/backend/cblas.cpp    | 30 ++++++++++++++++++++++++++++--
 src/backend/cpu/blas.cpp | 37 ++++++++++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/src/backend/cblas.cpp b/src/backend/cblas.cpp
index 5400740..bea65b9 100644
--- a/src/backend/cblas.cpp
+++ b/src/backend/cblas.cpp
@@ -7,9 +7,33 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
 ********************************************************/
 
-#include <blas.hpp>
-
 #ifdef USE_F77_BLAS
+
+#ifdef AF_CPU
+    #include <blas.hpp>
+#else
+    #ifdef __APPLE__
+        #include <Accelerate/Accelerate.h>
+    #else
+        #ifdef USE_MKL
+            #include <mkl_cblas.h>
+        #else
+            extern "C" {
+                #include <cblas.h>
+            }
+        #endif
+    #endif
+
+    // TODO: Ask upstream for a more official way to detect it
+    #ifdef OPENBLAS_CONST
+        #define IS_OPENBLAS
+    #endif
+
+    #ifndef IS_OPENBLAS
+        typedef int blasint;
+    #endif
+#endif
+
 #define ADD_
 #include <cblas_f77.h>
 
@@ -80,4 +104,6 @@ GEMM_F77(c, void *, void, float)
 GEMM_F77(z, void *, void, double)
 #undef ADDR
 
+#else
+    #include <blas.hpp>
 #endif
diff --git a/src/backend/cpu/blas.cpp b/src/backend/cpu/blas.cpp
index 0bbd399..d01998b 100644
--- a/src/backend/cpu/blas.cpp
+++ b/src/backend/cpu/blas.cpp
@@ -24,12 +24,39 @@ namespace cpu
     using std::remove_const;
     using std::conditional;
 
-  // Some implementations of BLAS require void* for complex pointers while
-  // others use float*/double*
-#if (defined(OS_WIN) && !defined(USE_MKL)) || defined(IS_OPENBLAS)
-  static const bool cplx_void_ptr = false;
+// Some implementations of BLAS require void* for complex pointers while others use float*/double*
+//
+// Sample cgemm API
+// OpenBLAS
+// void cblas_cgemm(OPENBLAS_CONST enum CBLAS_ORDER Order, OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
+//                  OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
+//                  OPENBLAS_CONST float *alpha, OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
+//                  OPENBLAS_CONST float *B, OPENBLAS_CONST blasint ldb, OPENBLAS_CONST float *beta,
+//                  float *C, OPENBLAS_CONST blasint ldc);
+//
+// MKL
+// void cblas_cgemm(const  CBLAS_LAYOUT Layout, const CBLAS_TRANSPOSE TransA, const  CBLAS_TRANSPOSE TransB,
+//                  const MKL_INT M, const MKL_INT N, const MKL_INT K,
+//                  const void *alpha, const void *A, const MKL_INT lda,
+//                  const void *B, const MKL_INT ldb, const void *beta,
+//                  void *C, const MKL_INT ldc);
+// atlas cblas
+// void cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
+//                  const enum CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
+//                  const void *alpha, const void *A, const int lda,
+//                  const void *B, const int ldb, const void *beta,
+//                  void *C, const int ldc);
+//
+// LAPACKE
+// void cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
+//                  const enum CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
+//                  const void *alpha, const void *A, const int lda,
+//                  const void *B, const int ldb, const void *beta,
+//                  void *C, const int ldc);
+#if defined(IS_OPENBLAS)
+    static const bool cplx_void_ptr = false;
 #else
-  static const bool cplx_void_ptr = true;
+    static const bool cplx_void_ptr = true;
 #endif
 
 template<typename T, class Enable = void>

-- 
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