I'm trying to run an OpenCV sample code presented here: https://github.com/opencv/opencv/blob/master/samples/gpu/video_reader.cpp, but it gives following error at cv::cudacodec::createVideoReader(fname).
Error:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenC`enter code here`V(4.0.1) /opt/GPU_READ/opencv-4.0.1/modules/core/src/cuda/gpu_mat.cu:121: error: (-217:Gpu API call) all CUDA-capable devices are busy or unavailable in function 'allocate'
Aborted (core dumped)
Nvidia version : NVIDIA-SMI 390.96
This is a configuration of OpenCV:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_FFMPEG=ON -D WITH_CUDA=ON -D WITH_NVCUVID=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=ON -D BUILD_JAVA=OFF -D BUILD_SHARED_LIBS=ON -D BUILD_DOCS=OFF -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib-4.0.1/modules -D BUILD_EXAMPLES=ON -D WITH_VFW=ON -DWITH_GSTREAMER=ON -D WITH_OPENGL=ON -DWITH_MSMF=ON -D WITH_QT=ON ..
-- General configuration for OpenCV 4.0.1 =====================================
-- Version control: unknown
-- Extra modules:
-- Location (extra): /opt/GPU_READ/opencv_contrib-4.0.1/modules
Version control (extra): unknown
-- Platform: -- Timestamp: 2019-02-07T08:07:28Z -- Host: Linux 4.15.0-1032-aws x86_64 -- CMake: 3.5.1 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make
-- 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 (7 files): + SSSE3 SSE4_1 -- SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 -- FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX -- AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX -- AVX2 (13 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
C/C++: -- Built as dynamic libs?: YES -- C++ Compiler: /usr/bin/c++ (ver 5.4.0) C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/cc -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- ccache: NO -- Precompiled headers: YES -- Extra dependencies: dl m pthread rt /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so cudart nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda/lib64 -- 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 dnn dnn_objdetect dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto -- Disabled: world -- Disabled by dependency: - -- Unavailable: cnn_3dobj cvv hdf java js matlab ovis python2 python3 sfm -- Applications: tests perf_tests examples apps -- Documentation: NO
-- Non-free algorithms: NO
-- GUI: -- QT: YES (ver 4.8.7 EDITION = OpenSource) -- QT OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so)
-- GTK+: NO
OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so)
-- VTK support: YES (ver 8.2.0)
-- Media I/O: -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8) -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80) -- WEBP: build (ver encoder: 0x020e) -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54) -- TIFF: build (ver 42 - 4.0.9) -- JPEG 2000: build (ver 1.900.1) -- OpenEXR: build (ver 1.7.1) -- HDR: YES -- SUNRASTER: YES -- PXM: YES -- PFM: YES -- Video I/O: -- DC1394: NO -- FFMPEG: YES -- avcodec: YES (ver 58.35.100) -- avformat: YES (ver 58.20.100) -- avutil: YES (ver 56.22.100) -- swscale: YES (ver 5.3.100) -- avresample: NO -- GStreamer: -- base: YES (ver 1.15.1) -- video: YES (ver 1.15.1) -- app: YES (ver 1.15.1) -- riff: YES (ver 1.15.1) -- pbutils: YES (ver 1.15.1) -- v4l/v4l2: linux/videodev2.h -- Media Foundation: NO
-- DXVA: NO
-- Parallel framework: pthreads
-- Trace: YES (with Intel ITT)
-- Other third-party libraries: -- Intel IPP: 2019.0.0 Gold [2019.0.0] -- at: /opt/GPU_READ/opencv-4.0.1/build/3rdparty/ippicv/ippicv_lnx/icv -- Intel IPP IW: sources (2019.0.0) -- at: /opt/GPU_READ/opencv-4.0.1/build/3rdparty/ippicv/ippicv_lnx/iw -- Lapack: NO -- Eigen: NO -- Custom HAL: NO
-- Protobuf: build (3.5.1)
-- NVIDIA CUDA: YES (ver 9.1, CUFFT CUBLAS NVCUVID FAST_MATH) -- NVIDIA GPU arch: 30 35 37 50 52 60 61 70
-- NVIDIA PTX archs:
-- OpenCL: YES (no extra features) -- Include path: /opt/GPU_READ/opencv-4.0.1/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
-- Python (for build): /usr/bin/python2.7
-- Install to: /usr/local
Thanks
Minesh