Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface10::opencl_device Class Reference

#include <flow_graph_opencl_node.h>

Collaboration diagram for tbb::flow::interface10::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 109 of file flow_graph_opencl_node.h.

Member Typedef Documentation

◆ device_id_type

Member Enumeration Documentation

◆ anonymous enum

Constructor & Destructor Documentation

◆ opencl_device() [1/3]

tbb::flow::interface10::opencl_device::opencl_device ( )
inline

◆ opencl_device() [2/3]

tbb::flow::interface10::opencl_device::opencl_device ( cl_device_id  d_id)
inline

◆ opencl_device() [3/3]

tbb::flow::interface10::opencl_device::opencl_device ( cl_device_id  cl_d_id,
device_id_type  device_id 
)
inline

Member Function Documentation

◆ address_bits()

cl_uint tbb::flow::interface10::opencl_device::address_bits ( ) const
inline

Definition at line 216 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ available()

cl_bool tbb::flow::interface10::opencl_device::available ( ) const
inline

Definition at line 190 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ built_in_kernel_available()

bool tbb::flow::interface10::opencl_device::built_in_kernel_available ( const std::string &  k) const
inline

Definition at line 179 of file flow_graph_opencl_node.h.

179  {
180  const std::string semi = ";";
181  // Added semicolumns to force an exact match (to avoid a partial match, e.g. "add" is partly matched with "madd").
182  return (semi + built_in_kernels() + semi).find( semi + k + semi ) != std::string::npos;
183  }

References built_in_kernels().

Here is the call graph for this function:

◆ built_in_kernels()

std::string tbb::flow::interface10::opencl_device::built_in_kernels ( ) const
inline

Definition at line 184 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

Referenced by built_in_kernel_available().

Here is the caller graph for this function:

◆ command_queue()

cl_command_queue tbb::flow::interface10::opencl_device::command_queue ( ) const
inline

Definition at line 224 of file flow_graph_opencl_node.h.

224  {
225  return my_cl_command_queue;
226  }

References my_cl_command_queue.

◆ compiler_available()

cl_bool tbb::flow::interface10::opencl_device::compiler_available ( ) const
inline

Definition at line 193 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ device_id()

cl_device_id tbb::flow::interface10::opencl_device::device_id ( ) const
inline

Definition at line 220 of file flow_graph_opencl_node.h.

220  {
221  return my_cl_device_id;
222  }

References my_cl_device_id.

◆ extension_available()

bool tbb::flow::interface10::opencl_device::extension_available ( const std::string &  ext) const
inline

Definition at line 199 of file flow_graph_opencl_node.h.

199  {
200  const std::string space = " ";
201  // Added space to force an exact match (to avoid a partial match, e.g. "ext" is partly matched with "ext2").
202  return (space + extensions() + space).find( space + ext + space ) != std::string::npos;
203  }

References extensions().

Here is the call graph for this function:

◆ extensions()

std::string tbb::flow::interface10::opencl_device::extensions ( ) const
inline

Definition at line 204 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

Referenced by extension_available().

Here is the caller graph for this function:

◆ info()

template<typename T >
void tbb::flow::interface10::opencl_device::info ( cl_device_info  i,
T &  t 
) const
inline

Definition at line 140 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ linker_available()

cl_bool tbb::flow::interface10::opencl_device::linker_available ( ) const
inline

Definition at line 196 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ major_version()

int tbb::flow::interface10::opencl_device::major_version ( ) const
inline

Definition at line 147 of file flow_graph_opencl_node.h.

147  {
148  int major;
149  std::sscanf( version().c_str(), "OpenCL %d", &major );
150  return major;
151  }

References version().

Referenced by out_of_order_exec_mode_on_device_present(), and out_of_order_exec_mode_on_host_present().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max_work_group_size()

size_t tbb::flow::interface10::opencl_device::max_work_group_size ( ) const
inline

Definition at line 176 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ max_work_item_sizes()

std::array<size_t, 3> tbb::flow::interface10::opencl_device::max_work_item_sizes ( ) const
inline

Definition at line 173 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ minor_version()

int tbb::flow::interface10::opencl_device::minor_version ( ) const
inline

Definition at line 152 of file flow_graph_opencl_node.h.

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

References version().

Here is the call graph for this function:

◆ name()

std::string tbb::flow::interface10::opencl_device::name ( ) const
inline

Definition at line 187 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ out_of_order_exec_mode_on_device_present()

bool tbb::flow::interface10::opencl_device::out_of_order_exec_mode_on_device_present ( ) const
inline

Definition at line 165 of file flow_graph_opencl_node.h.

165  {
166 #if CL_VERSION_2_0
167  if ( major_version() >= 2 )
168  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;
169  else
170 #endif /* CL_VERSION_2_0 */
171  return false;
172  }

References major_version(), and my_cl_device_id.

Here is the call graph for this function:

◆ out_of_order_exec_mode_on_host_present()

bool tbb::flow::interface10::opencl_device::out_of_order_exec_mode_on_host_present ( ) const
inline

Definition at line 157 of file flow_graph_opencl_node.h.

157  {
158 #if CL_VERSION_2_0
159  if ( major_version() >= 2 )
160  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;
161  else
162 #endif /* CL_VERSION_2_0 */
163  return (device_info<cl_command_queue_properties>( my_cl_device_id, CL_DEVICE_QUEUE_PROPERTIES ) & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE) != 0;
164  }

References major_version(), and my_cl_device_id.

Here is the call graph for this function:

◆ platform_extensions()

std::string tbb::flow::interface10::opencl_device::platform_extensions ( ) const
inline

Definition at line 135 of file flow_graph_opencl_node.h.

135  {
136  return platform_info<std::string>( platform_id(), CL_PLATFORM_EXTENSIONS );
137  }

References platform_id().

Here is the call graph for this function:

◆ platform_id()

cl_platform_id tbb::flow::interface10::opencl_device::platform_id ( ) const
inline

Definition at line 232 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

Referenced by platform_extensions(), platform_name(), platform_profile(), platform_vendor(), and platform_version().

Here is the caller graph for this function:

◆ platform_name()

std::string tbb::flow::interface10::opencl_device::platform_name ( ) const
inline

Definition at line 129 of file flow_graph_opencl_node.h.

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

References platform_id().

Here is the call graph for this function:

◆ platform_profile()

std::string tbb::flow::interface10::opencl_device::platform_profile ( ) const
inline

Definition at line 123 of file flow_graph_opencl_node.h.

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

References platform_id().

Here is the call graph for this function:

◆ platform_vendor()

std::string tbb::flow::interface10::opencl_device::platform_vendor ( ) const
inline

Definition at line 132 of file flow_graph_opencl_node.h.

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

References platform_id().

Here is the call graph for this function:

◆ platform_version()

std::string tbb::flow::interface10::opencl_device::platform_version ( ) const
inline

Definition at line 126 of file flow_graph_opencl_node.h.

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

References platform_id().

Here is the call graph for this function:

◆ set_command_queue()

void tbb::flow::interface10::opencl_device::set_command_queue ( cl_command_queue  cmd_queue)
inline

Definition at line 228 of file flow_graph_opencl_node.h.

228  {
229  my_cl_command_queue = cmd_queue;
230  }

References my_cl_command_queue.

◆ type()

cl_device_type tbb::flow::interface10::opencl_device::type ( ) const
inline

Definition at line 208 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ vendor()

std::string tbb::flow::interface10::opencl_device::vendor ( ) const
inline

Definition at line 212 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

◆ version()

std::string tbb::flow::interface10::opencl_device::version ( ) const
inline

Definition at line 143 of file flow_graph_opencl_node.h.

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

References my_cl_device_id.

Referenced by major_version(), and minor_version().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ opencl_factory

template<typename DeviceFilter >
friend class opencl_factory
friend

Definition at line 245 of file flow_graph_opencl_node.h.

◆ opencl_memory

template<typename Factory >
friend class opencl_memory
friend

Definition at line 247 of file flow_graph_opencl_node.h.

◆ opencl_program

template<typename Factory >
friend class opencl_program
friend

Definition at line 249 of file flow_graph_opencl_node.h.

◆ operator==

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

Definition at line 242 of file flow_graph_opencl_node.h.

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

Member Data Documentation

◆ my_cl_command_queue

◆ my_cl_device_id

◆ my_device_id

device_id_type tbb::flow::interface10::opencl_device::my_device_id
private

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

Copyright © 2005-2019 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.