Saves program binaries for future reuse.
| 585 | #ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE |
| 586 | // Saves program binaries for future reuse. |
| 587 | static void save_program_binary(const std::string &hash, const program &prog) |
| 588 | { |
| 589 | std::string fname = detail::program_binary_path(hash, true) + "kernel"; |
| 590 | std::ofstream bfile(fname.c_str(), std::ios::binary); |
| 591 | if (!bfile) return; |
| 592 | |
| 593 | std::vector<unsigned char> binary = prog.binary(); |
| 594 | |
| 595 | size_t binary_size = binary.size(); |
| 596 | bfile.write((char*)&binary_size, sizeof(size_t)); |
| 597 | bfile.write((char*)binary.data(), binary_size); |
| 598 | } |
| 599 | |
| 600 | // Tries to read program binaries from file cache. |
| 601 | static boost::optional<program> load_program_binary( |
nothing calls this directly
no test coverage detected