MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / buildProgram

Function buildProgram

src/backend/opencl/compile_module.cpp:92–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 ");
91
92Program buildProgram(span<const string> kernelSources,
93 span<const string> compileOpts) {
94 Program retVal;
95 try {
96 auto device = getDevice();
97 Program::Sources sources;
98 sources.emplace_back(DEFAULT_MACROS_STR);
99 sources.emplace_back(KParam_hpp, KParam_hpp_len);
100 sources.insert(end(sources), begin(kernelSources), end(kernelSources));
101
102 retVal = Program(getContext(), sources);
103
104 ostringstream options;
105 for (auto &opt : compileOpts) { options << opt; }
106 options << getActiveDeviceBaseBuildFlags();
107 retVal.build({device}, (options.str()).c_str());
108 } catch (Error &err) {
109 if (err.err() == CL_BUILD_PROGRAM_FAILURE) {
110 THROW_BUILD_LOG_EXCEPTION(retVal);
111 }
112 throw;
113 }
114 return retVal;
115}
116
117string getProgramBuildLog(const Program &prog) {
118 string build_error("");

Callers 1

compileModuleFunction · 0.85

Calls 6

getDeviceFunction · 0.85
endFunction · 0.85
beginFunction · 0.85
ProgramClass · 0.85
buildMethod · 0.80
getContextFunction · 0.50

Tested by

no test coverage detected