![](/img/trans.png)
[英]How to run same Keras model on different GPUs in parallel independently with different data?
[英]How to run many TensorFlow instances in parallel on different GPUs on the same machine?
假设我并行启动以下命令以在同一台机器上一次训练许多TensorFlow模型:
python3 launch_training.py --gpu 0
python3 launch_training.py --gpu 1
python3 launch_training.py --gpu 2
python3 launch_training.py --gpu 3
python3 launch_training.py --gpu 4
python3 launch_training.py --gpu 5
python3 launch_training.py --gpu 6
python3 launch_training.py --gpu 7
我们假设在launch_training.py
内部launch_training.py
了一个TensorFlow图和会话,并具有以下上下文: with tf.device('/gpu:0'):
--gpu
其中0
替换为正确的--gpu
索引参数)。
这样行吗? 如果没有,我必须采取哪些步骤来使这项工作进行? 在租用GPU之前,我想知道这一点。
您必须with tf.device('gpu:N')
指定一个gpu设备,其中N
是设备索引。 首先阅读https://www.tensorflow.org/programmers_guide/using_gpu和https://github.com/carla-simulator/carla/issues/116
我认为您对在不同的GPU上多次运行同一脚本和使用多个GPU来运行一个脚本感到困惑。 在前一种情况下,请阅读TensorFlow指南的“在多GPU系统上使用单个GPU”部分,而在后一种情况下,请阅读“使用多个GPU”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.