Prepare a GPU-accelerated cloud environment inside your Linux VM browser using Google Colab, select active T4 hardware runtime wrappers, load TensorFlow & Keras packages, and compile a test neural network training loop.
Environment
Google Colab / Cloud GPU
Difficulty
Intermediate (2/5)
Course Module
Deep Learning & Neural Networks
Deliverables
GPU Detection & Test Epoch Logs
Hardware virtualization notice: Configuring local GPU acceleration (NVIDIA CUDA/cuDNN) inside a VirtualBox virtual machine is extremely difficult due to lack of direct hardware graphics card passthrough support. Therefore, this project guides you through setting up and utilizing Google Colab (a free cloud-based GPU environment) directly inside your Linux VM's browser, which provides instant access to powerful NVIDIA T4 or A100 GPUs without manual CUDA driver configurations. A local CPU-only fallback verification is also provided for reference.
1. System Architecture & Process Workflow
The diagram below displays the Google Colab cloud execution model. The user's VirtualBox guest Firefox browser establishes an HTTPS secure web socket connection to Google Cloud Servers, which instantiate a virtual machine container, mapping standard model instructions to physical NVIDIA T4 GPU accelerator cards.
2. Part 1: Step-by-Step Action Items & Key Execution Steps
STEP 1
Open Web Browser inside Ubuntu VM
Launch Firefox browser from the desktop taskbar dock inside your virtual system workspace.
Click orange Firefox Browser icon in left-side dock -> Wait for window to load
This boots the web application renderer inside the Linux desktop window.
STEP 2
Navigate to the Google Colaboratory Portal
Enter the direct URL link in the address bar to open the cloud development dashboard.
Click URL address bar -> Type: https://colab.research.google.com -> Press Enter
This connects the browser window to Google's cloud computing interface server files.
STEP 3
Log In with Google Credentials
Sign in using your Google credentials to authenticate permissions and initialize personal workspace sheets.
Click top-right "Sign in" button -> Enter your Google Email -> Click Next -> Enter Password -> Click Next
This grants you workspace access, linking cloud servers to your Google Drive account for saving notebooks.
STEP 4
Create a Fresh Jupyter Notebook
Instantiate an empty interactive notebook structure inside the Google Drive cloud container.
Wait for popup modal -> Click blue "New notebook" button at bottom right (or Click File -> New Notebook)
This action spins up a clean cloud sandbox instance running a Python 3 runtime backend.
STEP 5
Rename Notebook file name
Assign a descriptive name to the notebook document to keep your work organized.
Click file name text box "Untitled0.ipynb" in upper-left -> Delete default text -> Type: deep_learning_setup.ipynb -> Press Enter
This renames the file inside your Google Drive storage path.
STEP 6
Change Cloud VM Hardware Accelerator
Open the hardware selection menu to change the execution engine from CPU to GPU.
Click "Runtime" in top menu -> Click "Change runtime type" -> Select "T4 GPU" in Hardware Accelerator dropdown -> Click Save
This instructs Google Cloud to detach the CPU server instance and boot a VM container with an active NVIDIA T4 graphics card.
STEP 7
Connect to Cloud VM Runtime Session
Initialize the server session allocation to mount the file system and hardware stack.
Click "Connect" button in upper-right corner of screen -> Wait for green checkmark -> Verify RAM/Disk info displays
This allocates the remote memory limits, mounting the workspace folders in Google Cloud.
STEP 8
Load the Python Diagnostic Script
Enter the verification script block inside the first empty code cell.
Click inside Code Cell 1 -> Copy Python code from Part 2 below -> Paste into the Cell box
This loads the script checking library versions, GPU hardware links, and Keras model compiling.
STEP 9
Execute Code Cell and Verify Console Logs
Run the cell block to verify that the GPU is detected and that model training runs successfully.
Press Shift + Enter (or Click circular Play icon on left margin of cell) -> Review printed logs below cell
This executes the Python script. Ensure the console logs show `Num GPUs Available: 1` and print epoch training status.
STEP 10
Save and Download Notebook Document
Save the active notebook updates and download the file locally to submit.
This commits changes to Google Drive and downloads a copy of the notebook file to your local VM system.
3. Operational Pipeline Architecture
The diagram below outlines the deep learning environment initialization pipeline. It traces the steps from browser launch and cloud connection to runtime allocation, GPU selection, verification script run, and saving the final notebook.
4. Part 2: Complete Deliverable Assets & Production Templates
To verify the TensorFlow and GPU runtime connection, we will build a Python validation script. Below is a line-by-line explanation of the code, followed by the combined script.
Step-by-Step Code Construction
Lines 1 - 3
Import Framework Modules
Include TensorFlow and NumPy packages to construct the diagnostic models.
import tensorflow as tf
import numpy as np
These imports check system paths and load the numerical libraries and neural network structures.
Lines 4 - 8
Detect Active GPU Devices
Query the active device hardware configurations to see if the GPU is available.
print(f"TensorFlow Version: {tf.__version__}")
gpu_devices = tf.config.list_physical_devices('GPU')
print(f"Num GPUs Available: {len(gpu_devices)}")
for device in gpu_devices:
print(f" - Device name details: {device}")
This checks the CUDA runtime link, verifying that TensorFlow is connected to the cloud GPU accelerator.
Lines 9 - 11
Create Mock Arrays
Generate random arrays using NumPy to simulate a training dataset.