MCPcopy Create free account
hub / github.com/boostorg/compute / load_program_binary

Method load_program_binary

include/boost/compute/program.hpp:728–749  ·  view source on GitHub ↗

Tries to read program binaries from file cache.

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 4

program_binary_pathFunction · 0.85
dataMethod · 0.80
readMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected