【问题标题】:Tensorflow-gpu running issueTensorFlow-gpu 运行问题
【发布时间】:2020-08-07 00:00:25
【问题描述】:

与:

  • Tensorflow-GPU 2.0.0
  • Windows 10 环境
  • NVIDIA GTX 1050 显卡
  • cuda 10.0 和对应的 cudnn 7.6.5

我遵循了 TF-gpu 的官方 TF 文档,并尝试创建并拟合一个简单的 CNN 模型(在 a.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 进行了测试,但问题似乎仍然存在。

【问题讨论】:

  • This 是一个旧帖子但同样的问题。他们推荐不同的安装方法。
  • 但这似乎解决了一个 cpu 问题,没有获取设备和 cuda_unknown_error,不是吗?
  • 问题已修复,您可以在这里找到更多详细信息github.com/tensorflow/tensorflow/issues/36535

标签: python tensorflow


【解决方案1】:

为了 Stackoverflow 社区的利益,在此处提供解决方案,即使它存在于 Github 中。

使用以下组合安装Tensorflow_GPU : 2.1.0 已解决CUDA_ERROR_UNKNOWN 问题。

  • Python 版本:3.7.6
  • 编译器:MSVC 2017
  • CUDA:10.1
  • cuDNN:7.6.5

请参考 Windows CPUGPU 的测试构建配置。

【讨论】:

    【解决方案2】:

    here 所述,在我的情况下,限制 GPU 内存有效。

    将以下内容添加到您的代码中:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-21
      相关资源
      最近更新 更多