簡體   English   中英

Tensorflow-gpu 運行問題

[英]Tensorflow-gpu running issue

和:

  • Tensorflow-GPU 2.0.0
  • Windows 10 環境
  • 英偉達 GTX 1050 GPU
  • cuda 10.0 和相應的 cudnn 7.6.5

我遵循了 TF-gpu 的官方 TF 文檔,並嘗試創建並擬合一個簡單的 CNN 模型(在 .py 文件中,我嘗試使用 jupyter 但內核總是死機),但我得到以下信息:

2020-02-06 23:57:14.420911: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2020-02-06 23:57:16.081396: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-02-06 23:57:16.861094: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493
pciBusID: 0000:01:00.0
2020-02-06 23:57:16.861492: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2020-02-06 23:57:16.862290: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
2020-02-06 23:58:14.322053: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-02-06 23:58:14.324900: F tensorflow/stream_executor/lib/statusor.cc:34] Attempting to fetch value instead of handling error Internal: failed to get device attribute 13 for device 0: CUDA_ERROR_UNKNOWN: unknown error

有人知道如何才能使 tf-gpu 2.0.0 正常運行嗎? 我已經用 2.1.0 測試過,但問題似乎仍然存在。

在這里提供解決方案,即使它存在於 Github 中,也是為了 Stackoverflow 社區的利益。

安裝Tensorflow_GPU : 2.1.0與以下組合解決了CUDA_ERROR_UNKNOWN問題。

  • Python 版本:3.7.6
  • 編譯器:MSVC 2017
  • CUDA:10.1
  • cuDNN:7.6.5

請參考 Windows CPUGPU 的測試構建配置。

在我的情況限制了GPU內存的工作,提到這里

在您的代碼中添加以下內容:

import tensorflow as tf

gpus = tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(gpus[0], True)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM