[arrayfire] 268/284: BUGFIX: Fixing error in where for OpenCL backend

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:40 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 f674cdacf2bc1bc27f3f4649da2f80f35ec632d4
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Feb 2 18:42:55 2016 -0500

    BUGFIX: Fixing error in where for OpenCL backend
    
    - Was erroring out when no elemnts were found
    - Adding necessary test
---
 src/backend/opencl/kernel/where.hpp | 4 +++-
 test/where.cpp                      | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/backend/opencl/kernel/where.hpp b/src/backend/opencl/kernel/where.hpp
index 2cbf8c1..2b1308f 100644
--- a/src/backend/opencl/kernel/where.hpp
+++ b/src/backend/opencl/kernel/where.hpp
@@ -159,7 +159,9 @@ namespace kernel
                 out.info.strides[k] = total;
             }
 
-            get_out_idx<T>(out.data, otmp, rtmp, in, threads_x, groups_x, groups_y);
+            if (total > 0) {
+                get_out_idx<T>(out.data, otmp, rtmp, in, threads_x, groups_x, groups_y);
+            }
 
             bufferFree(rtmp.data);
             bufferFree(otmp.data);
diff --git a/test/where.cpp b/test/where.cpp
index 37208f2..08ed878 100644
--- a/test/where.cpp
+++ b/test/where.cpp
@@ -121,3 +121,10 @@ TYPED_TEST(Where, CPP)
                                                         << std::endl;
     }
 }
+
+TEST(Where, ISSUE_1259)
+{
+    af::array a = af::randu(10, 10, 10);
+    af::array indices = af::where(a > 2);
+    ASSERT_EQ(indices.elements(), 0);
+}

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