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

Method save_program_binary

include/boost/compute/program.hpp:587–598  ·  view source on GitHub ↗

Saves program binaries for future reuse.

Source from the content-addressed store, hash-verified

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(

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