Monitor CPU/TPU/Memory/Network usage on Google Colab

This tool is damn convenient. Yes, the resource monitor should have been built in since long ago. In the Jupyter Lab environment, it is easy to run a command to check CPU usage by invoking the command line. But it not possible for Google Colab, afaik. I don’t even know what is new in Google Colab except for now I don’t have to re-auth Google Drive connection.

In Google Colab, there is no way we know whether the code is executed properly or just hanging up indefinitely. Because we cannot run two cells simultaneously. But now this magic code will do the work:

from urllib.request import urlopen exec(urlopen("").read()) _colabMonitor = ColabMonitor().start() # _colabMonitor = ColabMonitor(tpu=tpu).start() # use this line instead to include TPU
Code language: PHP (php)

The URL pointed to the dashboard to monitor resource usage. I usually put the code above in the top cell in the Google Colab notebook.

And there is the magic dashboard:

Such a damn convenient, right? If you think so, you may want to try TensorDash, because I don’t have a chance to try it.