MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / opencl_is_available

Function opencl_is_available

src/core/CL/OpenCL.cpp:236–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234}
235
236bool opencl_is_available()
237{
238 CLSymbols::get().load_default();
239
240 // Using static objects that rely on OpenCL in their constructor or
241 // destructor is implementation defined according to the OpenCL API
242 // Specification. These objects include CLScheduler.
243 //
244 // For compatibility with OpenCL runtimes that also use static objects to
245 // hold their state, we call a harmless OpenCL function (clGetPlatformIDs
246 // with invalid parameters must result in CL_INVALID_VALUE) to ensure the
247 // runtimes have a chance to initialize their static objects first. Thanks
248 // to C++11 rules about normal program completion (cf [basic.start]), this
249 // ensures their static objects are destroyed last, i.e. after the
250 // singleton CLScheduler is destroyed.
251 //
252 // When OpenCL is not available, this call results in CL_OUT_OF_RESOURCES,
253 // which is equally harmless.
254 (void)clGetPlatformIDs(0, nullptr, nullptr);
255
256 return CLSymbols::get().clBuildProgram_ptr != nullptr;
257}
258} // namespace arm_compute
259
260cl_int clEnqueueMarker(cl_command_queue command_queue, cl_event *event)

Callers 8

CLKernelLibraryMethod · 0.85
is_backend_supportedMethod · 0.85
sync_if_necessaryFunction · 0.85
mainFunction · 0.85
runMethod · 0.85
run_exampleFunction · 0.85
run_exampleFunction · 0.85

Calls 2

clGetPlatformIDsFunction · 0.85
load_defaultMethod · 0.80

Tested by

no test coverage detected