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

Method save_program_binary

include/boost/compute/program.hpp:714–725  ·  view source on GitHub ↗

Saves program binaries for future reuse.

Source from the content-addressed store, hash-verified

712#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE
713 // Saves program binaries for future reuse.
714 static void save_program_binary(const std::string &hash, const program &prog)
715 {
716 std::string fname = detail::program_binary_path(hash, true) + "kernel";
717 std::ofstream bfile(fname.c_str(), std::ios::binary);
718 if (!bfile) return;
719
720 std::vector<unsigned char> binary = prog.binary();
721
722 size_t binary_size = binary.size();
723 bfile.write((char*)&binary_size, sizeof(size_t));
724 bfile.write((char*)binary.data(), binary_size);
725 }
726
727 // Tries to read program binaries from file cache.
728 static boost::optional<program> load_program_binary(

Callers

nothing calls this directly

Calls 5

program_binary_pathFunction · 0.85
binaryMethod · 0.80
dataMethod · 0.80
sizeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected