opencl.h File Reference

(2020-10-27 00:11:00 -0400, (build d99887ae))

#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

 afcl
 

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. More...
 
static cl_command_queue getQueue (bool retain=false)
 Get a handle to ArrayFire's OpenCL command queue. More...
 
static cl_device_id getDeviceId ()
 Get the device ID for ArrayFire's current active device. More...
 
static void setDeviceId (cl_device_id id)
 Set ArrayFire's active device based on id of type cl_device_id. More...
 
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. More...
 
static void setDevice (cl_device_id dev, cl_context ctx)
 Set active device using cl_context and cl_device_id. More...
 
static void deleteDevice (cl_device_id dev, cl_context ctx)
 Remove the user provided device control constructs from the ArrayFire device manager pool. More...
 
static deviceType getDeviceType ()
 Get the type of the current device. More...
 
static platform getPlatform ()
 Get a vendor enumeration for the current platform. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
AFAPI af_err afcl_get_context (cl_context *ctx, const bool retain)
 Get a handle to ArrayFire's OpenCL context. More...
 
AFAPI af_err afcl_get_queue (cl_command_queue *queue, const bool retain)
 Get a handle to ArrayFire's OpenCL command queue. More...
 
AFAPI af_err afcl_get_device_id (cl_device_id *id)
 Get the device ID for ArrayFire's current active device. More...
 
AFAPI af_err afcl_set_device_id (cl_device_id id)
 Set ArrayFire's active device based on id of type cl_device_id. More...
 
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. More...
 
AFAPI af_err afcl_set_device_context (cl_device_id dev, cl_context ctx)
 Set active device using cl_context and cl_device_id. More...
 
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. More...
 
AFAPI af_err afcl_get_device_type (afcl_device_type *res)
 Get the type of the current device. More...
 
AFAPI af_err afcl_get_platform (afcl_platform *res)
 Get the platform of the current device. More...
 

Enumeration Type Documentation

◆ afcl_device_type

Enumerator
AFCL_DEVICE_TYPE_CPU 
AFCL_DEVICE_TYPE_GPU 
AFCL_DEVICE_TYPE_ACC 
AFCL_DEVICE_TYPE_UNKNOWN 

Definition at line 24 of file opencl.h.

25 {
26  AFCL_DEVICE_TYPE_CPU = CL_DEVICE_TYPE_CPU,
27  AFCL_DEVICE_TYPE_GPU = CL_DEVICE_TYPE_GPU,
28  AFCL_DEVICE_TYPE_ACC = CL_DEVICE_TYPE_ACCELERATOR,
afcl_device_type
Definition: opencl.h:24

◆ 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 34 of file opencl.h.