[英]How to use multiple GPUs for separate training with Tensorflow?
I have looked through many articles and posts about using multiple GPUs with TensorFlow.我浏览了许多关于在 TensorFlow 中使用多个 GPU 的文章和帖子。 It helps me more here on "how to use parallel GPUs to train NN (neural network)".它在“如何使用并行 GPU 训练 NN(神经网络)”方面对我有更多帮助。 But I have a different question.但我有一个不同的问题。 Can a separate GPU be used to train different NNs at the same time?可以使用单独的 GPU 同时训练不同的 NN 吗?
More details:更多细节:
I have neural networks A
, B
, and GPU1
, GPU2
.我有神经网络A
、 B
和GPU1
、 GPU2
。 I want to train A
NN on GPU1
and B
NN on GPU2
at the same time.我想同时在GPU1
上训练A
NN 和在GPU2
上训练B
NN。 Is it possible?可能吗?
I suggest using two separate python scripts to train both networks, such as trainA.py
and trainB.py
.我建议使用两个单独的 python 脚本来训练这两个网络,例如trainA.py
和trainB.py
。
In the first two lines of trainA.py
you select your preferred GPU.在 trainA.py 的前两行中,您选择trainA.py
您首选的 GPU。
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
For trainB.py
you select the other GPU:对于trainB.py
你 select 另一个 GPU:
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
Now you should be able to run both train scripts at the same time.现在您应该能够同时运行两个训练脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.