linux 配置cuda、cudnn环境
1、安装cuda
https://developer.nvidia.com/zh-cn/cuda-toolkit
以11.2为例,选择版本后,进行下载安装:
wget https://developer.download.nvidia.com/compute/cuda/11.5.0/local_installers/cuda_11.5.0_495.29.05_linux_sbsa.run sudo sh cuda_11.5.0_495.29.05_linux_sbsa.run
然后配置环境变量:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
不然使用cmake编译会报CMAKE_CUDA_COMPILER找不到的错误
nvcc -V
检查安装是否成功
2、下载cudnn
下载地址:https://developer.nvidia.com/rdp/cudnn-download
这里使用8.1.1
tar zxvf cudnn-11.2-linux-aarch64sbsa-v8.1.1.33.tgz
sudo cp cuda/include/* /usr/local/cudn/include/ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ sudo chmod a+r /usr/local/include/cudnn.h sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
完成后,通过如下命令查看安装情况,
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
3、下载nccl
https://developer.nvidia.com/nccl
例如下载nccl-<version>.txz
tar xvf nccl-<version>.txz
cp -r nccl-<version> /usr/local/
cp nccl-<version>/include/* /usr/local/include
或者
sudo rpm -i nccl-repo-<version>.rpm
sudo yum update
sudo yum install libnccl libnccl-devel libnccl-static
联系方式:emhhbmdfbGlhbmcxOTkxQDEyNi5jb20=