cuda和cudnn的安装没有什么特别的,
tensorflow和tensorRT按照官方的文档步骤装就可以。
这里主要有几个坑需要注意:
1、tf编译时候会有大量undeference 到cudnn和cublas的报错,导致编译失败,需要参照下面解释修改
I was able to work around this issue by modifying:
CROSSTOOL_nvcc.tpl
adding this under toolchain "local_linux" (I used my full pathnames.. but I put in $HOME for reference here)
linker_flag: "-Wl,-rpath=$HOME/.local/cuda/lib64"
and below that under %host_compiler_includes:
cxx_builtin_include_directory: "$HOME/.local/cuda/include"
2、pip安装tensorRT时会提示系统不支持,需要修改wheel的名称为tensorrt-3.0.4-cp27-none-linux_x86_64.whl。
3、bazel装TensorFlow有个很坑的地方,环境变量都是写死的,不能自动检测,如果要修改很麻烦,所以最好所有依赖都装在默认目录下。
4、tensorrt安装之后运行会提示确实`GLIBCXX_3.4.21' not found,安装libgcc5.2.0以上版本即可。
5.tensrrt安装后运行例子报错:
../../lib/libnvinfer.so: undefined reference to `cudnnC[email protected].7'
cudnn版本不对,要7.0.3
6.tensorrt转化后的模型,使用时报错找不到op
需要import tensorflow.contrib.tensorrt
7. thrift下多线程使用tensorrt模型会报cuda寻址错误,可以采用多进程的方式。
8.INT8的模型结果异常,还没找到解决方法。
Reference:
https://github.com/tensorflow/tensorflow/issues/16988
https://www.cnblogs.com/nice-forever/p/5371906.html
https://blog.csdn.net/u010987458/article/details/71702938