Memory manager related functions. More...

Functions

AFAPI void setMemStepSize (const size_t size)
 Set the resolution of memory chunks. More...
 
AFAPI size_t getMemStepSize ()
 Get the resolution of memory chunks. More...
 
AFAPI af_err af_device_mem_info (size_t *alloc_bytes, size_t *alloc_buffers, size_t *lock_bytes, size_t *lock_buffers)
 Get memory information from the memory manager. More...
 
AFAPI af_err af_print_mem_info (const char *msg, const int device_id)
 Prints buffer details from the ArrayFire Device Manager. More...
 
AFAPI af_err af_device_gc ()
 Call the garbage collection routine. More...
 
AFAPI af_err af_set_mem_step_size (const size_t step_bytes)
 Set the minimum memory chunk size. More...
 
AFAPI af_err af_get_mem_step_size (size_t *step_bytes)
 Get the minimum memory chunk size. More...
 
AFAPI af_err af_lock_device_ptr (const af_array arr)
 Lock the device buffer in the memory manager. More...
 
AFAPI af_err af_unlock_device_ptr (const af_array arr)
 Unlock device buffer in the memory manager. More...
 
AFAPI af_err af_lock_array (const af_array arr)
 Lock the device buffer in the memory manager. More...
 
AFAPI af_err af_unlock_array (const af_array arr)
 Unlock device buffer in the memory manager. More...
 
AFAPI af_err af_get_device_ptr (void **ptr, const af_array arr)
 Get the device pointer and lock the buffer in memory manager. More...
 
AFAPI void deviceMemInfo (size_t *alloc_bytes, size_t *alloc_buffers, size_t *lock_bytes, size_t *lock_buffers)
 Gets information about the memory manager. More...
 
AFAPI void printMemInfo (const char *msg=NULL, const int device_id=-1)
 Prints buffer details from the ArrayFire Device Manager. More...
 
AFAPI void deviceGC ()
 Call the garbage collection function in the memory manager. More...
 

Detailed Description

Memory manager related functions.

Memory manager related functions

Function Documentation

AFAPI af_err af_device_gc ( )

Call the garbage collection routine.

AFAPI af_err af_device_mem_info ( size_t *  alloc_bytes,
size_t *  alloc_buffers,
size_t *  lock_bytes,
size_t *  lock_buffers 
)

Get memory information from the memory manager.

AFAPI af_err af_get_device_ptr ( void **  ptr,
const af_array  arr 
)

Get the device pointer and lock the buffer in memory manager.

The device pointer ptr is notfreed by memory manager until af_unlock_device_ptr is called.

Note
For OpenCL backend *ptr should be cast to cl_mem.
AFAPI af_err af_get_mem_step_size ( size_t *  step_bytes)

Get the minimum memory chunk size.

AFAPI af_err af_lock_array ( const af_array  arr)

Lock the device buffer in the memory manager.

Locked buffers are not freed by memory manager until af_unlock_array is called.

AFAPI af_err af_lock_device_ptr ( const af_array  arr)

Lock the device buffer in the memory manager.

Locked buffers are not freed by memory manager until af_unlock_array is called.

AFAPI af_err af_print_mem_info ( const char *  msg,
const int  device_id 
)

Prints buffer details from the ArrayFire Device Manager.

Parameters
[in]msgA message to print before the table
[in]device_idprint the memory info of the specified device. -1 signifies active device.

return AF_SUCCESS if successful

AFAPI af_err af_set_mem_step_size ( const size_t  step_bytes)

Set the minimum memory chunk size.

AFAPI af_err af_unlock_array ( const af_array  arr)

Unlock device buffer in the memory manager.

This function will give back the control over the device pointer to the memory manager.

AFAPI af_err af_unlock_device_ptr ( const af_array  arr)

Unlock device buffer in the memory manager.

This function will give back the control over the device pointer to the memory manager.

AFAPI void af::deviceGC ( )

Call the garbage collection function in the memory manager.

AFAPI void af::deviceMemInfo ( size_t *  alloc_bytes,
size_t *  alloc_buffers,
size_t *  lock_bytes,
size_t *  lock_buffers 
)

Gets information about the memory manager.

Parameters
[out]alloc_bytesthe number of bytes allocated by the memory
[out]alloc_buffersthe number of buffers created by the memory
[out]lock_bytesThe number of bytes in use
[out]lock_buffersThe number of buffers in use
Note
This function performs a synchronization operation
AFAPI size_t af::getMemStepSize ( )

Get the resolution of memory chunks.

AFAPI void af::printMemInfo ( const char *  msg = NULL,
const int  device_id = -1 
)

Prints buffer details from the ArrayFire Device Manager.

Parameters
[in]msgA message to print before the table
[in]device_idprint the memory info of the specified device. -1 signifies active device.
Note
This function performs a synchronization operation
AFAPI void af::setMemStepSize ( const size_t  size)

Set the resolution of memory chunks.