赞
踩
centos 英伟达检查工具
lsb_release -a
nvidia-smi
lspci | grep -i nvidia
首先在centos机器上必须先安装英伟达驱动,参考下面的文档
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#
https://developer.nvidia.com/cuda-11-8-0-download-archive
然后用 nvidia-smi 检查是否有输出,例子如下:
Wed Mar 13 20:30:18 2024 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 515.65.01 Driver Version: 515.65.01 CUDA Version: 11.7 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 Quadro RTX 4000 Off | 00000000:3B:00.0 Off | N/A | | 30% 35C P8 9W / 125W | 2829MiB / 8192MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ | 1 Quadro RTX 4000 Off | 00000000:5E:00.0 Off | N/A | | 30% 31C P8 2W / 125W | 3MiB / 8192MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ | 2 Quadro RTX 4000 Off | 00000000:B1:00.0 Off | N/A | | 30% 35C P8 12W / 125W | 3MiB / 8192MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ | 3 Quadro RTX 4000 Off | 00000000:D9:00.0 Off | N/A | | 30% 31C P8 9W / 125W | 3MiB / 8192MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 54587 C python 2045MiB | | 0 N/A N/A 254047 C python 781MiB | +-----------------------------------------------------------------------------+
conda create -n ai_py310 python==3.10
conda activate ai_py310
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config list
安装pytorch会自动安装 numpy 和 cudnn(cudnn会自动安装cudatoolkit包)
conda install pytorch2.0.1 torchvision0.15.2 torchaudio2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia
#如果用pip安装,则用下面的命令来安装Pytorhch支持 CUDA
#pip install torch2.0.1 torchvision0.15.2 torchaudio2.0.2
pip install torch2.0.1 torchvision0.15.2 torchaudio==2.0.2
pip install torch2.0.1 torchvision0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
pip install torch2.0.1 torchvision0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cpu
pip install onnxruntime-gpu==1.14.1
#我们的是cuda 11.7,故用onnxruntime-gpu:1.14.1和conda install cudnn=8.9.2.26
#conda install cudnn=8.9.2.26 会安装cudatoolkit包
conda install cudnn=8.9.2.26
pip install insightface==0.7.3
pip install tqdm
pip install redis
pip install boto3
pip install opencv-python
pip install python-multipart
pip install fastapi
pip install uvicorn
pip install pillow
pip install loguru
pip install psutil
//安装 ffmpeg
#通过源码编译方式安装,见 https://blog.csdn.net/coding_zhang/article/details/87178146
wget https://ffmpeg.org/releases/ffmpeg-6.1.1.tar.xz
tar -xf ./ffmpeg-6.1.1.tar.xz
cd ffmpeg-6.1.1
./configure --prefix=/data/home/tanghongbin/ffmpeg
#碰到 nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
make && make install
git config --global user.name tanghongbin
git config --global credential.helper cache
附录
ONNX runntime和cuda版本对应:
https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#requirements
pytorch和cuda版本对应:
https://pytorch.org/get-started/previous-versions/
docker nvida install guide:
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。