When a computer has multiple CUDA-capable GPUs, each GPU is assigned a device ID. By default, CUDA kernels execute on device ID 0. You can use
device ID
device ID 0
The best solution I have found (tested in tensorflow==2.3.0) is to add the following before anything that may import tensorflow:
tensorflow==2.3.0
tensorflow
import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="0,3" # specify which GPU(s) to be used