Cuda not on primary Device (screen)

Hello everyone, I have been working for several years now with OPENCV and CUDA. (currently versions 4.8.0 and 12.2 respectively). Everything works fine in my different jobs but I’ve always been stuck on an element that I can’t find (I’m on Windows 11).

I have several monitors connected to the GPU which allows me to display my work. And I also have a monitor connected to the CPU.

GPU : NVIDIA GeForce RTX 3060 Ti
CPU : Intel(R) UHD Graphics 630

If I set through Windows that the monitor connected to the GPU has priority, everything works fine.
Whereas if I define my monitor connected to the CPU as a priority (under windows), I can no longer use my program.

I already tried to use “cv::cuda::setDevice” but without success.

Here is my configuration as needed.

thank you for your advice.

Zanti Jonathan

[**** CUDA initiallisation ****]
Device Name : \.\DISPLAY1
Device String : NVIDIA GeForce RTX 3060 Ti
Device Location x : -5120
Device Location y : 0
Device Size largeur : 2560
Device Size hauteur : 1440
Device PRIMARY : NO
Device Name : \.\DISPLAY2
Device String : NVIDIA GeForce RTX 3060 Ti
Device Location x : -2560
Device Location y : 0
Device Size largeur : 2560
Device Size hauteur : 1440
Device PRIMARY : NO
Device Name : \.\DISPLAY5
Device String : Intel(R) UHD Graphics 630
Device Location x : 0
Device Location y : 0
Device Size largeur : 2560
Device Size hauteur : 1440
Device PRIMARY : YES

cuda::getCudaEnabledDeviceCount() → CUDA : 1
Device ID : 0
Device Name : NVIDIA GeForce RTX 3060 Ti

General configuration for OpenCV 4.8.0-dev =====================================

  • Version control: unknown*

  • Extra modules:*

  • Location (extra): G:/Creation OPEN CV 4.8.0-dev/opencv_contrib-4.x/modules*

  • Version control (extra): unknown*

  • Platform:*

  • Timestamp: 2023-08-12T13:54:15Z*

  • Host: Windows 10.0.19045 AMD64*

  • CMake: 3.27.2*

  • CMake generator: Visual Studio 17 2022*

  • CMake build tool: C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe*

  • MSVC: 1936*

  • Configuration: Release*

  • CPU/HW features:*

  • Baseline: SSE SSE2 SSE3*

  •  requested:                 SSE3*
    
  • Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX*

  •  requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX*
    
  •  SSE4_1 (16 files):         + SSSE3 SSE4_1*
    
  •  SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2*
    
  •  FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX*
    
  •  AVX (3 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX*
    
  •  AVX2 (30 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2*
    
  •  AVX512_SKX (3 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX*
    
  • C/C++:*

  • Built as dynamic libs?: YES*

  • C++ standard: 11*

  • C++ Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe (ver 19.36.32534.0)*

  • C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /MD /O2 /Ob2 /DNDEBUG /Zi*

  • C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP /MDd /Zi /Ob0 /Od /RTC1*

  • C Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe*

  • C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MD /O2 /Ob2 /DNDEBUG /Zi*

  • C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MDd /Zi /Ob0 /Od /RTC1*

  • Linker flags (Release): /machine:x64 /INCREMENTAL:NO /debug*

  • Linker flags (Debug): /machine:x64 /debug /INCREMENTAL*

  • ccache: NO*

  • Precompiled headers: NO*

  • Extra dependencies: cudart_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/lib/x64*

  • 3rdparty dependencies:*

  • OpenCV modules:*

  • To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching tracking ts video videoio videostab world xfeatures2d ximgproc xobjdetect xphoto*

  • Disabled: dnn dnn_objdetect dnn_superres java_bindings_generator python_bindings_generator python_tests*

  • Disabled by dependency: mcc text wechat_qrcode*

  • Unavailable: alphamat cvv freetype hdf java julia matlab ovis python2 python3 sfm viz*

  • Applications: apps*

  • Documentation: NO*

  • Non-free algorithms: YES*

  • Windows RT support: NO*

  • GUI:*

  • Win32 UI: YES*

  • OpenGL support: YES (opengl32 glu32)*

  • Media I/O:*

  • ZLib: build (ver 1.2.13)*

  • JPEG: build-libjpeg-turbo (ver 2.1.3-62)*

  •  SIMD Support Request:      NO*
    
  • WEBP: build (ver encoder: 0x020f)*

  • PNG: build (ver 1.6.37)*

  • TIFF: build (ver 42 - 4.2.0)*

  • JPEG 2000: build (ver 2.5.0)*

  • OpenEXR: build (ver 2.3.0)*

  • HDR: YES*

  • SUNRASTER: YES*

  • PXM: YES*

  • PFM: YES*

  • Video I/O:*

  • FFMPEG: YES (find_package)*

  •  avcodec:                   YES (60.3.100)*
    
  •  avformat:                  YES (60.3.100)*
    
  •  avutil:                    YES (58.2.100)*
    
  •  swscale:                   YES (7.1.100)*
    
  •  avresample:                NO*
    
  •  avdevice:                  YES (60.1.100)*
    
  • DirectShow: YES*

  • Media Foundation: YES*

  •  DXVA:                      YES*
    
  • Intel Media SDK: YES (C:/Program Files (x86)/IntelSWTools/Intel(R) Media SDK 2021 R1/Software Development Kit/lib/x64/libmfx_vs2015.lib)*

  • Parallel framework: Concurrency*

  • Trace: YES (with Intel ITT)*

  • Other third-party libraries:*

  • Intel IPP: 2021.8 [2021.8.0]*

  •       at:                   G:/Creation OPEN CV 4.8.0-dev/opencv 4.8.0-dev/build/3rdparty/ippicv/ippicv_win/icv*
    
  • Intel IPP IW: sources (2021.8.0)*

  •          at:                G:/Creation OPEN CV 4.8.0-dev/opencv 4.8.0-dev/build/3rdparty/ippicv/ippicv_win/iw*
    
  • Custom HAL: NO*

  • Protobuf: build (3.19.1)*

  • Flatbuffers: builtin/3rdparty (23.5.9)*

  • NVIDIA CUDA: YES (ver 12.2, CUFFT CUBLAS FAST_MATH)*

  • NVIDIA GPU arch: 60 61 70 75 80 86 89 90*

  • NVIDIA PTX archs: 86*

  • OpenCL: YES (NVD3D11)*

  • Include path: G:/Creation OPEN CV 4.8.0-dev/opencv 4.8.0-dev/3rdparty/include/opencl/1.2*

  • Link libraries: Dynamic load*

  • Python (for build): NO*