Force GPU Selection in TensorFlow

If you want only some GPU’s to be available to TensorFlow, you can configure it using CUDA_VISIBLE_DEVICES environment variable in python.

Here is the code snippet

Note that, for multiple GPU’s you need to specify them in a comma separated string.