How could I install Cudnn in docker container "l4t-tensorflow:r32.4.2-tf1.15-py3" inorder to build opencv 4.5 from source with dnn module

Host:
JetPack:4.4
Ubuntu: 18.04
CUDNN:8.0.0

I have pulled “l4t-tensorflow:r32.4.2-tf1.15-py3” docker container from NVIDIA L4T TensorFlow: l4t-tensorflow:r32.4.2-tf1.15-py3 using this command:

docker pull nvcr.io/nvidia/l4t-tensorflow:r32.4.2-tf1.15-py3

In this container TensorFlow 1.15 has installed. Opencv 4.4 has installed in this container But I’d like to have Opencv with dnn module that could be run on GPU. In order to build opencv from source with dnn_cuda module it’s necessary to CUDNN add to make options(via cudnn_include_dir). Since cudnn does not exist in container , how could i build opencv ?

It’s possible to build Opencv in host and transfer it’s libraries to docker?
Thanks.

Hi @barzanhayati, if you are starting the container with --runtime nvidia then it should already have cuDNN headers/libraries accessible from within the container.

If you are building your own container from Dockerfile, set your docker default runtime to nvidia and restart: https://github.com/dusty-nv/jetson-containers#docker-default-runtime

If indeed you can’t find cuDNN in the container, I would upgrade your version of JetPack and use the latest version of the container.

Thanks @dusty_nv .

I could check CUDA_VERSION in host by :

cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

but by running this command in docker container:

cat: /usr/include/cudnn_version.h: No such file or directory

and by checking NVidia Dependency libraries in :
/etc/nvidia-container-runtime/host-files-for-container.d/

and checking CUDNN.csv file: it has /usr/include/cudnn_version.h as lib . So I could say that CUDNN does not identified by docker?!

Also I run docker image with --runtime nvidia so CUDNN should be visible by docker:
docker run -it --runtime nvidia --network host MY_DOCKER_IMAGE_ID

cudnn.csv (5.0 KB)

relevant thread Jetson docker image opencv

Try replacing your cudnn.csv file with this one (or upgrading your JetPack version):

lib,  /usr/lib/aarch64-linux-gnu/libcudnn.so.8.0.0                                             
sym,  /usr/lib/aarch64-linux-gnu/libcudnn.so.8                                                                  
sym,  /usr/lib/aarch64-linux-gnu/libcudnn.so                                                              
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_infer.so.8.0.0                                             
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_infer.so.8                                                                            
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_infer.so                                                                        
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_train.so.8.0.0                                             
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_train.so.8                                                                            
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_train.so                                                                        
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_infer.so.8.0.0                                             
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_infer.so.8                                                                            
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_infer.so                                                                        
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_infer.so.8.0.0                                             
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_infer.so.8                                                                            
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_infer.so                                                                        
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_train.so.8.0.0                                             
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_train.so.8                                                                            
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_train.so                                                                        
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_train.so.8.0.0                                             
sym,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_train.so.8                                                                            
sym,  /usr/include/cudnn_adv_infer.h
sym,  /usr/include/cudnn_adv_train.h
sym,  /usr/include/cudnn_backend.h
sym,  /usr/include/cudnn_cnn_infer.h
sym,  /usr/include/cudnn_cnn_train.h
sym,  /usr/include/cudnn.h
sym,  /usr/include/cudnn_ops_infer.h
sym,  /usr/include/cudnn_ops_train.h
sym,  /usr/include/cudnn_version.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_adv_infer_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_adv_train_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_backend_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_cnn_infer_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_cnn_train_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_ops_infer_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_ops_train_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_v8.h
lib,  /usr/include/aarch64-linux-gnu/cudnn_version_v8.h
sym,  /etc/alternatives/libcudnn
sym,  /etc/alternatives/libcudnn_adv_infer_so
sym,  /etc/alternatives/libcudnn_adv_infer_stlib
sym,  /etc/alternatives/libcudnn_adv_train_so
sym,  /etc/alternatives/libcudnn_adv_train_stlib
sym,  /etc/alternatives/libcudnn_cnn_infer_so
sym,  /etc/alternatives/libcudnn_cnn_infer_stlib
sym,  /etc/alternatives/libcudnn_cnn_train_so
sym,  /etc/alternatives/libcudnn_cnn_train_stlib
sym,  /etc/alternatives/libcudnn_ops_infer_so
sym,  /etc/alternatives/libcudnn_ops_infer_stlib
sym,  /etc/alternatives/libcudnn_ops_train_so
sym,  /etc/alternatives/libcudnn_ops_train_stlib
sym,  /etc/alternatives/libcudnn_so
sym,  /etc/alternatives/libcudnn_stlib
sym,  /etc/alternatives/cudnn_adv_infer_h  
sym,  /etc/alternatives/cudnn_backend_h    
sym,  /etc/alternatives/cudnn_cnn_train_h  
sym,  /etc/alternatives/cudnn_ops_train_h
sym,  /etc/alternatives/cudnn_adv_train_h  
sym,  /etc/alternatives/cudnn_cnn_infer_h  
sym,  /etc/alternatives/cudnn_ops_infer_h  
sym,  /etc/alternatives/cudnn_version_h
lib,  /usr/include/aarch64-linux-gnu/cudnn_v8.h
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_infer.so.8
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_infer_static_v8.a
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_train.so.8
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_adv_train_static_v8.a
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_infer.so.8
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_infer_static_v8.a
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_train.so.8
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_cnn_train_static_v8.a
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_infer.so.8
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_infer_static_v8.a
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_train.so.8
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_ops_train_static_v8.a
lib,  /usr/lib/aarch64-linux-gnu/libcudnn.so.8
lib,  /usr/lib/aarch64-linux-gnu/libcudnn_static_v8.a