OpenCL C++ Bindings: cl::Device Class Reference

OpenCL C++ Bindings

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
cl::Device Class Reference

Class interface for cl_device_id. More...

`#include <opencl.hpp>`

Inheritance diagram for cl::Device:

## Public Member Functions
| Device ()
| Default constructor - initializes to nullptr.
| Device (const cl_device_id &device, bool retainObject=false)
| Constructor from cl_device_id.
Device & | operator= (const cl_device_id &rhs)
| Assignment operator from cl_device_id.
template<typename T >
cl_int | getInfo (cl_device_info name, T *param) const
| Wrapper for clGetDeviceInfo().
template<cl_device_info name>
detail::param_traits< detail::cl_device_info, name >::param_type | getInfo (cl_int *err=nullptr) const
| Wrapper for clGetDeviceInfo() that returns by value.
cl_ulong | getHostTimer (cl_int *error=nullptr)
std::pair< cl_ulong, cl_ulong > | getDeviceAndHostTimer (cl_int *error=nullptr)
cl_int | createSubDevices (const cl_device_partition_property *properties, vector< Device > *devices)
| Wrapper for clCreateSubDevices().
Public Member Functions inherited from cl::detail::Wrapper< cl_device_id >
| Wrapper (const cl_type &obj, bool retainObject)
| Wrapper (const Wrapper< cl_type > &rhs)
| Wrapper (Wrapper< cl_type > &&rhs) noexcept
Wrapper< cl_type > & | operator= (const Wrapper< cl_type > &rhs)
Wrapper< cl_type > & | operator= (Wrapper< cl_type > &&rhs)
Wrapper< cl_type > & | operator= (const cl_type &rhs)
const cl_type & | operator() () const
cl_type & | operator() ()
cl_type | get () const

## Static Public Member Functions
static Device | getDefault (cl_int *errResult=nullptr)
| Returns the first device on the default context.
static Device | setDefault (const Device &default_device)

## Additional Inherited Members
Public Types inherited from cl::detail::Wrapper< cl_device_id >
typedef cl_device_id | cl_type
Protected Member Functions inherited from cl::detail::Wrapper< cl_device_id >
cl_int | retain () const
cl_int | release () const
Static Protected Member Functions inherited from cl::detail::Wrapper< cl_device_id >
static bool | isReferenceCountable (cl_device_id device)
Protected Attributes inherited from cl::detail::Wrapper< cl_device_id >
cl_type | object_
bool | referenceCountable_

## Detailed Description

Class interface for cl_device_id.

Note
  Copies of these objects are inexpensive, since they don't 'own' any underlying resources or data structures.

See also
  cl_device_id

Definition at line 2470 of file opencl.hpp.

## Constructor & Destructor Documentation

## ◆ Device() [1/2]

cl::Device::Device | ( |  | ) |
| inline

Default constructor - initializes to nullptr.

Definition at line 2507 of file opencl.hpp.

## ◆ Device() [2/2]

cl::Device::Device | ( | const cl_device_id & | device,
|  | bool | retainObject = false )
| inlineexplicit

Constructor from cl_device_id.

This simply copies the device ID value, which is an inexpensive operation.

Definition at line 2513 of file opencl.hpp.

## Member Function Documentation

## ◆ createSubDevices()

cl_int cl::Device::createSubDevices | ( | const cl_device_partition_property * | properties,
|  | vector< Device > * | devices )
| inline

Wrapper for clCreateSubDevices().

Definition at line 3054 of file opencl.hpp.

## ◆ getDefault()

static Device cl::Device::getDefault | ( | cl_int * | errResult = nullptr | ) |
| inlinestatic

Returns the first device on the default context.

See also
  Context::getDefault()

Definition at line 2520 of file opencl.hpp.

## ◆ getDeviceAndHostTimer()

std::pair< cl_ulong, cl_ulong > cl::Device::getDeviceAndHostTimer | ( | cl_int * | error = nullptr | ) |
| inline

Return a synchronized pair of host and device timestamps as seen by device. Use to correlate the clocks and get the host timer only using getHostTimer as a lower cost mechanism in between calls. The resolution of the host timer may be queried with the CL_PLATFORM_HOST_TIMER_RESOLUTION query. The resolution of the device timer may be queried with the CL_DEVICE_PROFILING_TIMER_RESOLUTION query.

Returns
  A pair of (device timer, host timer) timer values.

Definition at line 2610 of file opencl.hpp.

## ◆ getHostTimer()

cl_ulong cl::Device::getHostTimer | ( | cl_int * | error = nullptr | ) |
| inline

Return the current value of the host clock as seen by the device. The resolution of the device timer may be queried with the CL_DEVICE_PROFILING_TIMER_RESOLUTION query.

Returns
  The host timer value.

Definition at line 2586 of file opencl.hpp.

## ◆ getInfo() [1/2]

template<typename T >

cl_int cl::Device::getInfo | ( | cl_device_info | name,
|  | T * | param ) const
| inline

Wrapper for clGetDeviceInfo().

Definition at line 2558 of file opencl.hpp.

## ◆ getInfo() [2/2]

template<cl_device_info name>

detail::param_traits< detail::cl_device_info, name >::param_type cl::Device::getInfo | ( | cl_int * | err = nullptr | ) | const
| inline

Wrapper for clGetDeviceInfo() that returns by value.

Definition at line 2568 of file opencl.hpp.

## ◆ operator=()

Device & cl::Device::operator= | ( | const cl_device_id & | rhs | ) |
| inline

Assignment operator from cl_device_id.

This simply copies the device ID value, which is an inexpensive operation.

Definition at line 2549 of file opencl.hpp.

## ◆ setDefault()

static Device cl::Device::setDefault | ( | const Device & | default_device | ) |
| inlinestatic

Modify the default device to be used by subsequent operations. Will only set the default if no default was previously created.

Returns
  updated default device. Should be compared to the passed value to ensure that it was updated.

Definition at line 2538 of file opencl.hpp.

The documentation for this class was generated from the following file:

- opencl.hpp