File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,25 @@ def __del__(self):
454
454
backend .get ().af_release_array (self .arr )
455
455
456
456
def device_ptr (self ):
457
+ """
458
+ Return the device pointer exclusively held by the array.
459
+
460
+ Returns
461
+ ------
462
+ ptr : int
463
+ Contains location of the device pointer
464
+
465
+ Note
466
+ ----
467
+ - This can be used to integrate with custom C code and / or PyCUDA or PyOpenCL.
468
+ - No other arrays will share the same device pointer.
469
+ - If multiple arrays share the same memory a copy of the memory is done and a pointer to the new copy is returned.
470
+ """
471
+ ptr = ct .c_void_p (0 )
472
+ backend .get ().af_get_device_ptr (ct .pointer (ptr ), self .arr )
473
+ return ptr .value
474
+
475
+ def raw_ptr (self ):
457
476
"""
458
477
Return the device pointer held by the array.
459
478
@@ -466,9 +485,10 @@ def device_ptr(self):
466
485
----
467
486
- This can be used to integrate with custom C code and / or PyCUDA or PyOpenCL.
468
487
- No mem copy is peformed, this function returns the raw device pointer.
488
+ - This pointer may be shared with other arrays. Use this function with caution.
469
489
"""
470
490
ptr = ct .c_void_p (0 )
471
- backend .get ().af_get_device_ptr (ct .pointer (ptr ), self .arr )
491
+ backend .get ().af_get_raw_ptr (ct .pointer (ptr ), self .arr )
472
492
return ptr .value
473
493
474
494
def elements (self ):
You can’t perform that action at this time.
0 commit comments