【问题标题】:Keras: unable to use GPU to its full capacityKeras:无法充分利用 GPU
【发布时间】:2019-03-03 22:15:28
【问题描述】:

当我运行我的代码时,我每次都会收到这条消息:

2018-09-27 19:31:03.353933: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties: 
name: GeForce GTX 650 Ti major: 3 minor: 0 memoryClockRate(GHz): 0.941
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.65GiB
2018-09-27 19:31:03.355743: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2018-09-27 19:31:04.822514: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-09-27 19:31:04.822895: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971]      0 
2018-09-27 19:31:04.823072: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0:   N 
2018-09-27 19:31:04.823679: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1416 MB memory) -> physical GPU (device: 0, name: GeForce GTX 650 Ti, pci bus id: 0000:01:00.0, compute capability: 3.0)
2018-09-27 19:31:12.050251: W tensorflow/core/common_runtime/bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 261.79MiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2018-09-27 19:31:17.191146: W tensorflow/core/common_runtime/bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 1.13GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.

最后 2 条消息是警告,对我来说似乎很奇怪:我应该有 1.65GiB 的可用内存,但无法分配一些较小的数量。 我能做些什么来解决它?此消息的来源是什么?还有:为什么我的 GPU 使用率不能超过 50%?

这是我开始训练时的样子:

代码本身在my repo 中(我很难知道我的代码的哪些部分是相关的)。

【问题讨论】:

    标签: python-3.x tensorflow machine-learning keras gpu


    【解决方案1】:

    【讨论】:

    • 但我只有 1 个 GPU。 ://
    【解决方案2】:

    您是否尝试过增加批量大小?我从您的代码中看到您使用batch size = 1

    【讨论】:

    • 使用更大的批量会导致我的 GPU 上出现OOM Exception。但令人惊讶的是,我显然还远远没有使用它来处理一张正在处理的图像。
    猜你喜欢
    • 2019-09-25
    • 1970-01-01
    • 2018-03-20
    • 1970-01-01
    • 2018-01-16
    • 2021-06-12
    • 1970-01-01
    • 2020-10-23
    • 1970-01-01
    相关资源
    最近更新 更多