Install CUDA 11.1 and Pytorch 1.7 on CentOS 7
Oct 28, 2020 | 2334 views
How to Install CUDA 11.1 + Pytorch 1.7
=================================================
Install CUDA 11.1
=================================================
下载:https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda-repo-rhel7-11-1-local-11.1.0_455.23.05-1.x86_64.rpm
文档:https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
===== Step One:
Pre-installation Actions [https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#pre-installation-actions]
!!! Important:
You may need to update kernel if ` yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)` fails.
How to update kernel: `yum install kernel kernel-tools kernel-tools-libs` [https://www.golinuxcloud.com/how-to-update-kernel-rhel-centos-7-yum-linux/]
===== Step Two:
Package Manager Installation [https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#package-manager-installation]
===== Step Three:
Post-installation Actions [https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions]
===== Step Four: Install proper drivers for Graphic cards
[ https://www.server-world.info/en/note?os=CentOS_7&p=nvidia]
===== Step Five: Compile samples
# cuda-install-samples-11.1.sh [dir]
# make -k -j
检查命令
nvidia-smi
lspci | grep -i nvi
./bin/x86_64/linux/release/deviceQuery
当中可能遇到的错误情况处理:
1. centos7 yum 错误 This system is not registered with an entitlement server [https://blog.csdn.net/whatday/article/details/106106767]
2. cudaNvSci.h: fatal error: nvscibuf.h: No such file or directory [https://cloud.tencent.com/developer/article/1584631]
其他参考:
1. https://www.server-world.info/en/note?os=CentOS_7&p=cuda&f=4 (samples的测试)
2. https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#abstract (Official installation guide)
=================================================
Install Pytorch 1.7
=================================================
https://pytorch.org/get-started/locally/
Recommend using conda to install Pytorch, refer to above link:
conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch
For pip, run this Command: pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Test code after successful installation from [https://varhowto.com/install-pytorch-cuda-10-2/]
How to install CUDA 10.2 + Pytorch 1.6 on CentOS 7
=================================================
Install CUDA 10.2
=================================================
Download:https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=CentOS&target_version=7&target_type=rpmnetwork
Document:https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html
===== Step One:
Pre-installation Actions [https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#pre-installation-actions]
!!! Important:
You may need to update kernel if ` yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)` fails.
How to update kernel: `yum install kernel kernel-tools kernel-tools-libs` [https://www.golinuxcloud.com/how-to-update-kernel-rhel-centos-7-yum-linux/]
===== Step Two:
Package Manager Installation [https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#package-manager-installation]
===== Step Three:
Post-installation Actions [https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#post-installation-actions]
===== Step Four: Install proper drivers for Graphic cards
[ https://www.server-world.info/en/note?os=CentOS_7&p=nvidia]
===== Step Five: Compile samples
# cuda-install-samples-10.2.sh [directory]
# make -k -j
当中可能遇到的错误情况处理:
1. centos7 yum 错误 This system is not registered with an entitlement server [https://blog.csdn.net/whatday/article/details/106106767]
2. cudaNvSci.h: fatal error: nvscibuf.h: No such file or directory [https://cloud.tencent.com/developer/article/1584631]
其他参考:
1. https://www.server-world.info/en/note?os=CentOS_7&p=cuda&f=4 (samples的测试)
2. https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html#post-installation-actions (Official installation guide)
=================================================
Install Pytorch 1.6
=================================================
-------First: Install Python-3.8.1 (Follow from source guide [https://phoenixnap.com/kb/how-to-install-python-3-centos-7] )---------
How to Install PyTorch with CUDA 10.2: https://varhowto.com/install-pytorch-cuda-10-2/