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 137 #endif //if 0 comment 168 static inline cl_context
getContext(
bool retain =
false)
184 static inline cl_command_queue
getQueue(
bool retain =
false)
186 cl_command_queue queue;
205 #if AF_API_VERSION >= 39 218 #if AF_API_VERSION >= 39 233 static inline void addDevice(cl_device_id dev, cl_context ctx, cl_command_queue que)
240 #if AF_API_VERSION >= 39 247 static inline void setDevice(cl_device_id dev, cl_context ctx)
254 #if AF_API_VERSION >= 39 266 static inline void deleteDevice(cl_device_id dev, cl_context ctx)
274 #if AF_API_VERSION >= 39 279 #if AF_API_VERSION >= 39 292 #if AF_API_VERSION >= 39 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\" ");
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)
424 #endif //#IF 0 tmp comment An ArrayFire exception class.
AFAPI af_err afcl_set_device_context(cl_device_id dev, cl_context ctx)
Set active device using cl_context and cl_device_id.
The function returned successfully.
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_device_id(cl_device_id *id)
Get the device ID for ArrayFire's current active device.
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 platform getPlatform()
Get a vendor enumeration for the current platform.
afcl_device_type deviceType
static void deleteDevice(cl_device_id dev, cl_context ctx)
Remove the user provided device control constructs from the ArrayFire device manager pool...
A multi dimensional data container.
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.
AFAPI af_err afcl_get_platform(afcl_platform *res)
Get the platform of the current device.
AFAPI af_err afcl_get_context(cl_context *ctx, const bool retain)
Get a handle to ArrayFire's OpenCL context
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.
static deviceType getDeviceType()
Get the type of the current device.
AFAPI int getDeviceId(const array &in)
dim_t * get()
Returns the underlying pointer to the dim4 object.
static cl_context getContext(bool retain=false)
Get a handle to ArrayFire's OpenCL context
dim_t ndims()
Returns the number of axis whose values are greater than one.
static void setDeviceId(cl_device_id id)
Set ArrayFire's active device based on id of type 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_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.
Generic object that represents size and shape.
static cl_command_queue getQueue(bool retain=false)
Get a handle to ArrayFire's OpenCL command queue
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...
AFAPI void setDevice(const int device)
Sets the current device.