tbb::flow::interface11::opencl_device Class Reference

`#include <flow_graph_opencl_node.h>`

Collaboration diagram for tbb::flow::interface11::opencl_device:

## Public Types

enum | : device_id_type { unknown = device_id_type( -2 ) , host = device_id_type( -1 ) }
typedef size_t | device_id_type

## Public Member Functions

| opencl_device ()
| opencl_device (cl_device_id d_id)
| opencl_device (cl_device_id cl_d_id, device_id_type device_id)
std::string | platform_profile () const
std::string | platform_version () const
std::string | platform_name () const
std::string | platform_vendor () const
std::string | platform_extensions () const
template<typename T >
void | info (cl_device_info i, T &t) const
std::string | version () const
int | major_version () const
int | minor_version () const
bool | out_of_order_exec_mode_on_host_present () const
bool | out_of_order_exec_mode_on_device_present () const
std::array< size_t, 3 > | max_work_item_sizes () const
size_t | max_work_group_size () const
bool | built_in_kernel_available (const std::string &k) const
std::string | built_in_kernels () const
std::string | name () const
cl_bool | available () const
cl_bool | compiler_available () const
cl_bool | linker_available () const
bool | extension_available (const std::string &ext) const
std::string | extensions () const
cl_device_type | type () const
std::string | vendor () const
cl_uint | address_bits () const
cl_device_id | device_id () const
cl_command_queue | command_queue () const
void | set_command_queue (cl_command_queue cmd_queue)
cl_platform_id | platform_id () const

## Private Attributes

device_id_type | my_device_id
cl_device_id | my_cl_device_id
cl_command_queue | my_cl_command_queue

## Friends

template<typename DeviceFilter >
class | opencl_factory
template<typename Factory >
class | opencl_memory
template<typename Factory >
class | opencl_program
bool | operator== (opencl_device d1, opencl_device d2)

## Detailed Description

Definition at line 119 of file flow_graph_opencl_node.h.

## Member Typedef Documentation

## device_id_type

typedef size_t tbb::flow::interface11::opencl_device::device_id_type

Definition at line 121 of file flow_graph_opencl_node.h.

## Member Enumeration Documentation

## anonymous enum

anonymous enum : device_id_type

Enumerator
unknown |
host |

Definition at line 122 of file flow_graph_opencl_node.h.

: device_id_type {
unknown = device_id_type( -2 ),
host = device_id_type( -1 )
};
tbb::flow::interface11::opencl_device::host
@ host
Definition: flow_graph_opencl_node.h:124
tbb::flow::interface11::opencl_device::unknown
@ unknown
Definition: flow_graph_opencl_node.h:123
tbb::flow::interface11::opencl_device::device_id_type
size_t device_id_type
Definition: flow_graph_opencl_node.h:121

## Constructor & Destructor Documentation

## opencl_device() [1/3]

tbb::flow::interface11::opencl_device::opencl_device | ( |  | ) |

inline

Definition at line 127 of file flow_graph_opencl_node.h.

: my_device_id( unknown ), my_cl_device_id( NULL ), my_cl_command_queue( NULL ) {}
tbb::flow::interface11::opencl_device::my_device_id
device_id_type my_device_id
Definition: flow_graph_opencl_node.h:248
tbb::flow::interface11::opencl_device::my_cl_device_id
cl_device_id my_cl_device_id
Definition: flow_graph_opencl_node.h:249
tbb::flow::interface11::opencl_device::my_cl_command_queue
cl_command_queue my_cl_command_queue
Definition: flow_graph_opencl_node.h:250

## opencl_device() [2/3]

tbb::flow::interface11::opencl_device::opencl_device | ( | cl_device_id | d_id | ) |

inline

Definition at line 129 of file flow_graph_opencl_node.h.

: my_device_id( unknown ), my_cl_device_id( d_id ), my_cl_command_queue( NULL ) {}

## opencl_device() [3/3]

tbb::flow::interface11::opencl_device::opencl_device | ( | cl_device_id | cl_d_id,
|  | device_id_type | device_id
| ) |  |

inline

Definition at line 131 of file flow_graph_opencl_node.h.

: my_device_id( device_id ), my_cl_device_id( cl_d_id ), my_cl_command_queue( NULL ) {}
tbb::flow::interface11::opencl_device::device_id
cl_device_id device_id() const
Definition: flow_graph_opencl_node.h:230

## Member Function Documentation

## address_bits()

cl_uint tbb::flow::interface11::opencl_device::address_bits | ( |  | ) | const

inline

Definition at line 226 of file flow_graph_opencl_node.h.

{
return device_info<cl_uint>( my_cl_device_id, CL_DEVICE_ADDRESS_BITS );
}

## available()

cl_bool tbb::flow::interface11::opencl_device::available | ( |  | ) | const

inline

Definition at line 200 of file flow_graph_opencl_node.h.

{
return device_info<cl_bool>( my_cl_device_id, CL_DEVICE_AVAILABLE );
}

## built_in_kernel_available()

bool tbb::flow::interface11::opencl_device::built_in_kernel_available | ( | const std::string & | k | ) | const

inline

Definition at line 189 of file flow_graph_opencl_node.h.

{
const std::string semi = ";";
// Added semicolumns to force an exact match (to avoid a partial match, e.g. "add" is partly matched with "madd").
return (semi + built_in_kernels() + semi).find( semi + k + semi ) != std::string::npos;
}
tbb::flow::interface11::opencl_device::built_in_kernels
std::string built_in_kernels() const
Definition: flow_graph_opencl_node.h:194

## built_in_kernels()

std::string tbb::flow::interface11::opencl_device::built_in_kernels | ( |  | ) | const

inline

Definition at line 194 of file flow_graph_opencl_node.h.

{
return device_info<std::string>( my_cl_device_id, CL_DEVICE_BUILT_IN_KERNELS );
}

## command_queue()

cl_command_queue tbb::flow::interface11::opencl_device::command_queue | ( |  | ) | const

inline

Definition at line 234 of file flow_graph_opencl_node.h.

{
return my_cl_command_queue;
}

## compiler_available()

cl_bool tbb::flow::interface11::opencl_device::compiler_available | ( |  | ) | const

inline

Definition at line 203 of file flow_graph_opencl_node.h.

{
return device_info<cl_bool>( my_cl_device_id, CL_DEVICE_COMPILER_AVAILABLE );
}

## device_id()

cl_device_id tbb::flow::interface11::opencl_device::device_id | ( |  | ) | const

inline

Definition at line 230 of file flow_graph_opencl_node.h.

{
return my_cl_device_id;
}

## extension_available()

bool tbb::flow::interface11::opencl_device::extension_available | ( | const std::string & | ext | ) | const

inline

Definition at line 209 of file flow_graph_opencl_node.h.

{
const std::string space = " ";
// Added space to force an exact match (to avoid a partial match, e.g. "ext" is partly matched with "ext2").
return (space + extensions() + space).find( space + ext + space ) != std::string::npos;
}
tbb::flow::interface11::opencl_device::extensions
std::string extensions() const
Definition: flow_graph_opencl_node.h:214

## extensions()

std::string tbb::flow::interface11::opencl_device::extensions | ( |  | ) | const

inline

Definition at line 214 of file flow_graph_opencl_node.h.

{
return device_info<std::string>( my_cl_device_id, CL_DEVICE_EXTENSIONS );
}

## info()

template<typename T >

void tbb::flow::interface11::opencl_device::info | ( | cl_device_info | i,
|  | T & | t
| ) |  | const

inline

Definition at line 150 of file flow_graph_opencl_node.h.

{
t = device_info<T>( my_cl_device_id, i );
}

## linker_available()

cl_bool tbb::flow::interface11::opencl_device::linker_available | ( |  | ) | const

inline

Definition at line 206 of file flow_graph_opencl_node.h.

{
return device_info<cl_bool>( my_cl_device_id, CL_DEVICE_LINKER_AVAILABLE );
}

## major_version()

int tbb::flow::interface11::opencl_device::major_version | ( |  | ) | const

inline

Definition at line 157 of file flow_graph_opencl_node.h.

{
int major;
std::sscanf( version().c_str(), "OpenCL %d", &major );
return major;
}
tbb::flow::interface11::opencl_device::version
std::string version() const
Definition: flow_graph_opencl_node.h:153

## max_work_group_size()

size_t tbb::flow::interface11::opencl_device::max_work_group_size | ( |  | ) | const

inline

Definition at line 186 of file flow_graph_opencl_node.h.

{
return device_info<size_t>( my_cl_device_id, CL_DEVICE_MAX_WORK_GROUP_SIZE );
}

## max_work_item_sizes()

std::array<size_t, 3> tbb::flow::interface11::opencl_device::max_work_item_sizes | ( |  | ) | const

inline

Definition at line 183 of file flow_graph_opencl_node.h.

{
return device_info<std::array<size_t, 3>>( my_cl_device_id, CL_DEVICE_MAX_WORK_ITEM_SIZES );
}

## minor_version()

int tbb::flow::interface11::opencl_device::minor_version | ( |  | ) | const

inline

Definition at line 162 of file flow_graph_opencl_node.h.

{
int major, minor;
std::sscanf( version().c_str(), "OpenCL %d.%d", &major, &minor );
return minor;
}

## name()

std::string tbb::flow::interface11::opencl_device::name | ( |  | ) | const

inline

Definition at line 197 of file flow_graph_opencl_node.h.

{
return device_info<std::string>( my_cl_device_id, CL_DEVICE_NAME );
}

## out_of_order_exec_mode_on_device_present()

bool tbb::flow::interface11::opencl_device::out_of_order_exec_mode_on_device_present | ( |  | ) | const

inline

Definition at line 175 of file flow_graph_opencl_node.h.

{
#if CL_VERSION_2_0
if ( major_version() >= 2 )
return (device_info<cl_command_queue_properties>( my_cl_device_id, CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES ) & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) != 0;
else
#endif /* CL_VERSION_2_0 */
return false;
}
tbb::flow::interface11::opencl_device::major_version
int major_version() const
Definition: flow_graph_opencl_node.h:157

## out_of_order_exec_mode_on_host_present()

bool tbb::flow::interface11::opencl_device::out_of_order_exec_mode_on_host_present | ( |  | ) | const

inline

Definition at line 167 of file flow_graph_opencl_node.h.

{
#if CL_VERSION_2_0
if ( major_version() >= 2 )
return (device_info<cl_command_queue_properties>( my_cl_device_id, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES ) & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) != 0;
else
#endif /* CL_VERSION_2_0 */
return (device_info<cl_command_queue_properties>( my_cl_device_id, CL_DEVICE_QUEUE_PROPERTIES ) & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) != 0;
}

## platform_extensions()

std::string tbb::flow::interface11::opencl_device::platform_extensions | ( |  | ) | const

inline

Definition at line 145 of file flow_graph_opencl_node.h.

{
return platform_info<std::string>( platform_id(), CL_PLATFORM_EXTENSIONS );
}
tbb::flow::interface11::opencl_device::platform_id
cl_platform_id platform_id() const
Definition: flow_graph_opencl_node.h:242

## platform_id()

cl_platform_id tbb::flow::interface11::opencl_device::platform_id | ( |  | ) | const

inline

Definition at line 242 of file flow_graph_opencl_node.h.

{
return device_info<cl_platform_id>( my_cl_device_id, CL_DEVICE_PLATFORM );
}

## platform_name()

std::string tbb::flow::interface11::opencl_device::platform_name | ( |  | ) | const

inline

Definition at line 139 of file flow_graph_opencl_node.h.

{
return platform_info<std::string>( platform_id(), CL_PLATFORM_NAME );
}

## platform_profile()

std::string tbb::flow::interface11::opencl_device::platform_profile | ( |  | ) | const

inline

Definition at line 133 of file flow_graph_opencl_node.h.

{
return platform_info<std::string>( platform_id(), CL_PLATFORM_PROFILE );
}

## platform_vendor()

std::string tbb::flow::interface11::opencl_device::platform_vendor | ( |  | ) | const

inline

Definition at line 142 of file flow_graph_opencl_node.h.

{
return platform_info<std::string>( platform_id(), CL_PLATFORM_VENDOR );
}

## platform_version()

std::string tbb::flow::interface11::opencl_device::platform_version | ( |  | ) | const

inline

Definition at line 136 of file flow_graph_opencl_node.h.

{
return platform_info<std::string>( platform_id(), CL_PLATFORM_VERSION );
}

## set_command_queue()

void tbb::flow::interface11::opencl_device::set_command_queue | ( | cl_command_queue | cmd_queue | ) |

inline

Definition at line 238 of file flow_graph_opencl_node.h.

{
my_cl_command_queue = cmd_queue;
}

## type()

cl_device_type tbb::flow::interface11::opencl_device::type | ( |  | ) | const

inline

Definition at line 218 of file flow_graph_opencl_node.h.

{
return device_info<cl_device_type>( my_cl_device_id, CL_DEVICE_TYPE );
}

## vendor()

std::string tbb::flow::interface11::opencl_device::vendor | ( |  | ) | const

inline

Definition at line 222 of file flow_graph_opencl_node.h.

{
return device_info<std::string>( my_cl_device_id, CL_DEVICE_VENDOR );
}

## version()

std::string tbb::flow::interface11::opencl_device::version | ( |  | ) | const

inline

Definition at line 153 of file flow_graph_opencl_node.h.

{
// The version string format: OpenCL<space><major_version.minor_version><space><vendor-specific information>
return device_info<std::string>( my_cl_device_id, CL_DEVICE_VERSION );
}

## Friends And Related Function Documentation

## opencl_factory

template<typename DeviceFilter >

friend class opencl_factory

friend

Definition at line 255 of file flow_graph_opencl_node.h.

## opencl_memory

template<typename Factory >

friend class opencl_memory

friend

Definition at line 257 of file flow_graph_opencl_node.h.

## opencl_program

template<typename Factory >

friend class opencl_program

friend

Definition at line 259 of file flow_graph_opencl_node.h.

## operator==

bool operator== | ( | opencl_device | d1,
|  | opencl_device | d2
| ) |  |

friend

Definition at line 252 of file flow_graph_opencl_node.h.

{ return d1.my_cl_device_id == d2.my_cl_device_id; }

## Member Data Documentation

## my_cl_command_queue

cl_command_queue tbb::flow::interface11::opencl_device::my_cl_command_queue

private

Definition at line 250 of file flow_graph_opencl_node.h.

Referenced by tbb::flow::interface11::opencl_factory< DeviceFilter >::enqueue_map_buffer(), tbb::flow::interface11::opencl_factory< DeviceFilter >::enqueue_unmap_buffer(), tbb::flow::interface11::opencl_factory< DeviceFilter >::finalize(), and tbb::flow::interface11::opencl_factory< DeviceFilter >::send_kernel_impl().

## my_cl_device_id

cl_device_id tbb::flow::interface11::opencl_device::my_cl_device_id

private

Definition at line 249 of file flow_graph_opencl_node.h.

## my_device_id

device_id_type tbb::flow::interface11::opencl_device::my_device_id

private

Definition at line 248 of file flow_graph_opencl_node.h.

Referenced by tbb::flow::interface11::opencl_memory< Factory >::send().

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

- flow_graph_opencl_node.h

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.