OpenCV Cuda: No Kernel Image is Available

Code is:Here

I am trying to do basic GPU manipulation with the camera stream on a Jetson Xavier NX, whenever I try to run the linked code I get the following error:

terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.2.0) /home/hacksmith/opencv_contrib/modules/cudawarping/src/cuda/resize.cu:217: error: (-217:Gpu API call) no kernel image is available for execution on the device in function 'call_resize_linear_glob' Aborted

I am running Stock Jetpack, Opencv 4.2, Cuda 10.2, and CUDNN 7.6.5

I am unsure where to proceed from here, thanks for any suggestions!

Hi,

Usually, this indicates that your OpenCV doesn’t build with correct GPU architecture.
For XavierNX, you should build it with sm_72 support.

It’s recommended to fallback your cuDNN into v8.0.
And build the OpenCV from source with this script:
https://github.com/AastaNV/JEP/blob/master/script/install_opencv4.3.0_Jetson.sh

Thanks.

@AastaLLL

I ran build script and it appeared to work, but is is normal for all the files to build in their own module folders? Using a slightly modified script by JetsonHacks it all built in one folder. I am using cmake to build my application and it can’t seen to find where the files are. Is there something that I am missing? Thanks!

There is a comment for the make install at the end of the script

#sudo make install

Hi,

As foobar.warren mentioned, you can run the sudo make install after compiling.
I comment this since some user may want to have multiple OpenCV version on their environment.

Thanks.

Thanks guys, I just skimmed the script and just missed that.

Hi,
After sudo make install, I tried to run python and found that python2 import cv2 works, but python3 didn’t work.

nvidia@jetsonnx:~/Projects$ python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import cv2
Traceback (most recent call last):
File “”, line 1, in
File “/home/nvidia/Projects/opencv/opencv-4.3.0/release/python_loader/cv2/init.py”, line 96, in
bootstrap()
File “/home/nvidia/Projects/opencv/opencv-4.3.0/release/python_loader/cv2/init.py”, line 62, in bootstrap
], True)
File “/home/nvidia/Projects/opencv/opencv-4.3.0/release/python_loader/cv2/init.py”, line 56, in load_first_config
raise ImportError(‘OpenCV loader: missing configuration file: {}. Check OpenCV installation.’.format(fnames))
ImportError: OpenCV loader: missing configuration file: [‘config-3.6.py’, ‘config-3.py’]. Check OpenCV installation.

system@jetson:~$ python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import cv2
print(cv2.getBuildInformation())

General configuration for OpenCV 4.3.0 =====================================
Version control: unknown

Extra modules:
Location (extra): /home/system/workspace/opencv/opencv_contrib-4.3.0/modules
Version control (extra): unknown

Platform:
Timestamp: 2020-06-30T05:17:56Z
Host: Linux 4.9.140-tegra aarch64
CMake: 3.10.2
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE

CPU/HW features:
Baseline: NEON FP16
required: NEON
disabled: VFPV3

C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: /usr/bin/c++ (ver 7.5.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 -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -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 -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -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=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -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-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,–gc-sections -Wl,–as-needed
Linker flags (Debug): -Wl,–gc-sections -Wl,–as-needed
ccache: NO
Precompiled headers: NO
Extra dependencies: m pthread cudart_static -lpthread dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu
3rdparty dependencies:

OpenCV modules:
To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: cnn_3dobj cvv hdf java js matlab ovis sfm ts viz
Applications: apps
Documentation: NO
Non-free algorithms: NO

GUI:
GTK+: YES (ver 2.24.32)
GThread : YES (ver 2.56.4)
GtkGlExt: NO
VTK support: NO

Media I/O:
ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
WEBP: build (ver encoder: 0x020f)
PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
JPEG 2000: build Jasper (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
DC1394: YES (2.2.5)
FFMPEG: YES
avcodec: YES (57.107.100)
avformat: YES (57.83.100)
avutil: YES (55.78.100)
swscale: YES (4.8.100)
avresample: NO
GStreamer: YES (1.14.5)
v4l/v4l2: YES (linux/videodev2.h)

Parallel framework: pthreads

Trace: YES (with Intel ITT)

Other third-party libraries:
Lapack: NO
Eigen: YES (ver 3.3.4)
Custom HAL: YES (carotene (ver 0.0.1))
Protobuf: build (3.5.1)

NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS)
NVIDIA GPU arch: 53 62 72
NVIDIA PTX archs:

cuDNN: YES (ver 8.0.0)

OpenCL: YES (no extra features)
Include path: /home/system/workspace/opencv/opencv-4.3.0/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.17)
Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17)
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
install path: lib/python2.7/dist-packages/cv2/python-2.7

Python 3:
Interpreter: /usr/bin/python3 (ver 3.6.9)
Libraries: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
numpy: /home/system/.local/lib/python3.6/site-packages/numpy/core/include (ver 1.19.0)
install path: lib/python3.6/dist-packages/cv2/python-3.6

Python (for build): /usr/bin/python2.7

Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO

Install to: /usr/local

1 Like