Tries to read program binaries from file cache.
| 726 | |
| 727 | // Tries to read program binaries from file cache. |
| 728 | static boost::optional<program> load_program_binary( |
| 729 | const std::string &hash, const context &ctx |
| 730 | ) |
| 731 | { |
| 732 | std::string fname = detail::program_binary_path(hash) + "kernel"; |
| 733 | std::ifstream bfile(fname.c_str(), std::ios::binary); |
| 734 | if (!bfile) return boost::optional<program>(); |
| 735 | |
| 736 | size_t binary_size; |
| 737 | std::vector<unsigned char> binary; |
| 738 | |
| 739 | bfile.read((char*)&binary_size, sizeof(size_t)); |
| 740 | |
| 741 | binary.resize(binary_size); |
| 742 | bfile.read((char*)binary.data(), binary_size); |
| 743 | |
| 744 | return boost::optional<program>( |
| 745 | program::create_with_binary( |
| 746 | binary.data(), binary_size, ctx |
| 747 | ) |
| 748 | ); |
| 749 | } |
| 750 | #endif // BOOST_COMPUTE_USE_OFFLINE_CACHE |
| 751 | |
| 752 | static std::string read_source_file(const std::string &file) |
nothing calls this directly
no test coverage detected