Understanding Python Tensorflow-gpu Processor Multiple Specifications

Asked 1 years ago, Updated 1 years ago, 52 views

Python introduces Tensorflow-gpu and would like to compute simultaneously with multiple GPUs.

keras.utils.training_utils
of
multi_gpu_model(model,gpus=gpu_count)

Verified that multiple GPUs can be calculated by running .

Next, I would like to specify which GPU to use.
If you only specify one GPU, I think you can specify which GPU to use in the following code:

with tf.device("/gpu:●"):

If I want to use two GPUs in parallel out of three or more GPUs this time, what should I do?
For example, if you want to use only gpu:0,3 in some parts of the program and gpu:0,3

with tf.device(["/gpu:0", "/gpu:3"]):

I would like to do so.(The above is an image and this code doesn't work)
Is it possible to specify multiple GPUs in this way?
Thank you for your cooperation.

python tensorflow deep-learning keras gpu

2022-09-29 22:05

1 Answers

If you look at the reference, you can see an example of configuring for loop.

Using multiple GPUs-TensorFlow

#Creates a graph.
c=[ ]
for in ['/device:GPU:2', '/device:GPU:3']:
  with tf.device(d):
  ...


2022-09-29 22:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.