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

Method load_program_binary

include/boost/compute/program.hpp:601–622  ·  view source on GitHub ↗

Tries to read program binaries from file cache.

Source from the content-addressed store, hash-verified

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
625private:

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