[arrayfire] 178/284: Clean up header files in opencl/cpu/

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:31 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 210a64cbb6c824d483f1ed201e78d151423c7a46
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Fri Jan 8 16:56:12 2016 -0500

    Clean up header files in opencl/cpu/
---
 src/backend/opencl/cpu/cpu_blas.cpp          |  7 ++----
 src/backend/opencl/cpu/cpu_blas.hpp          |  2 +-
 src/backend/opencl/cpu/cpu_cholesky.cpp      | 10 ++------
 src/backend/opencl/cpu/cpu_helper.hpp        | 37 ++++++++++++++++++++--------
 src/backend/opencl/cpu/cpu_inverse.cpp       |  5 ++--
 src/backend/opencl/cpu/cpu_lapack_helper.hpp | 35 --------------------------
 src/backend/opencl/cpu/cpu_lu.cpp            | 11 +++------
 src/backend/opencl/cpu/cpu_qr.cpp            | 11 ++-------
 src/backend/opencl/cpu/cpu_solve.cpp         |  5 +---
 src/backend/opencl/cpu/cpu_svd.cpp           |  8 +++---
 src/backend/opencl/cpu/cpu_triangle.hpp      |  3 +++
 11 files changed, 48 insertions(+), 86 deletions(-)

diff --git a/src/backend/opencl/cpu/cpu_blas.cpp b/src/backend/opencl/cpu/cpu_blas.cpp
index ff7170d..8c77fff 100644
--- a/src/backend/opencl/cpu/cpu_blas.cpp
+++ b/src/backend/opencl/cpu/cpu_blas.cpp
@@ -7,12 +7,9 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
+#include <cpu/cpu_helper.hpp>
 #include <cpu/cpu_blas.hpp>
-#include <af/dim4.hpp>
-#include <handle.hpp>
-#include <cassert>
-#include <err_common.hpp>
-#include <platform.hpp>
+#include <math.hpp>
 
 namespace opencl
 {
diff --git a/src/backend/opencl/cpu/cpu_blas.hpp b/src/backend/opencl/cpu/cpu_blas.hpp
index 836d6e0..9087424 100644
--- a/src/backend/opencl/cpu/cpu_blas.hpp
+++ b/src/backend/opencl/cpu/cpu_blas.hpp
@@ -7,7 +7,7 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
-#include <cpu/cpu_helper.hpp>
+#include <Array.hpp>
 
 namespace opencl
 {
diff --git a/src/backend/opencl/cpu/cpu_cholesky.cpp b/src/backend/opencl/cpu/cpu_cholesky.cpp
index 234df2b..74bbf59 100644
--- a/src/backend/opencl/cpu/cpu_cholesky.cpp
+++ b/src/backend/opencl/cpu/cpu_cholesky.cpp
@@ -7,16 +7,10 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
-#include <cpu/cpu_lapack_helper.hpp>
+#include <cpu/cpu_helper.hpp>
 #include <cpu/cpu_cholesky.hpp>
-#include <err_common.hpp>
-
-#include <af/dim4.hpp>
-#include <handle.hpp>
-#include <iostream>
-#include <cassert>
-
 #include <cpu/cpu_triangle.hpp>
+#include <copy.hpp>
 
 namespace opencl
 {
diff --git a/src/backend/opencl/cpu/cpu_helper.hpp b/src/backend/opencl/cpu/cpu_helper.hpp
index afc60d3..d407bb8 100644
--- a/src/backend/opencl/cpu/cpu_helper.hpp
+++ b/src/backend/opencl/cpu/cpu_helper.hpp
@@ -7,22 +7,38 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
+#ifndef AF_OPENCL_CPU
+#define AF_OPENCL_CPU
+
 #include <af/defines.h>
-#include <af/blas.h>
-#include <af/lapack.h>
 #include <Array.hpp>
 #include <memory.hpp>
+#include <types.hpp>
+#include <err_common.hpp>
+#include <platform.hpp>
+
+#define lapack_complex_float opencl::cfloat
+#define lapack_complex_double opencl::cdouble
+#define LAPACK_PREFIX LAPACKE_
+#define ORDER_TYPE int
+#define AF_LAPACK_COL_MAJOR LAPACK_COL_MAJOR
+#define LAPACK_NAME(fn) LAPACKE_##fn
 
 #ifdef __APPLE__
-#include <Accelerate/Accelerate.h>
-#else
-#ifdef USE_MKL
-#include <mkl_cblas.h>
+    #include <Accelerate/Accelerate.h>
+    #include <lapacke.hpp>
+    #undef AF_LAPACK_COL_MAJOR
+    #define AF_LAPACK_COL_MAJOR 0
 #else
-extern "C" {
-#include <cblas.h>
-}
-#endif
+    #ifdef USE_MKL
+        #include <mkl_cblas.h>
+        #include<mkl_lapacke.h>
+    #else
+        extern "C" {
+        #include <cblas.h>
+        }
+        #include<lapacke.h>
+    #endif
 #endif
 
 // TODO: Ask upstream for a more official way to detect it
@@ -44,3 +60,4 @@ namespace cpu
 }
 }
 
+#endif
diff --git a/src/backend/opencl/cpu/cpu_inverse.cpp b/src/backend/opencl/cpu/cpu_inverse.cpp
index f1418b2..24b4a67 100644
--- a/src/backend/opencl/cpu/cpu_inverse.cpp
+++ b/src/backend/opencl/cpu/cpu_inverse.cpp
@@ -7,11 +7,10 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
-#include <cpu/cpu_lapack_helper.hpp>
+#include <cpu/cpu_helper.hpp>
 #include <cpu/cpu_inverse.hpp>
-#include <err_common.hpp>
-#include <copy.hpp>
 #include <cpu/cpu_lu.hpp>
+#include <copy.hpp>
 
 namespace opencl
 {
diff --git a/src/backend/opencl/cpu/cpu_lapack_helper.hpp b/src/backend/opencl/cpu/cpu_lapack_helper.hpp
deleted file mode 100644
index 174022e..0000000
--- a/src/backend/opencl/cpu/cpu_lapack_helper.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************
- * Copyright (c) 2014, ArrayFire
- * All rights reserved.
- *
- * This file is distributed under 3-clause BSD license.
- * The complete license agreement can be obtained at:
- * http://arrayfire.com/licenses/BSD-3-Clause
- ********************************************************/
-
-#ifndef AFCPU_LAPACK
-#define AFCPU_LAPACK
-
-#include <types.hpp>
-
-#define lapack_complex_float opencl::cfloat
-#define lapack_complex_double opencl::cdouble
-#define LAPACK_PREFIX LAPACKE_
-#define ORDER_TYPE int
-#define AF_LAPACK_COL_MAJOR LAPACK_COL_MAJOR
-#define LAPACK_NAME(fn) LAPACKE_##fn
-
-#ifdef __APPLE__
-#include <Accelerate/Accelerate.h>
-#include <lapacke.hpp>
-#undef AF_LAPACK_COL_MAJOR
-#define AF_LAPACK_COL_MAJOR 0
-#else
-#ifdef USE_MKL
-#include<mkl_lapacke.h>
-#else // NETLIB LAPACKE
-#include<lapacke.h>
-#endif
-#endif
-
-#endif
diff --git a/src/backend/opencl/cpu/cpu_lu.cpp b/src/backend/opencl/cpu/cpu_lu.cpp
index f415cb3..293cb8a 100644
--- a/src/backend/opencl/cpu/cpu_lu.cpp
+++ b/src/backend/opencl/cpu/cpu_lu.cpp
@@ -7,15 +7,10 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
-#include <cpu/cpu_lapack_helper.hpp>
+#include <cpu/cpu_helper.hpp>
 #include <cpu/cpu_lu.hpp>
-#include <err_common.hpp>
-
-#include <af/dim4.hpp>
-#include <handle.hpp>
-#include <iostream>
-#include <cassert>
-
+#include <math.hpp>
+#include <copy.hpp>
 #include <range.hpp>
 
 namespace opencl
diff --git a/src/backend/opencl/cpu/cpu_qr.cpp b/src/backend/opencl/cpu/cpu_qr.cpp
index 080ebb6..24a915a 100644
--- a/src/backend/opencl/cpu/cpu_qr.cpp
+++ b/src/backend/opencl/cpu/cpu_qr.cpp
@@ -7,17 +7,10 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
-#include <cpu/cpu_lapack_helper.hpp>
+#include <cpu/cpu_helper.hpp>
 #include <cpu/cpu_qr.hpp>
-#include <err_common.hpp>
-#include <copy.hpp>
-
-#include <af/dim4.hpp>
-#include <handle.hpp>
-#include <iostream>
-#include <cassert>
-
 #include <cpu/cpu_triangle.hpp>
+#include <copy.hpp>
 
 namespace opencl
 {
diff --git a/src/backend/opencl/cpu/cpu_solve.cpp b/src/backend/opencl/cpu/cpu_solve.cpp
index 824bce2..522454a 100644
--- a/src/backend/opencl/cpu/cpu_solve.cpp
+++ b/src/backend/opencl/cpu/cpu_solve.cpp
@@ -7,14 +7,11 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
-#include <cpu/cpu_lapack_helper.hpp>
+#include <cpu/cpu_helper.hpp>
 #include <cpu/cpu_solve.hpp>
-#include <err_common.hpp>
 #include <copy.hpp>
 #include <math.hpp>
 
-#include <af/dim4.hpp>
-
 namespace opencl
 {
 namespace cpu
diff --git a/src/backend/opencl/cpu/cpu_svd.cpp b/src/backend/opencl/cpu/cpu_svd.cpp
index 85b9ee8..66e4c0a 100644
--- a/src/backend/opencl/cpu/cpu_svd.cpp
+++ b/src/backend/opencl/cpu/cpu_svd.cpp
@@ -7,10 +7,8 @@
  * http://arrayfire.com/licenses/BSD-3-Clause
  ********************************************************/
 
-#include <cpu/cpu_lapack_helper.hpp>
+#include <cpu/cpu_helper.hpp>
 #include <cpu/cpu_svd.hpp>
-#include <err_common.hpp>
-
 #include <copy.hpp>
 
 namespace opencl
@@ -82,6 +80,10 @@ namespace cpu
         svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', 'A', M, N, iPtr, in.strides()[1],
                           sPtr, uPtr, u.strides()[1], vPtr, vt.strides()[1], &superb[0]);
 #endif
+        unmapPtr(s.get() , sPtr);
+        unmapPtr(u.get() , uPtr);
+        unmapPtr(vt.get(), vPtr);
+        unmapPtr(in.get(), iPtr);
     }
 
     template <typename T, typename Tr>
diff --git a/src/backend/opencl/cpu/cpu_triangle.hpp b/src/backend/opencl/cpu/cpu_triangle.hpp
index 5e40f92..f953d58 100644
--- a/src/backend/opencl/cpu/cpu_triangle.hpp
+++ b/src/backend/opencl/cpu/cpu_triangle.hpp
@@ -9,6 +9,9 @@
 
 #ifndef CPU_LAPACK_TRIANGLE
 #define CPU_LAPACK_TRIANGLE
+
+#include <math.hpp>
+
 namespace opencl
 {
 namespace cpu

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