[arrayfire] 220/284: Fix OpenCL-CPU offload when OpenCL is built without lapack
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.
commit 735b66b5916a1b4ae79e179de2f06924a397c5bf
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Thu Jan 14 17:20:26 2016 -0500
Fix OpenCL-CPU offload when OpenCL is built without lapack
---
src/backend/opencl/blas.cpp | 4 ++++
src/backend/opencl/cpu/cpu_blas.cpp | 2 ++
src/backend/opencl/cpu/cpu_cholesky.cpp | 2 ++
src/backend/opencl/cpu/cpu_helper.hpp | 29 ++++++++++++++++++++---------
src/backend/opencl/cpu/cpu_inverse.cpp | 2 ++
src/backend/opencl/cpu/cpu_lu.cpp | 2 ++
src/backend/opencl/cpu/cpu_qr.cpp | 2 ++
src/backend/opencl/cpu/cpu_solve.cpp | 2 ++
src/backend/opencl/cpu/cpu_svd.cpp | 2 ++
src/backend/opencl/cpu/cpu_triangle.hpp | 2 ++
10 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/src/backend/opencl/blas.cpp b/src/backend/opencl/blas.cpp
index 97a5c1a..365e6e5 100644
--- a/src/backend/opencl/blas.cpp
+++ b/src/backend/opencl/blas.cpp
@@ -23,7 +23,9 @@
#include <reduce.hpp>
#include <complex.hpp>
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_blas.hpp>
+#endif
namespace opencl
{
@@ -118,9 +120,11 @@ template<typename T>
Array<T> matmul(const Array<T> &lhs, const Array<T> &rhs,
af_mat_prop optLhs, af_mat_prop optRhs)
{
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
if(OpenCLCPUOffload()) {
return cpu::matmul(lhs, rhs, optLhs, optRhs);
}
+#endif
initBlas();
clblasTranspose lOpts = toClblasTranspose(optLhs);
diff --git a/src/backend/opencl/cpu/cpu_blas.cpp b/src/backend/opencl/cpu/cpu_blas.cpp
index 1ff7e14..fe6fe99 100644
--- a/src/backend/opencl/cpu/cpu_blas.cpp
+++ b/src/backend/opencl/cpu/cpu_blas.cpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_helper.hpp>
#include <cpu/cpu_blas.hpp>
#include <math.hpp>
@@ -206,3 +207,4 @@ INSTANTIATE_BLAS(cdouble)
}
}
+#endif
diff --git a/src/backend/opencl/cpu/cpu_cholesky.cpp b/src/backend/opencl/cpu/cpu_cholesky.cpp
index bd871d7..9acbcc4 100644
--- a/src/backend/opencl/cpu/cpu_cholesky.cpp
+++ b/src/backend/opencl/cpu/cpu_cholesky.cpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_helper.hpp>
#include <cpu/cpu_cholesky.hpp>
#include <cpu/cpu_triangle.hpp>
@@ -80,3 +81,4 @@ INSTANTIATE_CH(cdouble)
}
}
+#endif
diff --git a/src/backend/opencl/cpu/cpu_helper.hpp b/src/backend/opencl/cpu/cpu_helper.hpp
index d407bb8..cbdc470 100644
--- a/src/backend/opencl/cpu/cpu_helper.hpp
+++ b/src/backend/opencl/cpu/cpu_helper.hpp
@@ -17,6 +17,11 @@
#include <err_common.hpp>
#include <platform.hpp>
+//********************************************************/
+// LAPACK
+//********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
+
#define lapack_complex_float opencl::cfloat
#define lapack_complex_double opencl::cdouble
#define LAPACK_PREFIX LAPACKE_
@@ -31,13 +36,26 @@
#define AF_LAPACK_COL_MAJOR 0
#else
#ifdef USE_MKL
- #include <mkl_cblas.h>
#include<mkl_lapacke.h>
#else
+ #include<lapacke.h>
+ #endif
+#endif //OS
+
+#endif // WITH_OPENCL_LINEAR_ALGEBRA
+
+//********************************************************/
+// BLAS
+//********************************************************/
+#ifdef __APPLE__
+ #include <Accelerate/Accelerate.h>
+#else
+ #ifdef USE_MKL
+ #include <mkl_cblas.h>
+ #else
extern "C" {
#include <cblas.h>
}
- #include<lapacke.h>
#endif
#endif
@@ -53,11 +71,4 @@
typedef int blasint;
#endif
-namespace opencl
-{
-namespace cpu
-{
-}
-}
-
#endif
diff --git a/src/backend/opencl/cpu/cpu_inverse.cpp b/src/backend/opencl/cpu/cpu_inverse.cpp
index fee1719..4f73a80 100644
--- a/src/backend/opencl/cpu/cpu_inverse.cpp
+++ b/src/backend/opencl/cpu/cpu_inverse.cpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_helper.hpp>
#include <cpu/cpu_inverse.hpp>
#include <cpu/cpu_lu.hpp>
@@ -72,3 +73,4 @@ INSTANTIATE(cdouble)
}
}
+#endif
diff --git a/src/backend/opencl/cpu/cpu_lu.cpp b/src/backend/opencl/cpu/cpu_lu.cpp
index 3eb574e..e0234fb 100644
--- a/src/backend/opencl/cpu/cpu_lu.cpp
+++ b/src/backend/opencl/cpu/cpu_lu.cpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_helper.hpp>
#include <cpu/cpu_lu.hpp>
#include <math.hpp>
@@ -174,3 +175,4 @@ INSTANTIATE_LU(cdouble)
}
}
+#endif
diff --git a/src/backend/opencl/cpu/cpu_qr.cpp b/src/backend/opencl/cpu/cpu_qr.cpp
index 32eca92..737a7ae 100644
--- a/src/backend/opencl/cpu/cpu_qr.cpp
+++ b/src/backend/opencl/cpu/cpu_qr.cpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_helper.hpp>
#include <cpu/cpu_qr.hpp>
#include <cpu/cpu_triangle.hpp>
@@ -114,3 +115,4 @@ INSTANTIATE_QR(cdouble)
}
}
+#endif
diff --git a/src/backend/opencl/cpu/cpu_solve.cpp b/src/backend/opencl/cpu/cpu_solve.cpp
index 9e4f093..1bb72f8 100644
--- a/src/backend/opencl/cpu/cpu_solve.cpp
+++ b/src/backend/opencl/cpu/cpu_solve.cpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_helper.hpp>
#include <cpu/cpu_solve.hpp>
#include <copy.hpp>
@@ -172,3 +173,4 @@ INSTANTIATE_SOLVE(cdouble)
}
}
+#endif
diff --git a/src/backend/opencl/cpu/cpu_svd.cpp b/src/backend/opencl/cpu/cpu_svd.cpp
index c53df8a..3608bf6 100644
--- a/src/backend/opencl/cpu/cpu_svd.cpp
+++ b/src/backend/opencl/cpu/cpu_svd.cpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#include <cpu/cpu_helper.hpp>
#include <cpu/cpu_svd.hpp>
#include <copy.hpp>
@@ -108,3 +109,4 @@ namespace cpu
INSTANTIATE_SVD(cdouble, double)
}
}
+#endif
diff --git a/src/backend/opencl/cpu/cpu_triangle.hpp b/src/backend/opencl/cpu/cpu_triangle.hpp
index f953d58..e705420 100644
--- a/src/backend/opencl/cpu/cpu_triangle.hpp
+++ b/src/backend/opencl/cpu/cpu_triangle.hpp
@@ -7,6 +7,7 @@
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#if defined(WITH_OPENCL_LINEAR_ALGEBRA)
#ifndef CPU_LAPACK_TRIANGLE
#define CPU_LAPACK_TRIANGLE
@@ -53,3 +54,4 @@ void triangle(T *o, const T *i, const dim4 odm, const dim4 ost, const dim4 ist)
}
#endif
+#endif
--
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