1. 程式人生 > 其它 >xavier nx 安裝cuda, opencv,tensorrt, 中文輸入法

xavier nx 安裝cuda, opencv,tensorrt, 中文輸入法

xavier 刷機成功後

1. 安裝cuda

sudo dpkg -i cuda-repo-l4t-10-2local-10.2.89_1.0-1_arm64.deb**

出現了下面這個錯
**The public CUDA GPG key does not appear to be installed.
To install the key, run this command:
sudo apt-key add /var/cuda-repo-10-2-local/7fa2af80.pub

sudo apt-key add /var/cuda-repo-10-2-local/7fa2af80.pub
sudo apt update
sudo apt install cuda-toolkit-10-2

成功解決

2. 安裝cudnn

sudo dpkg -i libcudnn8_8.0.0.180-1+cuda10.2_arm64.deb
sudo dpkg -i libcudnn8.0.0.180-1+cuda9.0_arm64.deb
sudo dpkg -i libcudnn8-doc_8.0.0.180-1+cuda10.2_arm64.deb

安裝完成後,其實是安裝到了預設安裝路徑usr/include和usr/lib下,因此,需要將其拷貝到cuda安裝路徑下

sudo cp /usr/include/cudnn.h /usr/local/cuda/include/
sudo cp /usr/lib/aarch64-linux-gnu/libcudnn* /usr/local/cuda/lib64/

執行下面命令,重新生成cudnn庫軟連線

cd /usr/local/cuda/lib64
sudo chmod +r libcudnn*

sudo rm -rf libcudnn.so libcudnn.so.8
sudo ln -s libcudnn.so8.0.0 libcudnn.so.8
sudo ln -s libcudnn.so.8 libcudnn.so

sudo ldconfig


sudo ldconfig的時候出錯:

/sbin/ldconfig.real: /usr/local/cuda-10.2/targets/aarch64 linux /lib /libcudnn_adv_infer.so.8 is not a symbolic link

注意:以上的錯誤可能有多條, 統一使用下面方法解決

sudo ln -sf /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_ops_train.so.8.0.0 /usr/local/cuda-10.2/targets/aarch64-linux/lib/libcudnn_ops_train.so.8

sudo ldconfig
source ~/.bashrc

安裝完成

測試nvcc

nvcc -V

出現bash: nvcc: command not found

新增環境變數:

vim ~/.bashrc

在結尾新增:

export LD_LIBRARY_PATH=/usr/local/cuda/lib export PATH=$PATH:/usr/local/cuda/bin

export PATH=$PATH:/usr/local/cuda/bin

然後:

source ~/.bashrc

測試cudnn

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
沒有反映:
cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
輸出:

#define CUDNN_MAJOR 8
#define CUDNN_MINOR 0
#define CUDNN_PATCHLEVEL 0
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

#endif /* CUDNN_VERSION_H */

表示成功

3. 安裝tensorrt

sudo dpkg -i tensorrt_7.1.3.0-1+cuda10.2_arm64.deb

出現錯誤: 找不到依賴

Reading database ... 227173 files and directories currently installed.) Preparing to unpack xxx.deb ... Unpacking xxx (1.0.0) over (1.0.0) ... dpkg: dependency problems prevent configuration of xxx: xxx depends on yyy; however: Package yyy is not installed.

修復:

sudo apt-get -f install

再次安裝

sudo dpkg -i tensorrt_7.1.3.0-1+cuda10.2_arm64.deb

成功