[arrayfire] 30/248: Change condition structure in approx

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:53:51 UTC 2015


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

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

commit 15c3cb09e1c11e3f9e3275566fd21c22ce28dfc5
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Mon Aug 31 17:14:25 2015 -0400

    Change condition structure in approx
---
 src/backend/cpu/approx.cpp           |  8 ++------
 src/backend/cuda/kernel/approx.hpp   |  8 ++------
 src/backend/opencl/kernel/approx.hpp | 12 ++++--------
 3 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/src/backend/cpu/approx.cpp b/src/backend/cpu/approx.cpp
index f9e8fdd..0686b2f 100644
--- a/src/backend/cpu/approx.cpp
+++ b/src/backend/cpu/approx.cpp
@@ -116,9 +116,7 @@ namespace cpu
             const float offGrid)
     {
         approx1_op<Ty, Tp, method> op;
-        bool pBatch = false;
-        if(!(pdims[1] == 1 && pdims[2] == 1 && pdims[3] == 1))
-            pBatch = true;
+        bool pBatch = !(pdims[1] == 1 && pdims[2] == 1 && pdims[3] == 1);
 
         for(dim_t w = 0; w < odims[3]; w++) {
             for(dim_t z = 0; z < odims[2]; z++) {
@@ -287,9 +285,7 @@ namespace cpu
             const float offGrid)
     {
         approx2_op<Ty, Tp, method> op;
-        bool pBatch = false;
-        if(!(pdims[2] == 1 && pdims[3] == 1))
-            pBatch = true;
+        bool pBatch = !(pdims[2] == 1 && pdims[3] == 1);
 
         for(dim_t w = 0; w < odims[3]; w++) {
             for(dim_t z = 0; z < odims[2]; z++) {
diff --git a/src/backend/cuda/kernel/approx.hpp b/src/backend/cuda/kernel/approx.hpp
index 89d5733..b1437ba 100644
--- a/src/backend/cuda/kernel/approx.hpp
+++ b/src/backend/cuda/kernel/approx.hpp
@@ -239,9 +239,7 @@ namespace cuda
             dim_t blocksPerMat = divup(out.dims[0], threads.x);
             dim3 blocks(blocksPerMat * out.dims[1], out.dims[2] * out.dims[3]);
 
-            bool pBatch = false;
-            if(!(pos.dims[1] == 1 && pos.dims[2] == 1 && pos.dims[3] == 1))
-                pBatch = true;
+            bool pBatch = !(pos.dims[1] == 1 && pos.dims[2] == 1 && pos.dims[3] == 1);
 
             CUDA_LAUNCH((approx1_kernel<Ty, Tp, method>), blocks, threads,
                          out, in, pos, offGrid, blocksPerMat, pBatch);
@@ -257,9 +255,7 @@ namespace cuda
             dim_t blocksPerMatY = divup(out.dims[1], threads.y);
             dim3 blocks(blocksPerMatX * out.dims[2], blocksPerMatY * out.dims[3]);
 
-            bool pBatch = false;
-            if(!(pos.dims[2] == 1 && pos.dims[3] == 1))
-                pBatch = true;
+            bool pBatch = !(pos.dims[2] == 1 && pos.dims[3] == 1);
 
             CUDA_LAUNCH((approx2_kernel<Ty, Tp, method>), blocks, threads,
                          out, in, pos, qos, offGrid, blocksPerMatX, blocksPerMatY, pBatch);
diff --git a/src/backend/opencl/kernel/approx.hpp b/src/backend/opencl/kernel/approx.hpp
index c12f8b2..d7b5997 100644
--- a/src/backend/opencl/kernel/approx.hpp
+++ b/src/backend/opencl/kernel/approx.hpp
@@ -97,13 +97,11 @@ namespace opencl
                                1);
 
                 // Passing bools to opencl kernels is not allowed
-                int pBatch = 0;
-                if(!(pos.info.dims[1] == 1 && pos.info.dims[2] == 1 && pos.info.dims[3] == 1))
-                    pBatch = 1;
+                bool pBatch = !(pos.info.dims[1] == 1 && pos.info.dims[2] == 1 && pos.info.dims[3] == 1);
 
                 approx1Op(EnqueueArgs(getQueue(), global, local),
                           *out.data, out.info, *in.data, in.info,
-                          *pos.data, pos.info, offGrid, blocksPerMat, pBatch);
+                          *pos.data, pos.info, offGrid, blocksPerMat, (int)pBatch);
 
                 CL_DEBUG_FINISH(getQueue());
             } catch (cl::Error err) {
@@ -168,16 +166,14 @@ namespace opencl
                                1);
 
                 // Passing bools to opencl kernels is not allowed
-                int pBatch = 0;
-                if(!(pos.info.dims[2] == 1 && pos.info.dims[3] == 1))
-                    pBatch = 1;
+                bool pBatch = !(pos.info.dims[2] == 1 && pos.info.dims[3] == 1);
 
                 approx2Op(EnqueueArgs(getQueue(), global, local),
                           *out.data, out.info,
                           *in.data, in.info,
                           *pos.data, pos.info,
                           *qos.data, qos.info,
-                          offGrid, blocksPerMatX, blocksPerMatY, pBatch);
+                          offGrid, blocksPerMatX, blocksPerMatY, (int)pBatch);
                 CL_DEBUG_FINISH(getQueue());
             } catch (cl::Error err) {
                 CL_TO_AF_ERROR(err);

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