Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::flow::interface11::opencl_program< Factory >::opencl_program_builder Class Reference
Collaboration diagram for tbb::flow::interface11::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::interface11::opencl_program< Factory >::opencl_program_builder

Definition at line 1280 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::interface11::opencl_program< Factory >::opencl_program_builder::cl_callback_type) (cl_program, void *)

Definition at line 1282 of file flow_graph_opencl_node.h.

Constructor & Destructor Documentation

◆ opencl_program_builder()

template<typename Factory = opencl_info::default_opencl_factory>
tbb::flow::interface11::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 1283 of file flow_graph_opencl_node.h.

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

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