Python-CUDA-cuDNN安装
python安装
http://python.p2hp.com/downloads/windows/index.html
python3.10.6
https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe
python, tensorflow-gpu, cuda, cudnn版本兼容关系
https://blog.csdn.net/pollotui/article/details/125064281
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
[repository1]
name = qinghua
url = https://pypi.tuna.tsinghua.edu.cn/simple/
trusted-host = pypi.tuna.tsinghua.edu.cn
[repository2]
name = alibaba
url = https://mirrors.aliyun.com/pypi/simple
trusted-host = mirrors.aliyun.com
安装显卡驱动
https://www.nvidia.com/Download/index.aspx?lang=en-us
官方匹配到的驱动版本号:536.99-desktop-win10-win11-64bit-international-dch-whql
下载后安装
安装CUDA
在Nvida系统信息中查看驱动版本,在组件页签中查看CUDA兼容版本号 12.2.135
https://developer.nvidia.cn/cuda-toolkit-archive
CUDA12.2下载地址:https://developer.nvidia.cn/cuda-downloads
CUDA11.8下载地址:https://developer.nvidia.cn/cuda-11-8-0-download-archive
安装cudnn(SDK)
https://developer.nvidia.com/rdp/cudnn-archive
下载对应cuda版本12.x的cudnn版本包
将解压的bin, include, lib三个文件夹分别复制到cuda目录中
验证cudnn安装成功
CUDA\v12.2\extras\demo_suite\deviceQuery.exe
CUDA\v12.2\extras\demo_suite\bandwidthTest.exe
=======================================
## 安装CUDA & cuDnn
CUDA下载地址:https://developer.nvidia.com/cuda-toolkit-archive
cuDnn下载地址:https://developer.nvidia.com/rdp/cudnn-download
## 安装GPU版本的Torch
curl -o cuda_11.0.2_451.48_win10.exe https://developer.download.nvidia.cn/compute/cuda/11.0.2/local_installers/cuda_11.0.2_451.48_win10.exe
conda install pytorch torchvision torchaudio cudatoolkit=11.8 -c pytorch
### 一定要使用以下命令安装,直接下载whl文件安装不行(折腾了一天的教训),可以先安装本地,再执行以下命令,这样不用单独下载
pip uninstall pytorch torchvision torchaudio
pip install "D:\AI\NvidaDrivers\torch-2.0.1+cu118-cp39-cp39-win_amd64.whl"
pip install torchvision==0.10.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
pip install torchaudio
### 测试pytorch是否能使用GPU
python -c "import torch; print(torch.cuda.is_available())"
python -c "import torch; print(torch.version.cuda);print(torch.__version__);print(torch.cuda.device_count())"
## 安装GPU版本的Tensorflow
pip install tensorflow-gpu==2.5.0
conda install cudatoolkit==11.8
### 测试tensorflow是否能使用GPU
python -c "import tensorflow as tf; print(tf.test.is_gpu_available());"
## windows docker容器运行
docker run -itd --gpus all 584aa0058283
## 判断驱动安装情况
1、查看cuda版本
cat /usr/local/cuda/version.txt
2、查看cudnn版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2