Scenario: You have multiple GPUs on a single machine running Linux, but you want to use just one. By default, Keras allocates memory to all GPUs unless you specify otherwise. You use a Jupyter Notebook to run Keras with the Tensorflow backend.
Here’s how to use a single GPU in Keras with TensorFlow
Run this bit of code in a cell right at the start of your notebook (before importing tensorflow
or keras
).