File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,14 @@ def get_device_ptr(a):
240
240
return ptr
241
241
242
242
def lock_device_ptr (a ):
243
+ """
244
+ This functions is deprecated. Please use lock_array instead.
245
+ """
246
+ import warnings
247
+ warnings .warn ("This function is deprecated. Use lock_array instead." , DeprecationWarning )
248
+ lock_array (a )
249
+
250
+ def lock_array (a ):
243
251
"""
244
252
Ask arrayfire to not perform garbage collection on raw data held by an array.
245
253
@@ -252,10 +260,17 @@ def lock_device_ptr(a):
252
260
-----
253
261
- The device pointer of `a` is not freed by memory manager until `unlock_device_ptr()` is called.
254
262
"""
255
- ptr = ct .c_void_p (0 )
256
- safe_call (backend .get ().af_lock_device_ptr (a .arr ))
263
+ safe_call (backend .get ().af_lock_array (a .arr ))
257
264
258
265
def unlock_device_ptr (a ):
266
+ """
267
+ This functions is deprecated. Please use unlock_array instead.
268
+ """
269
+ import warnings
270
+ warnings .warn ("This function is deprecated. Use unlock_array instead." , DeprecationWarning )
271
+ unlock_array (a )
272
+
273
+ def unlock_array (a ):
259
274
"""
260
275
Tell arrayfire to resume garbage collection on raw data held by an array.
261
276
@@ -265,7 +280,6 @@ def unlock_device_ptr(a):
265
280
- A multi dimensional arrayfire array.
266
281
267
282
"""
268
- ptr = ct .c_void_p (0 )
269
- safe_call (backend .get ().af_unlock_device_ptr (a .arr ))
283
+ safe_call (backend .get ().af_unlock_array (a .arr ))
270
284
271
285
from .array import Array
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def simple_device(verbose=False):
48
48
display_func (b )
49
49
50
50
c = af .randu (10 ,10 )
51
- af .lock_device_ptr (c )
52
- af .unlock_device_ptr (c )
51
+ af .lock_array (c )
52
+ af .unlock_array (c )
53
53
54
54
_util .tests ['device' ] = simple_device
You can’t perform that action at this time.
0 commit comments