【问题标题】:Tensorflow low GPU utilizationTensorFlow GPU 利用率低
【发布时间】:2019-09-26 01:44:53
【问题描述】:

我正在运行 Windows 10,核心 i7-8700 cpu,gtx geforce 1660 ti GPU。 训练模型时,GPU 利用率非常低(最高 5-10%,有时更低)。 甚至是网络是五层。另一方面,CPU 利用率为 30% 及以上。

【问题讨论】:

标签: tensorflow gpu utilization


【解决方案1】:

请检查以下内容:

  1. CUDA 和 CuDNN 版本匹配。据统计,它很可能在训练时使用 CPU 而不是 GPU。您可以尝试在选项 2 下方查看您的 GPU 是否可用。

  2. 如果解决了前者,您可能需要增加batch_size,以防batch size 非常小。 TensorFlow 可能会为您的训练预分配少量 GPU。

对于第 1 步,为了验证视频卡是否可用且已使用,请使用以下代码行:

import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))

tf.debugging.set_log_device_placement(True)

# Create some tensors
a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
c = tf.matmul(a, b)

print(c)

打印件应包含(连同结果)以下信息:

在设备中执行 op MatMul /job:localhost/replica:0/task:0/device:GPU:0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-29
    • 2019-09-25
    • 2023-02-24
    • 1970-01-01
    • 2017-03-05
    • 1970-01-01
    • 2016-09-28
    相关资源
    最近更新 更多