tensorflow CUDA 入门安装

安装好环境后的测试代码:

 

import tensorflow as tf
tf.test.is_gpu_available()

测试终端输出:

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

归类到不碍事但碍眼的提示中,是在说你的CPU不支持AVX2这种编译方式。

 

 


 

FutureWarning: Passing (type, 1) or
'1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'

 

 从终端文件ctrl+单击, 点进文件改一下dtype

改成:

之后就应该都可以用啦


 

tensorflow是基于gpu还是cpu的:

查询命令

具体版本安装命令

实际调用

 


显然,要使用GPU的话,还需要安装CUDA:
需要先查看自己电脑NVIDA驱动最高能安装什么版本的CUDA

 

 

 选择适合的版本:

 

 其他细节可以参考这篇:https://blog.ailemon.net/2020/07/27/windows-install-cuda-and-cudnn-environment/

在命令行中测试:nvcc -V, 显示版本号则安装成功。

 

将解压后的cuDNN文件夹中的 bin include lib文件中的所有文件 都添加到CUDA文件夹中的 bin include lib 中。

所有安装结束。

 

 可以在任意powershell窗口中测试

(GT710纯纯工具,毫无生产力)

 

posted @ 2022-03-15 17:04  lydia19  阅读(112)  评论(0)    收藏  举报