Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.6 KB

QA_1-1.md

File metadata and controls

48 lines (34 loc) · 1.6 KB

TensorRT安装过程问题集锦

1. cannot find -lcudnn

../Makefile.config:7: CUDA_INSTALL_DIR variable is not specified, using /usr/local/cuda by default, use CUDA_INSTALL_DIR=<cuda_directory> to change.
../Makefile.config:10: CUDNN_INSTALL_DIR variable is not specified, using $CUDA_INSTALL_DIR by default, use CUDNN_INSTALL_DIR=<cudnn_directory> to change.
Linking: ../../bin/sample_fasterRCNN_debug
/xxx/bin/ld: cannot find -lcudnn
collect2: error: ld returned 1 exit status
make: *** [../Makefile.config:177: ../../bin/sample_fasterRCNN_debug] Error 1

在编译TensorRT提供的samples时,遇到cannot find -lcudnn报错,是因为没有找到cudnn库。首先确认是否包含以下文件:

/usr/local/cuda/include/cudnn.h
/usr/local/cuda/lib64/libcudnn*

如果不存在上述文件,则是因为缺少相应的cudnn文件。可以按照以下方式安装cudnn:

1)下载cudnn包并解压

tar -xzvf cudnn-10.0-linux-x64-v7.6.3.30.tgz

2)检查cuda安装位置,对于大多数人来说默认是 /usr/local/cuda/ ,可以使用 which nvcc 进行检查

3)复制文件

cd /path/to/cudnn/cuda
$ sudo cp include/cudnn.h /usr/local/cuda/include
$ sudo cp lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

4)重新编译,添加CUDA_INSTALL_DIR参数

# cd /path/to/TensorRT-7.0.0.11/samples
CUDA_INSTALL_DIR=/usr/local/cuda/ make -j8

如果编译成功,则会在/path/to/TensorRT-7.0.0.11/bin文件夹下生成多个sample_*文件,选择执行即可。