[arrayfire] 25/284: svd cpu backend is async now

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:15 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 ed6d26da36df33e1469194d8b3d05e628a9fc26c
Author: pradeep <pradeep at arrayfire.com>
Date:   Thu Nov 19 19:13:54 2015 -0500

    svd cpu backend is async now
---
 src/backend/cpu/svd.cpp | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/backend/cpu/svd.cpp b/src/backend/cpu/svd.cpp
index 461b901..33bfab7 100644
--- a/src/backend/cpu/svd.cpp
+++ b/src/backend/cpu/svd.cpp
@@ -10,12 +10,13 @@
 #include <Array.hpp>
 #include <svd.hpp>
 #include <err_common.hpp>
-
 #include <err_cpu.hpp>
 
 #if defined(WITH_CPU_LINEAR_ALGEBRA)
 #include <lapack_helper.hpp>
 #include <copy.hpp>
+#include <platform.hpp>
+#include <async_queue.hpp>
 
 namespace cpu
 {
@@ -67,18 +68,21 @@ namespace cpu
     template <typename T, typename Tr>
     void svdInPlace(Array<Tr> &s, Array<T> &u, Array<T> &vt, Array<T> &in)
     {
-        dim4 iDims = in.dims();
-        int M = iDims[0];
-        int N = iDims[1];
+        auto func = [=] (Array<Tr> s, Array<T> u, Array<T> vt, Array<T> in) {
+            dim4 iDims = in.dims();
+            int M = iDims[0];
+            int N = iDims[1];
 
 #if defined(USE_MKL) || defined(__APPLE__)
-        svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', M, N, in.get(), in.strides()[1],
-                          s.get(), u.get(), u.strides()[1], vt.get(), vt.strides()[1]);
+            svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', M, N, in.get(), in.strides()[1],
+                    s.get(), u.get(), u.strides()[1], vt.get(), vt.strides()[1]);
 #else
-        std::vector<Tr> superb(std::min(M, N));
-        svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', 'A', M, N, in.get(), in.strides()[1],
-                          s.get(), u.get(), u.strides()[1], vt.get(), vt.strides()[1], &superb[0]);
+            std::vector<Tr> superb(std::min(M, N));
+            svd_func<T, Tr>()(AF_LAPACK_COL_MAJOR, 'A', 'A', M, N, in.get(), in.strides()[1],
+                    s.get(), u.get(), u.strides()[1], vt.get(), vt.strides()[1], &superb[0]);
 #endif
+        };
+        getQueue().enqueue(func, s, u, vt, in);
     }
 
     template <typename T, typename Tr>

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