Win10 在 CUDA 10.1 下跑 TensorFlow 2.x

深度学习最热的两个框架是 pytorch 和 tensorflow,pytorch 最新版本是 1.3,tensorflow 最新版本为 2.0,在 win10 下 pytorch 1.3 要求的 cuda 最高版本是 10.1,见下图:

 

 

 

 而 tensorflow 2.0 使用的 cuda 版本是 10.0,见下图:

 

这就造成了冲突,一般是装 cuda 10.1,然后再重新编译 tensorflow 2.0 源码跑在 cuda 10.1 下,编译 tensorflow 源码的步骤还是较麻烦的,也很容易失败,不过现在有更好的方案了,

就是直接安装 NIGHTLY 版本,目前最新版本为 tensorflow 2.1.0-rc2,使用 pip 安装

pip install tensorflow-gpu==2.1.0-rc2

检验一下

import tensorflow as tf
print(tf.test.is_gpu_available())

发现已经能正常使用 gpu 了

2020-01-01 10:40:26.616452: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1241] Created TensorFlow device (/device:GPU:0 with 4702 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1)
True

  

posted on 2020-01-01 10:59  lly277365  阅读(3183)  评论(0编辑  收藏  举报