Tries to read program binaries from file cache.
| 599 | |
| 600 | // Tries to read program binaries from file cache. |
| 601 | static boost::optional<program> load_program_binary( |
| 602 | const std::string &hash, const context &ctx |
| 603 | ) |
| 604 | { |
| 605 | std::string fname = detail::program_binary_path(hash) + "kernel"; |
| 606 | std::ifstream bfile(fname.c_str(), std::ios::binary); |
| 607 | if (!bfile) return boost::optional<program>(); |
| 608 | |
| 609 | size_t binary_size; |
| 610 | std::vector<unsigned char> binary; |
| 611 | |
| 612 | bfile.read((char*)&binary_size, sizeof(size_t)); |
| 613 | |
| 614 | binary.resize(binary_size); |
| 615 | bfile.read((char*)binary.data(), binary_size); |
| 616 | |
| 617 | return boost::optional<program>( |
| 618 | program::create_with_binary( |
| 619 | binary.data(), binary_size, ctx |
| 620 | ) |
| 621 | ); |
| 622 | } |
| 623 | #endif // BOOST_COMPUTE_USE_OFFLINE_CACHE |
| 624 | |
| 625 | private: |
nothing calls this directly
no test coverage detected