gpus parameter in multi-gpu-model

Viewed 952

I use keras(v2.2.4) with tensorflow(v1.12.0) as backend(Python 3.6.7). I want to implement a multi-gpu model use multi-gpu-model in keras.utils.

There are 10 gpus in the ubuntu machine and 0,1,2,9 is what I can use. So I wrote multi_gpu_model(model, gpus=[0, 1, 2, 9]), but it threw the error:

ValueError: To call `multi_gpu_model` with `gpus=[0, 1, 
2, 9]`, we expect the following devices to be available: 
['/cpu:0', '/gpu:0', '/gpu:1', '/gpu:2', '/gpu:9']. However 
this machine only has: ['/cpu:0', '/xla_gpu:0', '/xla_cpu:0', 
'/gpu:0', '/gpu:1', '/gpu:2', '/gpu:3']. Try reducing `gpus`.

The machine names are not consistent with those in tensorflow. When I changed the code to multi_gpu_model(model, gpus=[0, 1, 2, 3]), it used all my machines(as the figure shows). I am very confused. How can I implement the multi-gpu-model using 0,1,2,9 gpus?

enter image description here

0 Answers
Related