Feiyu Blog

Back

深度学习环境搭建Blur image

CUDA cuDNN安装#

  1. 下载对应版本CUDA,cuDNN,安装CUDA
  2. 在cmd中输入nvcc -V ,返回CUDA版本则说明安装成功
  3. 安装时若遇到“You already have a newer version of the NVIDIA Frameview SDK installed”,先把电脑已经存在的FrameView SDK 卸载掉,把C:\Program Files\NVIDIA Corporation\FrameViewSDK文件夹删掉
  4. 将cuDNN解压,bin, include, lib文件夹复制到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vxx.x目录下并覆盖

TensorFlow安装#

CUDA 12.6 TensorFlow 2.6.0

conda create -n tf26 python=3.8.18
activate tf26

conda install cudatoolkit=11.2.0 cudnn=8.1.0.77
pip install tensorflow-gpu==2.6.0 keras==2.6.0 protobuf==3.20.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/
conda install numpy=1.19.5 matplotlib=3.3.4 scipy scikit-learn pandas
shell

CUDA 12.6 TensorFlow 2.10.0

conda create -n tf210 python=3.8.18
activate tf210

conda install cudatoolkit=11.3 cudnn=8.2.1
pip install tensorflow-gpu==2.10.0 keras==2.10.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/
conda install numpy=1.22 matplotlib=3.7.2 scipy scikit-learn pandas
pip install opencv-python==4.4.0.44 tqdm imutils PyYAML tensorboard seaborn chardet -i https://pypi.tuna.tsinghua.edu.cn/simple/
shell

检测TensorFlow能否使用GPU

import tensorflow as tf
tf.config.list_physical_devices('GPU')
python

PyTorch安装#

CUDA 11.8 PyTorch2.3.1

conda create -n torch2 python=3.8.19
activate torch2

conda install pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorch-cuda=11.8 -c pytorch -c nvidia
shell

检测PyTorch能否使用GPU

import torch
print(torch.cuda.is_available())
print(torch.cuda.device_count())
python

Tested build configurations on Windows#

GPU#

VersionPython versionCompilerBuild toolscuDNNCUDA
tensorflow_gpu-2.10.03.7-3.10MSVC 2019Bazel 5.1.18.111.2
tensorflow_gpu-2.9.03.7-3.10MSVC 2019Bazel 5.0.08.111.2
tensorflow_gpu-2.8.03.7-3.10MSVC 2019Bazel 4.2.18.111.2
tensorflow_gpu-2.7.03.7-3.9MSVC 2019Bazel 3.7.28.111.2
tensorflow_gpu-2.6.03.6-3.9MSVC 2019Bazel 3.7.28.111.2
tensorflow_gpu-2.5.03.6-3.9MSVC 2019Bazel 3.7.28.111.2
tensorflow_gpu-2.4.03.6-3.8MSVC 2019Bazel 3.1.08.011.0
tensorflow_gpu-2.3.03.5-3.8MSVC 2019Bazel 3.1.07.610.1
tensorflow_gpu-2.2.03.5-3.8MSVC 2019Bazel 2.0.07.610.1
tensorflow_gpu-2.1.03.5-3.7MSVC 2019Bazel 0.27.1-0.29.17.610.1
tensorflow_gpu-2.0.03.5-3.7MSVC 2017Bazel 0.26.17.410
tensorflow_gpu-1.15.03.5-3.7MSVC 2017Bazel 0.26.17.410
tensorflow_gpu-1.14.03.5-3.7MSVC 2017Bazel 0.24.1-0.25.27.410
tensorflow_gpu-1.13.03.5-3.7MSVC 2015 update 3Bazel 0.19.0-0.21.07.410
tensorflow_gpu-1.12.03.5-3.6MSVC 2015 update 3Bazel 0.15.07.29.0
tensorflow_gpu-1.11.03.5-3.6MSVC 2015 update 3Bazel 0.15.079
tensorflow_gpu-1.10.03.5-3.6MSVC 2015 update 3Cmake v3.6.379
tensorflow_gpu-1.9.03.5-3.6MSVC 2015 update 3Cmake v3.6.379
tensorflow_gpu-1.8.03.5-3.6MSVC 2015 update 3Cmake v3.6.379
tensorflow_gpu-1.7.03.5-3.6MSVC 2015 update 3Cmake v3.6.379
tensorflow_gpu-1.6.03.5-3.6MSVC 2015 update 3Cmake v3.6.379
tensorflow_gpu-1.5.03.5-3.6MSVC 2015 update 3Cmake v3.6.379
tensorflow_gpu-1.4.03.5-3.6MSVC 2015 update 3Cmake v3.6.368
tensorflow_gpu-1.3.03.5-3.6MSVC 2015 update 3Cmake v3.6.368
tensorflow_gpu-1.2.03.5-3.6MSVC 2015 update 3Cmake v3.6.35.18
tensorflow_gpu-1.1.03.5MSVC 2015 update 3Cmake v3.6.35.18
tensorflow_gpu-1.0.03.5MSVC 2015 update 3Cmake v3.6.35.18
深度学习环境搭建
https://feiyu05.top/blog/build-deeplearning-env
Author Feiyu
Published at September 5, 2024
Comment seems to stuck. Try to refresh?✨