我正在嘗試在裝有 Tesla V100 和 Windows Server 2019 的 PC 上安裝 keras-gpu。我安裝了一些版本 (2.4.3),發現我的 GPU 無法正常作業。我需要安裝任何支持 GPU 的 2.xx 版本的 keras。
我已經安裝了 CUDA 10.1 cudnn 8.0.5 并且經過多次嘗試還嘗試了帶有 cudnn 8.1.1 的 11.2 版本(也嘗試了 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"
]
這里的 Tesla V100 是 XLA_CPU。如何解決這個問題?
uj5u.com熱心網友回復:
您可以嘗試安裝與 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。有關更多詳細資訊,您可以查看tensorflow 的 XLA_GPU 和 XLA_CPU 是什么。更有可能只是沒有檢測到您的 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
uj5u.com熱心網友回復:
正如@talonmies 所提到的,這是與驅動程式相關的問題。更準確地說,是特斯拉司機相關的問題。我更新了驅動程式,但特斯拉需要針對不同 CUDA 版本的特定驅動程式版本。
同樣對于常見的 GPU,CUDA 本身帶來了正確的驅動程式。
Tesla v100/Windows Server 2019/CUDA 10.1 的正確安裝:
- 安裝 CUDA(在我的情況下為 10.1)
- 安裝適合此 CUDA 版本的驅動程式 (427.60)
- 安裝 cuDNN (7.6.5)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/351705.html
