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

Method checkGraphicsInteropCapability

src/backend/cuda/device_manager.cpp:367–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367bool DeviceManager::checkGraphicsInteropCapability() {
368 static std::once_flag checkInteropFlag;
369 thread_local bool capable = true;
370
371 std::call_once(checkInteropFlag, []() {
372 unsigned int pCudaEnabledDeviceCount = 0;
373 int pCudaGraphicsEnabledDeviceIds = 0;
374 cudaGetLastError(); // Reset Errors
375 cudaError_t err = cudaGLGetDevices(
376 &pCudaEnabledDeviceCount, &pCudaGraphicsEnabledDeviceIds,
377 getDeviceCount(), cudaGLDeviceListAll);
378 if (err == cudaErrorOperatingSystem) {
379 // OS Support Failure - Happens when devices are in TCC mode or
380 // do not have a display connected
381 capable = false;
382 }
383 cudaGetLastError(); // Reset Errors
384 });
385
386 return capable;
387}
388
389DeviceManager &DeviceManager::getInstance() {
390 static auto *my_instance = new DeviceManager();

Callers

nothing calls this directly

Calls 1

getDeviceCountFunction · 0.70

Tested by

no test coverage detected