Device Class

A Device is a processing unit that can execute OpenCL kernels. It is mainly a GPU, but it can also be a CPU or a simulation of a device (e.g. pocl, oclgrind). It is a good practice to consider a device as a mini computer with its own memory with which you can communicate through the OpenCL API. This class holds a set of information allowing the identification of a specific hardware for future communication with it during execution.

The class has no processing functions; it is mainly used to store necessary information required to identify the hardware. The detection and the communication is managed by Backend class.

Users should not need to interact with the Device class extensively, except during the initialization of the library or when using multiple devices for computation.

class Device

Device class This class is used to manage devices.

Public Types

enum class Type

Device type.

Values:

enumerator CUDA
enumerator OPENCL

Public Functions

Device() = default

Construct a new Device object.

virtual ~Device() = default

Destroy the Device object.

virtual void=0 initialize ()

Initialize a device pointer.

virtual void=0 finalize ()

Release the device pointer.

virtual void=0 finish () const

Wait for command queue to finish.

virtual void=0 setWaitToFinish (bool flag)

Set flag for waiting for command queue to finish.

virtual bool=0 isInitialized () const

Check if device is initialized.

Returns:

bool

virtual std::string=0 getName (bool lowercase=false) const

Get device name.

Returns:

std::string

virtual std::string=0 getInfo () const

Get device info.

Returns:

std::string

virtual std::string=0 getInfoExtended () const

Get device with more info.

Returns:

std::string

virtual Device::Type=0 getType () const

Get device type.

Returns:

Device::Type

virtual std::string=0 getDeviceType () const

Get device type as string.

Returns:

std::string

virtual size_t=0 getDeviceIndex () const

Get device index in context.

virtual std::string=0 getPlatform () const

Get device platform.

Returns:

std::string

virtual bool=0 supportImage () const

check if device is compatible with cl_image

Returns:

bool

virtual size_t=0 getNbDevicesFromContext () const

Get shared context devices.

virtual size_t=0 getMaximumBufferSize () const

Get maximum buffer size.

Returns:

size_t

virtual size_t=0 getLocalMemorySize () const

Get local memory size.

Returns:

size_t

Friends

inline friend std::ostream &operator<<(std::ostream &out, const Device::Type &device_type)

operator << for Device::Type

inline friend std::ostream &operator<<(std::ostream &out, const Device::Pointer &device)

operator << for Device::Pointer