3060Ti显卡,tensorflow2.4-GPU安装

一、写在前面:

本来一直用的tensorflow2.3,换了新电脑就原样装的,但是怎么都调用不了GPU,2.3版本的安装大家可以参考:(37条消息) TensorFlow2.3(gpu)的安装简易教程及注意问题_qq_41876119的博客-CSDN博客

因为之前经受过很多折磨,所以比较快的想到可能是显卡,tensorflow,cuda的适配问题,事实证明确实,所以大家如果之后遇到类似的问题在比较确认自己安装流程没有问题的情况下,优先考虑这个问题。

二、安装步骤:

电脑配置:cpu:11400H;显卡:3060Ti(显存8G),系统:win10

1、安装anaconda

2、安装vscode

3、配置虚拟环境:

conda create -n tf2.4 python=3.8
activate tf2.4

4、安装cudatoolkit和cudnn:

首先确认自己显卡适配的cuda版本:

nvidia-smi

3060Ti显卡,tensorflow2.4-GPU安装

可以看到cuda的版本是11.4,其实,安装逻辑是根据这个版本确定要用哪个版本的tensorflow,我的1060ti显卡的电脑,cuda版本是10,所以用tf2.3。

conda install cudatoolkit=11.0
conda install cudnn==8.2.1

还有比较多的教程中cudnn是在官网下载安装的,也是可以的,anaconda中库的管理和更新可能会有点慢,不过这个方法目前亲测有效,之后的版本如果不行,就,再说吧。查看版本:

conda search cudnn

3060Ti显卡,tensorflow2.4-GPU安装

5、安装tensorflow2.4

pip install tensorflow-gpu==2.4.0 -i https://mirrors.aliyun.com/pypi/simple/

6、查看是否正确安装

conda list
python
import tensorflow as tf
tf.__version__
tf.test.is_gpu_available()
tf.config.list_physical_devices('GPU')

下面显示安装正确:

[En]

The following shows that the installation is correct:

3060Ti显卡,tensorflow2.4-GPU安装

Original: https://blog.csdn.net/weixin_45678589/article/details/121209358
Author: weixin_45678589
Title: 3060Ti显卡,tensorflow2.4-GPU安装

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/514406/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球