[arrayfire] 238/284: Fixes to getMappedPtr in OpenCL backend

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:37 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 58fc4c8ea4869b62ad75627f24a8a274d51ce26e
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Wed Jan 20 16:58:08 2016 -0500

    Fixes to getMappedPtr in OpenCL backend
    
    - Also changed CL_TO_AF_ERROR to display OpenCL error number
---
 src/backend/opencl/Array.hpp      | 6 ++++--
 src/backend/opencl/err_opencl.hpp | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/backend/opencl/Array.hpp b/src/backend/opencl/Array.hpp
index 2793d5e..4c8c05a 100644
--- a/src/backend/opencl/Array.hpp
+++ b/src/backend/opencl/Array.hpp
@@ -227,8 +227,10 @@ namespace opencl
             try {
                 if(ptr == nullptr) {
                     ptr = (T*)getQueue().enqueueMapBuffer(*const_cast<cl::Buffer*>(get()),
-                            true, CL_MAP_READ|CL_MAP_WRITE,
-                            getOffset(), getDataDims().elements() * sizeof(T));
+                                                          true, CL_MAP_READ|CL_MAP_WRITE,
+                                                          getOffset(),
+                                                          (getDataDims().elements() - getOffset())
+                                                          * sizeof(T));
                 }
             } catch(cl::Error err) {
                 CL_TO_AF_ERROR(err);
diff --git a/src/backend/opencl/err_opencl.hpp b/src/backend/opencl/err_opencl.hpp
index 15855f3..9552752 100644
--- a/src/backend/opencl/err_opencl.hpp
+++ b/src/backend/opencl/err_opencl.hpp
@@ -23,8 +23,8 @@
         char opencl_err_msg[1024];                              \
         snprintf(opencl_err_msg,                                \
                  sizeof(opencl_err_msg),                        \
-                 "OpenCL Error: %s when calling %s",            \
-                 getErrorMessage(ERR.err()).c_str(),            \
+                 "OpenCL Error (%d): %s when calling %s",       \
+                 ERR.err(), getErrorMessage(ERR.err()).c_str(), \
                  ERR.what());                                   \
         if (ERR.err() == CL_MEM_OBJECT_ALLOCATION_FAILURE) {    \
             AF_ERROR(opencl_err_msg, AF_ERR_NO_MEM);            \

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