Search code examples
google-cloud-platformgoogle-compute-enginegoogle-colaboratory

How do I know if the Google Colab notebook is using the recourses from the Google Compute Engine VM Instance?


I see my Google Computer Linux instance on a seperate terminal window.

I basically followed every single instruction listed over here. I followed step 4 perfectly.

and made a successful connection via SSH linking the Google Compute Instance to a port..

How can I verify in my Google Colab notebook that I'm indeed using the CPU and GPU of that Compute Engine instance? By 'using the CPU and GPU of my Compute Engine instance', what I'm asking is, is there any way to VERIFY that I'm indeed using the hardware of the Compute Engine VM?

I tried printing stats (the commands for which I got from another StackOverflow answer)

from psutil import *
!cat /proc/cpuinfo

I get

cat: /proc/cpuinfo: No such file or directory

I tried this though:

cpu_count()

I get

4

I believe these are the number of cores on my LOCAL machine and NOT the VM instance which I seemed to have connected to without problems.


Solution

  • Running !hostname in a cell on its own will tell you the name of the host executing your python code (hopefully your local machine and your VM have different-enough names that the output will make it obvious where execution is happening).