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

Method create_with_source_file

include/boost/compute/program.hpp:415–433  ·  view source on GitHub ↗

Creates a new program with \p file in \p context. \see_opencl_ref{clCreateProgramWithSource}

Source from the content-addressed store, hash-verified

413 ///
414 /// \see_opencl_ref{clCreateProgramWithSource}
415 static program create_with_source_file(const std::string &file,
416 const context &context)
417 {
418 // open file stream
419 std::ifstream stream(file.c_str());
420
421 if(stream.fail()){
422 BOOST_THROW_EXCEPTION(std::ios_base::failure("failed to create stream."));
423 }
424
425 // read source
426 std::string source(
427 (std::istreambuf_iterator<char>(stream)),
428 std::istreambuf_iterator<char>()
429 );
430
431 // create program
432 return create_with_source(source, context);
433 }
434
435 /// Creates a new program with \p binary of \p binary_size in
436 /// \p context.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected