[python-arrayfire] 211/250: Adding raw_ptr()

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:49 UTC 2016


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

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit 9d89307522893a97709b4e4ed1a26b4615cc1f15
Author: Filipe Maia <filipe.c.maia at gmail.com>
Date:   Sun Feb 14 00:10:22 2016 +0100

    Adding raw_ptr()
---
 arrayfire/array.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/arrayfire/array.py b/arrayfire/array.py
index 13a5fc8..350c2a1 100644
--- a/arrayfire/array.py
+++ b/arrayfire/array.py
@@ -455,6 +455,25 @@ class Array(BaseArray):
 
     def device_ptr(self):
         """
+        Return the device pointer exclusively held by the array.
+
+        Returns
+        ------
+        ptr : int
+              Contains location of the device pointer
+
+        Note
+        ----
+        - This can be used to integrate with custom C code and / or PyCUDA or PyOpenCL.
+        - No other arrays will share the same device pointer. 
+        - If multiple arrays share the same memory a copy of the memory is done and a pointer to the new copy is returned.
+        """
+        ptr = ct.c_void_p(0)
+        backend.get().af_get_device_ptr(ct.pointer(ptr), self.arr)
+        return ptr.value
+
+    def raw_ptr(self):
+        """
         Return the device pointer held by the array.
 
         Returns
@@ -466,9 +485,10 @@ class Array(BaseArray):
         ----
         - This can be used to integrate with custom C code and / or PyCUDA or PyOpenCL.
         - No mem copy is peformed, this function returns the raw device pointer.
+        - This pointer may be shared with other arrays. Use this function with caution.
         """
         ptr = ct.c_void_p(0)
-        backend.get().af_get_device_ptr(ct.pointer(ptr), self.arr)
+        backend.get().af_get_raw_ptr(ct.pointer(ptr), self.arr)
         return ptr.value
 
     def elements(self):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list