Jetson Xavier NX手动安装cuda和cudnn

获取CUDA和CUDNN

在刷机的时候,已经在host(用来刷机的主机)上面下载了相关的安装包,故采用离线拷贝安装,我是在Ubuntu18.04的Downloads/Nvdias/jetpack/jetpack_download中找到的。

准备CUDA和CUDNN包

1、在NX的home目录下新建一个文件夹
2、将host主机上的jetpack/jetpack_download四个文件拷贝到NX上面
Jetson Xavier NX手动安装cuda和cudnn_第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

安装cudnn

1、直接安装.deb文件即可

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

2、安装完成后,其实是安装到了默认安装路径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/

3、执行下面命令,重新生成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

安装完成

cuda测试安装

nvcc -V

bash: nvcc: command not found

添加环境变量,打开~/.bashrc,添加环境变量

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

Jetson Xavier NX手动安装cuda和cudnn_第2张图片

cudnn测试安装

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

没有反应

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

Jetson Xavier NX手动安装cuda和cudnn_第3张图片

参考文献

【1】https://blog.csdn.net/chen645096127/article/details/117964673?utm_medium=distribute.pc_relevant.none-task-blog-2defaultbaidujs_title~default-3&spm=1001.2101.3001.4242.2
【2】https://blog.csdn.net/weixin_45392081/article/details/106521526
【3】https://blog.csdn.net/weixin_45392081/article/details/106518227
【4】https://blog.csdn.net/weixin_46203807/article/details/119090835
【5】https://blog.csdn.net/ftimes/article/details/113620019

你可能感兴趣的:(linux,运维,服务器)