我可以在异构机器上使用 TensorFlow 分布式训练吗?

Can I use TensorFlow distribute training with heterogeneous machines?

我有两台机器,机器 1 有 GPU,机器 2 只有 CPU。 我想知道两台机器是否可以使用TensorFlow中的Multi-worker训练,即分布式训练时,machine1使用GPUs,machine2使用CPU.

Tensorflow的版本是2.1.0

您可以使用 Multi-worker 在多台机器上使用 TensorFlow 训练模型。默认情况下,TensorFlow 在您的系统上训练模型 CPU,但如果您有 Nvidia GPU,则可以安装 CUDA,这将允许您在 GPU 上训练模型。

答案是否定的。 当我按照本教程分发深度学习时:

https://www.tensorflow.org/tutorials/distribute/multi_worker_with_keras

发生了一些错误:

tensorflow.python.framework.errors_impl.InternalError: Collective Op CollectiveBcastSend: Broadcast(1) is assigned to device /job:worker/replica:0/task:0/device:GPU:0 with type GPU and group_key 1 but that group has type CPU [Op:CollectiveBcastSend]

我通过代码设置machine1使用CPU后:

os.environ['CUDA_VISIBLE_DEVICES'] = '-1'

训练将 运行 使用两台机器的 CPU 成功。