| 365 | } |
| 366 | |
| 367 | bool 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 | |
| 389 | DeviceManager &DeviceManager::getInstance() { |
| 390 | static auto *my_instance = new DeviceManager(); |
nothing calls this directly
no test coverage detected