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

Function setDeviceContext

src/backend/opencl/platform.cpp:587–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585}
586
587void setDeviceContext(cl_device_id dev, cl_context ctx) {
588 // FIXME: add OpenGL Interop for user provided contexts later
589 DeviceManager& devMngr = DeviceManager::getInstance();
590
591 common::lock_guard_t lock(devMngr.deviceMutex);
592
593 const int dCount = static_cast<int>(devMngr.mDevices.size());
594 for (int i = 0; i < dCount; ++i) {
595 if (devMngr.mDevices[i]->operator()() == dev &&
596 devMngr.mContexts[i]->operator()() == ctx) {
597 setActiveContext(i);
598 return;
599 }
600 }
601 AF_ERROR("No matching device found", AF_ERR_ARG);
602}
603
604void removeDeviceContext(cl_device_id dev, cl_context ctx) {
605 if (getDevice()() == dev && getContext()() == ctx) {

Callers 1

afcl_set_device_contextFunction · 0.70

Calls 2

setActiveContextFunction · 0.70
operator()Method · 0.45

Tested by

no test coverage detected