What's the Hardware Spec for Google Colaboratory

In this blog, we’ll delve into the hardware specifications of Google Colaboratory, a cloud-based platform familiar to software engineers for running and developing Python-based machine learning models. Discovering the underlying hardware specifications is essential, and we’ll elaborate on their significance throughout this post.

As a software engineer, you may have heard of Google Colaboratory, a cloud-based platform that allows you to run and develop machine learning models using Python. But what are the hardware specifications behind this platform? In this blog post, we will explore the hardware spec for Google Colaboratory and explain why it matters.

Table of Contents

  1. Overview of Google Colaboratory
  2. CPU and RAM
  3. GPUs and TPUs
  4. Why hardware specification matters
  5. Conclusion

Overview of Google Colaboratory

Google Colaboratory, also known as Colab, is a research project created by Google that allows you to run Python code in a Jupyter notebook environment. It provides you with a free virtual machine that comes with pre-installed Python libraries, including TensorFlow and PyTorch, and offers access to GPUs and TPUs (Tensor Processing Units) for machine learning tasks.

Colab is a popular choice among developers and researchers because it allows you to run code on powerful hardware without the need for expensive hardware purchases and maintenance. But what are the actual hardware specifications behind this platform?

CPU and RAM

The CPU (Central Processing Unit) and RAM (Random Access Memory) are two important hardware components that determine the performance of your virtual machine. When you create a new notebook in Colab, you are given access to a virtual machine with a specific CPU and RAM configuration.

The default CPU for Colab is an Intel Xeon CPU with 2 vCPUs (virtual CPUs) and 13GB of RAM. However, you can choose to upgrade your virtual machine to a higher CPU and RAM configuration if you need more computing power. For example, you can choose a virtual machine with up to 96 vCPUs and 624GB of RAM.

To check the CPU info, open a Colab Notebook and run:

from psutil import *
# This code will return the number of CPU
print("Number of CPU: ", cpu_count())
# This code will return the CPU info
!cat /proc/cpuinfo

Output:

Number of CPU: 2

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 79
model name	: Intel(R) Xeon(R) CPU @ 2.20GHz
stepping	: 0
microcode	: 0x1
cpu MHz		: 2200.000
cache size	: 56320 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms rtm rdseed adx xsaveopt
bugs		:
bogomips	: 4400.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 46 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 79
model name	: Intel(R) Xeon(R) CPU @ 2.20GHz
stepping	: 0
microcode	: 0x1
cpu MHz		: 2200.000
cache size	: 56320 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 1
apicid		: 1
initial apicid	: 1
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms rtm rdseed adx xsaveopt
bugs		:
bogomips	: 4400.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 46 bits physical, 48 bits virtual
power management:

To check RAM info, run the following code:

virtual_memory()

Output:

svmem(total=13662199808, available=13007400960, percent=4.8, used=6736826368, free=6925373440, active=5795020800, inactive=636964864, buffers=9695232, cached=6072332288, shared=671744) 

GPUs and TPUs

In addition to CPU and RAM, Colab also offers access to GPUs and TPUs for machine learning tasks. GPUs (Graphics Processing Units) are specialized hardware components that excel at parallel processing, making them ideal for training machine learning models. TPUs, on the other hand, are custom-built ASICs (Application-Specific Integrated Circuits) designed by Google specifically for machine learning tasks.

The default GPU for Colab is a NVIDIA Tesla K80 with 12GB of VRAM (Video Random-Access Memory). However, you can choose to upgrade to a higher GPU configuration if you need more computing power. For example, you can choose a virtual machine with a NVIDIA Tesla T4 GPU with 16GB of VRAM or a NVIDIA A100 GPU with 40GB of VRAM.

TPUs are also available in Colab, but they are only accessible through a limited number of virtual machines that are specifically designed for TPU usage. These virtual machines come with a TPU v2 or TPU v3, and are equipped with 8 or 16GB of high-bandwidth memory (HBM) respectively.

To check the current GPU (TPU) that is being used, run the following code on your notebook:

!nvidia-smi

Output:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05             Driver Version: 535.104.05   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  Tesla T4                       Off | 00000000:00:04.0 Off |                    0 |
| N/A   45C    P8              10W /  70W |      0MiB / 15360MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |

The output shows that we are using a Tesla T4 TPU which has 15Gb memory.

Why hardware specification matters

The hardware specification of your virtual machine in Colab can have a significant impact on the performance of your machine learning tasks. A higher CPU and RAM configuration can allow you to process larger datasets and run more complex models. Similarly, a higher GPU or TPU configuration can significantly reduce the training time of your models.

In addition, the hardware specification of your virtual machine can also affect the cost of using Colab. While Colab provides a free virtual machine with basic specifications, upgrading to a higher configuration can result in additional costs.

Conclusion

In conclusion, the hardware specification of your virtual machine in Google Colaboratory plays a crucial role in determining the performance of your machine learning tasks. While the default specifications are suitable for basic tasks, upgrading to a higher configuration can significantly improve the performance of your models. However, it is important to keep in mind that a higher configuration can also result in additional costs.


About Saturn Cloud

Saturn Cloud is your all-in-one solution for data science & ML development, deployment, and data pipelines in the cloud. Spin up a notebook with 4TB of RAM, add a GPU, connect to a distributed cluster of workers, and more. Request a demo today to learn more.