【发布时间】:2021-09-10 22:12:47
【问题描述】:
我在多 GPU 机器上遇到 OOM,因为 TF 2.3 似乎只使用一个 GPU 分配张量。
tensorflow/core/framework/op_kernel.cc:1767] OP_REQUIRES failed at conv_ops.cc:539 :
Resource exhausted: OOM when allocating tensor with shape[20532,64,48,32]
and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc.
但是当我运行我的代码时,tensorflow 确实可以识别多个 GPU:
Adding visible gpu devices: 0, 1, 2
我还需要做什么才能让 TF 使用所有 GPU?
【问题讨论】:
-
如果我没记错的话,具有这种形状的张量需要 8 GB 内存。你的机器上真的有足够的内存吗?
-
我机器上的每个 GPU 都有 16160MiB 应该够用了吧?
-
应该够了。我自己并没有真正使用过 tensorflow,只是偶然发现了你的问题。你能检查一下 TF 是否真的看到/有权访问完整的 GPU 内存吗?就像在stackoverflow.com/questions/36123740/… 中回答的一样@
标签: tensorflow gpu multi-gpu