A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Namespaces | Macros | Typedefs | Enumerations | Functions
opencl.h File Reference
`#include <CL/cl.h>`
`#include <af/defines.h>`
`#include <af/array.h>`
`#include <af/dim4.hpp>`
`#include <af/exception.h>`
`#include <af/device.h>`
`#include <stdio.h>`

Go to the source code of this file.

## Namespaces
namespace | afcl

## Macros
#define | CL_TARGET_OPENCL_VERSION 120

## Typedefs
typedef afcl_device_type | deviceType
typedef afcl_platform | platform

## Enumerations
enum | afcl_device_type { AFCL_DEVICE_TYPE_CPU = CL_DEVICE_TYPE_CPU , AFCL_DEVICE_TYPE_GPU = CL_DEVICE_TYPE_GPU , AFCL_DEVICE_TYPE_ACC = CL_DEVICE_TYPE_ACCELERATOR , AFCL_DEVICE_TYPE_UNKNOWN = -1 }
enum | afcl_platform { AFCL_PLATFORM_AMD = 0 , AFCL_PLATFORM_APPLE = 1 , AFCL_PLATFORM_INTEL = 2 , AFCL_PLATFORM_NVIDIA = 3 , AFCL_PLATFORM_BEIGNET = 4 , AFCL_PLATFORM_POCL = 5 , AFCL_PLATFORM_UNKNOWN = -1 }

## Functions
static cl_context | getContext (bool retain=false)
| Get a handle to ArrayFire's OpenCL context.
static cl_command_queue | getQueue (bool retain=false)
| Get a handle to ArrayFire's OpenCL command queue.
static cl_device_id | getDeviceId ()
| Get the device ID for ArrayFire's current active device.
static void | setDeviceId (cl_device_id id)
| Set ArrayFire's active device based on `id` of type cl_device_id.
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 void | setDevice (cl_device_id dev, cl_context ctx)
| Set active device using cl_context and cl_device_id.
static void | deleteDevice (cl_device_id dev, cl_context ctx)
| Remove the user provided device control constructs from the ArrayFire device manager pool.
static deviceType | getDeviceType ()
| Get the type of the current device.
static platform | getPlatform ()
| Get a vendor enumeration for the current platform.
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.
static af::array | array (dim_t dim0, cl_mem buf, af::dtype type, bool retain=false)
| Create an af::array object from an OpenCL cl_mem buffer.
static af::array | array (dim_t dim0, dim_t dim1, cl_mem buf, af::dtype type, bool retain=false)
| Create an af::array object from an OpenCL cl_mem buffer.
static af::array | array (dim_t dim0, dim_t dim1, dim_t dim2, cl_mem buf, af::dtype type, bool retain=false)
| Create an af::array object from an OpenCL cl_mem buffer.
static af::array | array (dim_t dim0, dim_t dim1, dim_t dim2, dim_t dim3, 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_context (cl_context *ctx, const bool retain)
| Get a handle to ArrayFire's OpenCL context.
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_set_device_id (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.
AFAPI af_err | afcl_set_device_context (cl_device_id dev, cl_context ctx)
| Set active device using cl_context and cl_device_id.
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 af_err | afcl_get_device_type (afcl_device_type *res)
| Get the type of the current device.
AFAPI af_err | afcl_get_platform (afcl_platform *res)
| Get the platform of the current device.

## Macro Definition Documentation

## ◆ CL_TARGET_OPENCL_VERSION

#define CL_TARGET_OPENCL_VERSION 120

Definition at line 12 of file opencl.h.

## Enumeration Type Documentation

## ◆ afcl_device_type

enum afcl_device_type

Enumerator
AFCL_DEVICE_TYPE_CPU |
AFCL_DEVICE_TYPE_GPU |
AFCL_DEVICE_TYPE_ACC |
AFCL_DEVICE_TYPE_UNKNOWN |

Definition at line 27 of file opencl.h.

28{
29 AFCL_DEVICE_TYPE_CPU = CL_DEVICE_TYPE_CPU,
30 AFCL_DEVICE_TYPE_GPU = CL_DEVICE_TYPE_GPU,
31 AFCL_DEVICE_TYPE_ACC = CL_DEVICE_TYPE_ACCELERATOR,
32 AFCL_DEVICE_TYPE_UNKNOWN = -1
33} afcl_device_type;
afcl_device_type
afcl_device_type
Definition opencl.h:28
AFCL_DEVICE_TYPE_CPU
@ AFCL_DEVICE_TYPE_CPU
Definition opencl.h:29
AFCL_DEVICE_TYPE_ACC
@ AFCL_DEVICE_TYPE_ACC
Definition opencl.h:31
AFCL_DEVICE_TYPE_UNKNOWN
@ AFCL_DEVICE_TYPE_UNKNOWN
Definition opencl.h:32
AFCL_DEVICE_TYPE_GPU
@ AFCL_DEVICE_TYPE_GPU
Definition opencl.h:30

## ◆ afcl_platform

enum afcl_platform

Enumerator
AFCL_PLATFORM_AMD |
AFCL_PLATFORM_APPLE |
AFCL_PLATFORM_INTEL |
AFCL_PLATFORM_NVIDIA |
AFCL_PLATFORM_BEIGNET |
AFCL_PLATFORM_POCL |
AFCL_PLATFORM_UNKNOWN |

Definition at line 37 of file opencl.h.

38{
39 AFCL_PLATFORM_AMD = 0,
40 AFCL_PLATFORM_APPLE = 1,
41 AFCL_PLATFORM_INTEL = 2,
42 AFCL_PLATFORM_NVIDIA = 3,
43 AFCL_PLATFORM_BEIGNET = 4,
44 AFCL_PLATFORM_POCL = 5,
45 AFCL_PLATFORM_UNKNOWN = -1
46} afcl_platform;
afcl_platform
afcl_platform
Definition opencl.h:38
AFCL_PLATFORM_POCL
@ AFCL_PLATFORM_POCL
Definition opencl.h:44
AFCL_PLATFORM_BEIGNET
@ AFCL_PLATFORM_BEIGNET
Definition opencl.h:43
AFCL_PLATFORM_INTEL
@ AFCL_PLATFORM_INTEL
Definition opencl.h:41
AFCL_PLATFORM_NVIDIA
@ AFCL_PLATFORM_NVIDIA
Definition opencl.h:42
AFCL_PLATFORM_APPLE
@ AFCL_PLATFORM_APPLE
Definition opencl.h:40
AFCL_PLATFORM_UNKNOWN
@ AFCL_PLATFORM_UNKNOWN
Definition opencl.h:45
AFCL_PLATFORM_AMD
@ AFCL_PLATFORM_AMD
Definition opencl.h:39