【问题标题】:How to convert XLA_GPU into GPU如何将 XLA_GPU 转换为 GPU
【发布时间】:2020-04-14 21:17:38
【问题描述】:

我的操作系统是 Ubuntu 18.04,我的 GPU 是 GTX850M。我正在使用 nvidia 驱动程序 430.50、CUDA 10.1CuDNN 9.0tensorflow-gpu 1.14.0。当我尝试使用 tensorflow 获取可用设备时,

from tensorflow.python.client import device_lib

device_lib.list_local_devices()

我要说出来

[name: "/device:CPU:0"
 device_type: "CPU"
 memory_limit: 268435456
 locality {
 }
 incarnation: 2293723676390825589,
 name: "/device:XLA_GPU:0"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 15287372432461854293
 physical_device_desc: "device: XLA_GPU device",
 name: "/device:XLA_CPU:0"
 device_type: "XLA_CPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 10399216684927698454
 physical_device_desc: "device: XLA_CPU device"]

我可以将 XLA_GPU 用于基本应用程序(即 tensorflow 恒定生产),但我无法训练神经网络。如何将 XLA_GPU 转换为 GPU 以训练深度神经网络?

【问题讨论】:

    标签: python tensorflow gpu


    【解决方案1】:

    您的输出表明,Tensorflow GPU 安装存在问题。

    我正在使用 nvidia 驱动程序 430.50、CUDA 10.1、CuDNN 9.0 和 张量流-GPU 1.14.0.

    根据Tensorflow tested build configurationstensorflow_gpu-1.14.0 需要CUDA-10.0cuDNN-7.4,通过这种组合,您可以在设备上使用 GPU。

    Note: 如果安装了非 GPU 版本的软件包,该函数也会返回 False。使用 tf.test.is_built_with_cuda() 来验证 TensorFlow 是否是在支持 CUDA 的情况下构建的。

    使用 gpu 的简单解决方法是,如果您可以使用 Anaconda 安装 tensorflow-gpu,那么它将在与 tensorflow-gpu 相同的 conda 环境中为您安装 cuda 和 cudnn。您可以使用 conda 创建虚拟环境,如下所示

    conda create --name tf python=3.8
    conda activate tf  # activate tf environment
    pip install tensorflow # install latest version of Tensorflow 2.4
    import tensorflow
    

    【讨论】:

      猜你喜欢
      • 2020-01-31
      • 2017-02-10
      • 1970-01-01
      • 2019-02-16
      • 2019-08-19
      • 2017-04-06
      • 1970-01-01
      • 2020-01-03
      • 2014-10-03
      相关资源
      最近更新 更多