I'm using python35, keras 2.1.5 & Tensorflow GPU 1.8.0
I'm training multiple model at the same time (and coworkers also) on a cluster with 4 gpu.
I've tried the following code to select a GPU:
from keras import backend as K
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0" #or 1, etc
K.tensorflow_backend._get_available_gpus()
Saddly, with this method I need to select manually an available GPU (using nvidia-smi, choosing one, and praying that between the launch with nohup and the nvidia command nobody started a training)
Is there a way to select automatically a GPU ?
And also, is there a way to not block access to this GPU for other user / program ?
--edit:--
for the second question, there is also another duplicate explaining how to allocate only a fraction of the GPU memory