Creates a new program with \p file in \p context. \see_opencl_ref{clCreateProgramWithBinary}
| 474 | /// |
| 475 | /// \see_opencl_ref{clCreateProgramWithBinary} |
| 476 | static program create_with_binary_file(const std::string &file, |
| 477 | const context &context) |
| 478 | { |
| 479 | // open file stream |
| 480 | std::ifstream stream(file.c_str(), std::ios::in | std::ios::binary); |
| 481 | |
| 482 | // read binary |
| 483 | std::vector<unsigned char> binary( |
| 484 | (std::istreambuf_iterator<char>(stream)), |
| 485 | std::istreambuf_iterator<char>() |
| 486 | ); |
| 487 | |
| 488 | // create program |
| 489 | return create_with_binary(&binary[0], binary.size(), context); |
| 490 | } |
| 491 | |
| 492 | #if defined(CL_VERSION_1_2) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED) |
| 493 | /// Creates a new program with the built-in kernels listed in |