Keras multi-gpu seems to heavily load one of the cards

I'm using Keras (tf backend) to train a neural net; I'm accelerating with GPUs using the multi gpu options in Keras.

For some reason, the program seems to heavily load one of the cards and the others only lightly. See the output from nvidia-smi below.

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.40.04    Driver Version: 418.40.04    CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla K80           Off  | 000004C3:00:00.0 Off |                    0 |
| N/A   73C    P0    75W / 149W |  10954MiB / 11441MiB |     75%      Default |
+-------------------------------+----------------------+----------------------+
|   1  Tesla K80           Off  | 0000268A:00:00.0 Off |                    0 |
| N/A   49C    P0    74W / 149W |  10954MiB / 11441MiB |     23%      Default |
+-------------------------------+----------------------+----------------------+
|   2  Tesla K80           Off  | 0000B08A:00:00.0 Off |                    0 |
| N/A   51C    P0    72W / 149W |  10954MiB / 11441MiB |     21%      Default |
+-------------------------------+----------------------+----------------------+
|   3  Tesla K80           Off  | 0000E703:00:00.0 Off |                    0 |
| N/A   65C    P0    62W / 149W |  10954MiB / 11441MiB |     21%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

Why might this be? Does it mean that the other cards are not contributing as much as they could to the effort?

Edit:

call to multi_gpu_model is:

model = Model(inputs=[lsi, hi, hm, hc, hsc, ni, *embed_inputs], outputs=o)
model = multi_gpu_model(model, gpus=len(K.tensorflow_backend._get_available_gpus())) # transfer to multi-gpu so we're using all of them.

Note that I am using the keras.utils.multi_gpu_model and not the tf... version. It seems to work in that it definitely then causes all 4 GPUs to be placed under some load, it's just the unbalancing that's odd.

Topic cuda gpu keras tensorflow neural-network

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.