Compiles the program with \p options. \opencl_version_warning{1,2} \see_opencl_ref{clCompileProgram}
| 288 | /// |
| 289 | /// \see_opencl_ref{clCompileProgram} |
| 290 | void compile(const std::string &options = std::string(), |
| 291 | const std::vector<std::pair<std::string, program> > &headers = |
| 292 | std::vector<std::pair<std::string, program> >()) |
| 293 | { |
| 294 | const char *options_string = 0; |
| 295 | |
| 296 | if(!options.empty()){ |
| 297 | options_string = options.c_str(); |
| 298 | } |
| 299 | |
| 300 | cl_int ret; |
| 301 | if (headers.empty()) |
| 302 | { |
| 303 | ret = clCompileProgram( |
| 304 | m_program, 0, 0, options_string, 0, 0, 0, 0, 0 |
| 305 | ); |
| 306 | } |
| 307 | else |
| 308 | { |
| 309 | std::vector<const char*> header_names(headers.size()); |
| 310 | std::vector<cl_program> header_programs(headers.size()); |
| 311 | for (size_t i = 0; i < headers.size(); ++i) |
| 312 | { |
| 313 | header_names[i] = headers[i].first.c_str(); |
| 314 | header_programs[i] = headers[i].second.m_program; |
| 315 | } |
| 316 | |
| 317 | ret = clCompileProgram( |
| 318 | m_program, |
| 319 | 0, |
| 320 | 0, |
| 321 | options_string, |
| 322 | static_cast<cl_uint>(headers.size()), |
| 323 | header_programs.data(), |
| 324 | header_names.data(), |
| 325 | 0, |
| 326 | 0 |
| 327 | ); |
| 328 | } |
| 329 | |
| 330 | if(ret != CL_SUCCESS){ |
| 331 | BOOST_THROW_EXCEPTION(opencl_error(ret)); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | /// Links the programs in \p programs with \p options in \p context. |
| 336 | /// |