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