11#ifndef CL_TARGET_OPENCL_VERSION
12#define CL_TARGET_OPENCL_VERSION 120
14#if defined(__APPLE__) || defined(__MACOSX)
26#if AF_API_VERSION >= 33
36#if AF_API_VERSION >= 33
83#if AF_API_VERSION >= 32
93#if AF_API_VERSION >= 33
111#if AF_API_VERSION >= 33
121#if AF_API_VERSION >= 33
136#if AF_API_VERSION >= 33
143#if AF_API_VERSION >= 33
198 static inline cl_command_queue
getQueue(
bool retain =
false)
200 cl_command_queue queue;
219#if AF_API_VERSION >= 32
232#if AF_API_VERSION >= 33
247static inline void addDevice(cl_device_id dev, cl_context ctx, cl_command_queue que)
254#if AF_API_VERSION >= 33
261static inline void setDevice(cl_device_id dev, cl_context ctx)
268#if AF_API_VERSION >= 33
288#if AF_API_VERSION >= 33
293#if AF_API_VERSION >= 33
306#if AF_API_VERSION >= 33
332 const unsigned ndims = (unsigned)idims.
ndims();
336 cl_int clerr = clGetMemObjectInfo(buf, CL_MEM_CONTEXT,
sizeof(cl_context), &context, NULL);
337 if (clerr != CL_SUCCESS) {
338 throw af::exception(
"Failed to get context from cl_mem object \"buf\" ");
342 throw(
af::exception(
"Context mismatch between input \"buf\" and arrayfire"));
346 if (retain) clerr = clRetainMemObject(buf);
351 if (err !=
AF_SUCCESS || clerr != CL_SUCCESS) {
352 if (retain && clerr == CL_SUCCESS) clReleaseMemObject(buf);
371 cl_mem buf,
af::dtype type,
bool retain=
false)
389 cl_mem buf,
af::dtype type,
bool retain=
false)
409 cl_mem buf,
af::dtype type,
bool retain=
false)
430 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.
AFAPI 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.
static cl_context getContext(bool retain=false)
Get a handle to ArrayFire's OpenCL context.
AFAPI 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.
static void setDeviceId(cl_device_id id)
Set ArrayFire's active device based on id of type cl_device_id.
AFAPI 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.
static void setDevice(cl_device_id dev, cl_context ctx)
Set active device using cl_context and cl_device_id.
AFAPI af_err afcl_get_platform(afcl_platform *res)
Get the platform of the current device.
AFAPI af_err afcl_get_device_type(afcl_device_type *res)
Get the type of the current device.
AFAPI af_err afcl_set_device_id(cl_device_id id)
Set ArrayFire's active device based on id of type cl_device_id.
static platform getPlatform()
Get a vendor enumeration for the current platform.
static void deleteDevice(cl_device_id dev, cl_context ctx)
Remove the user provided device control constructs from the ArrayFire device manager pool.
static cl_command_queue getQueue(bool retain=false)
Get a handle to ArrayFire's OpenCL command queue.
static deviceType getDeviceType()
Get the type of the current device.
AFAPI af_err afcl_set_device_context(cl_device_id dev, cl_context ctx)
Set active device using cl_context and cl_device_id.
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.
AFAPI af_err afcl_get_queue(cl_command_queue *queue, const bool retain)
Get a handle to ArrayFire's OpenCL command queue.
AFAPI af_err afcl_get_context(cl_context *ctx, const bool retain)
Get a handle to ArrayFire's OpenCL context.
static cl_device_id getDeviceId()
Get the device ID for ArrayFire's current active device.
afcl_device_type deviceType
AFAPI af_err afcl_get_device_id(cl_device_id *id)
Get the device ID for ArrayFire's current active device.
static void addDevice(cl_device_id dev, cl_context ctx, cl_command_queue que)
Push user provided device control constructs into the ArrayFire device manager pool.
@ AFCL_DEVICE_TYPE_UNKNOWN