18#if AF_API_VERSION >= 39 
   67#if AF_API_VERSION >= 39 
   77#if AF_API_VERSION >= 39 
   95#if AF_API_VERSION >= 39 
  105#if AF_API_VERSION >= 39 
  120#if AF_API_VERSION >= 39 
  122  t the type of the current device
 
  127#if AF_API_VERSION >= 39 
  168 static inline cl_context getContext(
bool retain = 
false)
 
  184 static inline cl_command_queue getQueue(
bool retain = 
false)
 
  186     cl_command_queue queue;
 
  196 static inline cl_device_id getDeviceId()
 
  205#if AF_API_VERSION >= 39 
  211 static inline void setDeviceId(cl_device_id 
id)
 
  218#if AF_API_VERSION >= 39 
  233static inline void addDevice(cl_device_id dev, cl_context ctx, cl_command_queue que)
 
  240#if AF_API_VERSION >= 39 
  247static inline void setDevice(cl_device_id dev, cl_context ctx)
 
  254#if AF_API_VERSION >= 39 
  266static inline void deleteDevice(cl_device_id dev, cl_context ctx)
 
  274#if AF_API_VERSION >= 39 
  279#if AF_API_VERSION >= 39 
  283static inline deviceType getDeviceType()
 
  292#if AF_API_VERSION >= 39 
  296static inline platform getPlatform()
 
  318     const unsigned ndims = (unsigned)idims.
ndims();
 
  322     cl_int clerr = clGetMemObjectInfo(buf, CL_MEM_CONTEXT, 
sizeof(cl_context), &context, NULL);
 
  323     if (clerr != CL_SUCCESS) {
 
  324         throw af::exception(
"Failed to get context from cl_mem object \"buf\" ");
 
  327     if (context != getContext()) {
 
  328         throw(
af::exception(
"Context mismatch between input \"buf\" and arrayfire"));
 
  332     if (retain) clerr = clRetainMemObject(buf);
 
  337     if (err != 
AF_SUCCESS || clerr != CL_SUCCESS) {
 
  338         if (retain && clerr == CL_SUCCESS) clReleaseMemObject(buf);
 
  357                               cl_mem buf, 
af::dtype type, 
bool retain=
false)
 
  375                               cl_mem buf, 
af::dtype type, 
bool retain=
false)
 
  395                               cl_mem buf, 
af::dtype type, 
bool retain=
false)
 
  416                               cl_mem buf, 
af::dtype type, 
bool retain=
false)
 
 
A multi dimensional data container.
Generic object that represents size and shape.
dim_t ndims()
Returns the number of axis whose values are greater than one.
dim_t * get()
Returns the underlying pointer to the dim4 object.
An ArrayFire exception class.
@ AF_SUCCESS
The function returned successfully.
af_err af_device_array(af_array *arr, void *data, const unsigned ndims, const dim_t *const dims, const af_dtype type)
Create array from device memory.
af_err afcl_add_device_context(cl_device_id dev, cl_context ctx, cl_command_queue que)
Push user provided device control constructs into the ArrayFire device manager pool.
af_err afcl_get_queue(cl_command_queue *queue, const bool retain)
Get a handle to ArrayFire's OpenCL command queue.
af_err afcl_get_context(cl_context *ctx, const bool retain)
Get a handle to ArrayFire's OpenCL context.
af_err afcl_set_device_id(cl_device_id id)
Set ArrayFire's active device based on id of type cl_device_id.
af_err afcl_get_device_type(afcl_device_type *res)
Get the type of the current device.
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
af_err afcl_delete_device_context(cl_device_id dev, cl_context ctx)
Remove the user provided device control constructs from the ArrayFire device manager pool.
af_err afcl_set_device_context(cl_device_id dev, cl_context ctx)
Set active device using cl_context and cl_device_id.
af_err afcl_get_device_id(cl_device_id *id)
Get the device ID for ArrayFire's current active device.
af_err afcl_get_platform(afcl_platform *res)
Get the platform of the current device.
@ AF_ONEAPI_PLATFORM_APPLE
@ AF_ONEAPI_PLATFORM_UNKNOWN
@ AF_ONEAPI_PLATFORM_INTEL
@ AF_ONEAPI_PLATFORM_BEIGNET
@ AF_ONEAPI_PLATFORM_POCL
@ AF_ONEAPI_PLATFORM_NVIDIA
@ AFCL_DEVICE_TYPE_UNKNOWN