CUDA / Compute Unified Device Architecture / CUDA Toolkit / 工具包
- https://docs.nvidia.com/cuda/index.html
CUDA®是NVIDIA开发的一种并行计算平台和编程模型,用于图形处理单元(GPU)上的常规计算。借助CUDA,开发人员能够利用GPU的功能来显着加快计算应用程序的速度。
在GPU加速的应用程序中,工作负载的顺序部分在CPU上运行(针对单线程性能进行了优化),而应用程序的计算密集型部分则在数千个GPU内核上并行运行。使用CUDA时,开发人员使用C,C ++,Fortran,Python和MATLAB等流行语言进行编程,并通过扩展以一些基本关键字的形式表示并行性。CUDA工具包包括GPU加速的库,编译器,开发工具和CUDA运行时。
CentOS
##########################################################################
lspci | grep -i nvidia
getconf LONG_BIT
RTX 8000显卡为例,稳定和新功能驱动
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/465.31/NVIDIA-Linux-x86_64-465.31.run
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/460.84/NVIDIA-Linux-x86_64-460.84.run
准备依赖
yum -y install gcc gcc-c++ wget
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
yum install nvidia-detect
nvidia-detect -v
禁用自带的nouveau驱动并编译
# vim /lib/modprobe.d/dist-blacklist.conf
# vim /etc/modprobe.d/blacklist-nouveau.conf
vim /etc/modprobe.d/blacklist.conf
blacklist nouveau
options nouveau modeset=0
# blacklist nvidiafb
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
dracut -v /boot/initramfs-$(uname -r).img $(uname -r)
安装驱动
reboot
init 3 / 5
lsmod| grep -i nouveau
yum install kernel-devel kernel-headers -y
yum info kernel-devel kernel-headers
chmod 777 *
./NVIDIA-Linux-x86_64-460.84.run
一些报错
# ERROR: The Nouveau kernel driver is currently in use by your system.
# vim /etc/modprobe.d/blacklist.conf
# ERROR: Unable to find the kernel source tree for the currently running kernel.
# yum install kernel-devel kernel-headers -y
# yum info kernel-devel kernel-headers
# Unable to determine the path to install the libglvnd EGL vendor library config files.
# No device found ...
# nvidia-uninstall
Ubuntu
##########################################################################
# cuda和驱动安装 - 硬件设备/GPU到开发、测试、使用环境的准备
# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_local
lspci | grep -i nvidia
uname -sr # Linux 5.8.0-59-generic
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda-repo-ubuntu2004-11-3-local_11.3.1-465.19.01-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.1-465.19.01-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
sudo vim ./.bashrc # export PATH=/usr/local/cuda-11.3/bin${PATH:+:${PATH}}
## 检查驱动 nvidia-smi
## 检查型号 nvidia-smi -L
## 检查CUDA nvcc -V
NGC安装
# docker安装 - 完成容器化的环境准备
curl -fsSL https://get.docker.com | bash -s docker --mirror aliyun
## 检查比如 sudo docker images
# nvidia-docker2安装教程 - 带有nvidia驱动支持NGC
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docke
curl https://get.docker.com | sh \
&& sudo systemctl --now enable docke
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docke
## 检查 sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
docker pull nvcr.io/nvidia/tensorflow:21.06-tf1-py3 # tensorflow21/1.5版本
docker pull nvcr.io/partners/matlab:r2021a # matlab 2021a
docker run --gpus all -it --rm -p 5901:5901 -p 6080:6080 --shm-size=512M nvcr.io/partners/matlab:r2021a # 检查matlab
sudo docker pull nvcr.io/nvidia/caffe2:18.08-py3 # caffe2
sudo docker pull nvcr.io/nvidia/mxnet:21.06-py3 # mxnet
sudo docker pull nvcr.io/nvidia/theano:18.08 # theano
Windwos 2016 Server
##########################################################################
基本上.exe文件双击安装即可,python,eclipse等等已经装好
1. 装驱动和cuda
2. 装docke
# https://jaapwesselius.com/2020/04/08/install-module-msonline-fails-with-unable-to-download-from-uri/
# https://docs.microsoft.com/zh-cn/archive/blogs/canitpro/step-by-step-setup-docker-on-your-windows-2016-serve
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvide
docker run microsoft/sample-dotnet
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。