multithreading - tensorflow 。如何在 GPU 之间分配操作

标签 multithreading tensorflow google-cloud-ml

我正在 google cloud ml-engine 上运行一个非常大的 Tensorflow 模型。 使用缩放层 basic_gpu (使用 batch_size=1)时,我收到如下错误:

Resource exhausted: OOM when allocating tensor with shape[1,155,240,240,16]

因为模型太大,无法容纳在一个 GPU 中。

使用提供 4 个 GPU 的 comple_model_m_gpu 层,我可以在 4 个 GPU 之间分散操作。

但是,我记得读到过,GPU 之间的通信速度很慢,可能会造成训练瓶颈。这是真的吗?

如果是这样,是否有推荐的方法在 GPU 之间传播操作来防止此问题?

最佳答案

我推荐以下指南:

Optimizing for GPU

来自指南:

The best approach to handling variable updates depends on the model, hardware, and even how the hardware has been configured.

基于指南的一些建议:

  • 尝试使用具有 16 GB RAM 的 P100(相比之下,K80s 为 12 GB)。它们的速度也明显更快,尽管它们的成本也更高
  • 将变量置于 CPU 上:tf.train.replica_device_setter(worker_device=worker, ps_device='/cpu:0', ps_tasks=1)

关于multithreading - tensorflow 。如何在 GPU 之间分配操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47835625/

相关文章:

python - 如何在谷歌机器学习中将 jpeg 图像转换为 json 文件

python - 在 CloudML for GPU 上加速 TFRecords 馈入 Keras 模型

swift - 在 swift 中通过 NSURLSession 重用线程

multithreading - gcc 中的线程安全原子操作

Java 并发性和范围

tensorflow - 如何打造专业的机器视觉OCR解决方案?

c++ - 如何在 Visual Studio 代码中调试 bazel c++ google test

python - 当存在 2 个版本的 python 时安装 COCOAPI

multithreading - 在请求之间共享应用程序线程池

tensorflow - 在 Google ML 中创建大型模型版本失败