Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface10::opencl_program< Factory >::opencl_program_builder Class Reference
Collaboration diagram for tbb::flow::interface10::opencl_program< Factory >::opencl_program_builder:

Public Types

typedef void(CL_CALLBACK * cl_callback_type) (cl_program, void *)
 

Public Member Functions

 opencl_program_builder (Factory &f, const std::string &name, cl_program program, cl_uint num_devices, cl_device_id *device_list, const char *options, cl_callback_type callback, void *user_data)
 

Detailed Description

template<typename Factory = opencl_info::default_opencl_factory>
class tbb::flow::interface10::opencl_program< Factory >::opencl_program_builder

Definition at line 1281 of file flow_graph_opencl_node.h.

Member Typedef Documentation

◆ cl_callback_type

template<typename Factory = opencl_info::default_opencl_factory>
typedef void(CL_CALLBACK * tbb::flow::interface10::opencl_program< Factory >::opencl_program_builder::cl_callback_type) (cl_program, void *)

Definition at line 1283 of file flow_graph_opencl_node.h.

Constructor & Destructor Documentation

◆ opencl_program_builder()

template<typename Factory = opencl_info::default_opencl_factory>
tbb::flow::interface10::opencl_program< Factory >::opencl_program_builder::opencl_program_builder ( Factory &  f,
const std::string &  name,
cl_program  program,
cl_uint  num_devices,
cl_device_id *  device_list,
const char *  options,
cl_callback_type  callback,
void user_data 
)
inline

Definition at line 1284 of file flow_graph_opencl_node.h.

1287  {
1288  cl_int err = clBuildProgram( program, num_devices, device_list, options,
1289  callback, user_data );
1290  if( err == CL_SUCCESS )
1291  return;
1292  std::string str = std::string( "Failed to build program: " ) + name;
1293  if ( err == CL_BUILD_PROGRAM_FAILURE ) {
1294  const opencl_device_list &devices = f.devices();
1295  for ( auto d = devices.begin(); d != devices.end(); ++d ) {
1296  std::cerr << "Build log for device: " << (*d).name() << std::endl;
1297  size_t log_size;
1298  cl_int query_err = clGetProgramBuildInfo(
1299  program, (*d).my_cl_device_id, CL_PROGRAM_BUILD_LOG, 0, NULL,
1300  &log_size );
1301  enforce_cl_retcode( query_err, "Failed to get build log size" );
1302  if( log_size ) {
1303  std::vector<char> output;
1304  output.resize( log_size );
1305  query_err = clGetProgramBuildInfo(
1306  program, (*d).my_cl_device_id, CL_PROGRAM_BUILD_LOG,
1307  output.size(), output.data(), NULL );
1308  enforce_cl_retcode( query_err, "Failed to get build output" );
1309  std::cerr << output.data() << std::endl;
1310  } else {
1311  std::cerr << "No build log available" << std::endl;
1312  }
1313  }
1314  }
1315  enforce_cl_retcode( err, str );
1316  }
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d
void enforce_cl_retcode(cl_int err, std::string msg)
void const char const char int ITT_FORMAT __itt_group_sync x void const char * name

References tbb::flow::interface10::opencl_device_list::begin(), d, tbb::flow::interface10::opencl_device_list::end(), tbb::flow::interface10::enforce_cl_retcode(), and name.

Here is the call graph for this function:

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.