Change default GPU in TensorFlow
If you want to run your code on the second GPU,it assumes that your machine has two GPUs, You can do the following trick.

open Terminal
open tmux by typing tmux (you can install it by  sudo apt-get install tmux)
run this line of code in tmux: CUDA_VISIBLE_DEVICES=1 python YourScript.py

Note: By default, tensorflow uses the first GPU, so with above trick, you can run your another code on the second GPU, separately.
Hope it would be helpful!!
Based on the documentation, the default GPU is the one with the lowest id:

If you have more than one GPU in your system, the GPU with the lowest
  ID will be selected by default.

Is it possible to change this default from command line or one line of code?