If I want to train Keras models and have multiple GPUs available, there are several ways of using them effectively:
Assign a GPU each to a different model, and train them in parallel (For example, for hyperparameter tuning, or comparison between different architectures). For example, I have model1 that I assign to GPU1, and model2 to GPU2, and after one global data loading operation, Keras would run model.fit() for each model in parallel on each GPU.
Dividing one model and train in parallel on all GPUs. This is done by splitting the model into sequential chunks, and then computing all gradients for the whole model. The way it is implemented it would not work for different independent models.
Diving data and feeding different batches to the same model on different GPUs.
There seem to be a lot of documentation of 2) and 3)
https://keras.io/guides/distributed_training/
https://www.run.ai/guides/multi-gpu/keras-multi-gpu-a-practical-guide/
But I can't find any solution for 1), and the posts asking for it don't have a solution:
Train multiple keras/tensorflow models on different GPUs simultaneously
It seems that, with those options already available, it should be trivial to also have the option to assign a different GPU to each model, and train in parallel. Is there something I am missing?
EDIT: One proposed solution is just to run different python scripts. But this is not optimal, as it is dividing each GPU per script, not per model, which means all other parts of the script will need to be run twice, redundantly. If the data loading part is expensive, this will be very inefficient, as both scripts will be competing for data access.