Automatically check available GPU on Google Colab
Is there an automatic way to check which GPU is currently available on Google Colab (Pro).
Say I would like to use a Tesla P100 instead of the Tesla T4 to train my model, is there a way to periodically check with a python script in Colab whether the P100 is available?
I have tried eliminate the kernel periodically but it won't restart again automatically after shutting down:
import os

def restart_runtime():
   os.kill(os.getpid(), 9)

Thank you

There is no way to check what GPU is available. Add the line:
!nvidia-smi

to the beginning of your code and then keep on disconnecting and reconnecting the runtime until you get the GPU that you want.
