【问题标题】:tensorflow-gpu recognizes XLA-CPU instead of GPUtensorflow-gpu 识别 XLA-CPU 而不是 GPU
【发布时间】:2021-12-20 02:34:21
【问题描述】:

我正在尝试在装有 Tesla V100 和 Windows Server 2019 的 PC 上安装 keras-gpu。我安装了一些版本 (2.4.3),发现我的 GPU 无法正常工作。我需要安装任何支持 GPU 的 2.x.x 版本的 keras。

我已经安装了 CUDA 10.1 cudnn 8.0.5 并且经过多次尝试还尝试了 11.2 版本和 cudnn 8.1.1(也尝试了 11.5)。并开始搜索可以找到我的 GPU 的 tensorflow 版本。

对于 10.1:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:12:52_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.1, V10.1.243

我正在使用此代码检查所有:

import tensorflow
print(tensorflow.__version__)
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

我的输出:

2021-11-06 10:39:16.326880: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2.3.0
2021-11-06 10:39:21.177512: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-11-06 10:39:21.208333: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x25d395509b0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-11-06 10:39:21.217997: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2021-11-06 10:39:21.261861: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2021-11-06 10:39:21.677227: E tensorflow/stream_executor/cuda/cuda_driver.cc:314] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2021-11-06 10:39:21.692028: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: windows-freqgpu
2021-11-06 10:39:21.700398: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: windows-freqgpu
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 881354854201867138
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 5868137251793075209
physical_device_desc: "device: XLA_CPU device"
]

这里的特斯拉 V100 是 XLA_CPU。如何解决这个问题?

【问题讨论】:

  • 您可能遇到了某种 GPU 驱动程序问题
  • 是的,这听起来像您没有安装驱动程序。

标签: tensorflow keras


【解决方案1】:

您可以尝试安装与 CUDA 10.1 兼容的 tensorflow-gpu 2.2.x 或 2.3.x,可以在下面的测试构建配置中进行检查:

https://www.tensorflow.org/install/source#gpu

如果您查看经过测试的构建配置,您会发现 tensorflow 2.4.0 已针对 CUDA 11.0 进行了测试。查看 tensorflow GPU 支持页面 (https://www.tensorflow.org/install/gpu#software_requirements) 上的软件要求,您可以看到 CUDA 11.2 似乎只推荐用于 Tensorflow >= 2.5.0。

您的 GPU 不太可能被识别为“XLA_CPU”设备。这里的“XLA”代表“加速线性代数”(https://www.tensorflow.org/xla)。它是一个特定领域的编译器,可用于 CPU 和 GPU。有关更多详细信息,您可以查看此what is XLA_GPU and XLA_CPU for tensorflow。正如您的输出中的这一行所证明的那样,您的 GPU 更有可能根本未被检测到。

2021-11-06 10:39:21.677227: E tensorflow/stream_executor/cuda/cuda_driver.cc:314] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected

【讨论】:

    【解决方案2】:

    正如@talonmies 所提到的,这是与驱动程序相关的问题。更准确地说是特斯拉司机相关的问题。我已经更新了驱动程序,但 Tesla 需要针对不同 CUDA 版本的特定驱动程序版本。

    对于常见的 GPU,CUDA 本身也带来了正确的驱动程序。

    正确安装 Tesla v100/Windows Server 2019/CUDA 10.1:

    1. 安装 CUDA(在我的例子中是 10.1)
    2. 安装适合此 CUDA 版本 (427.60) 的驱动程序
    3. 安装 cuDNN (7.6.5)

    【讨论】:

      猜你喜欢
      • 2020-01-14
      • 2019-01-06
      • 1970-01-01
      • 2021-03-23
      • 1970-01-01
      • 2018-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多