Introduction
In this tutorial, you'll learn how to deploy and manage AI workloads on cloud infrastructure using NVIDIA GPUs, similar to what's being enabled by Nvidia's $1.5B investment in SoftBank's data center infrastructure. This hands-on guide will walk you through setting up a GPU-accelerated environment for AI development using NVIDIA's CUDA toolkit and Docker containers. You'll create a practical AI development environment that can handle machine learning workloads efficiently.
Prerequisites
- NVIDIA GPU with CUDA support (RTX 3000 series or newer recommended)
- Ubuntu 20.04 or later Linux distribution
- Docker installed on your system
- Basic understanding of Python and command-line interfaces
- Internet connection with stable bandwidth
Step 1: Verify NVIDIA GPU and CUDA Installation
Check GPU Compatibility
Before proceeding, we need to verify that your system has a compatible NVIDIA GPU and that the drivers are properly installed. This step is crucial because we'll be leveraging GPU acceleration for AI workloads.
lspci | grep -i nvidia
nvidia-smi
The first command lists all NVIDIA devices, while the second displays detailed GPU information including driver version and memory usage. If you see NVIDIA devices and a working driver, you're ready to proceed.
Step 2: Install NVIDIA Container Toolkit
Prepare Docker for GPU Support
To run AI workloads in containers with GPU access, we need the NVIDIA Container Toolkit. This toolkit enables Docker containers to access NVIDIA GPUs.
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
sudo curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu20.04/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
This installation adds the necessary components to Docker to enable GPU access within containers, which is essential for running AI frameworks like TensorFlow or PyTorch with GPU acceleration.
Step 3: Create a GPU-Enabled AI Development Environment
Set Up Containerized Development Environment
We'll create a Docker container with common AI libraries pre-installed. This approach mirrors how large-scale AI infrastructure like the one Nvidia is investing in works.
mkdir ai-dev-env
cd ai-dev-env
cat > Dockerfile << EOF
FROM nvidia/cuda:11.8.0-devel-ubuntu20.04
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-dev \
git \
curl
RUN pip3 install --upgrade pip
RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
RUN pip3 install tensorflow-gpu
RUN pip3 install jupyter notebook
EXPOSE 8888
CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
EOF
This Dockerfile creates a container with CUDA support, Python, PyTorch, TensorFlow, and Jupyter Notebook. The container is designed to work with NVIDIA GPUs and will be the foundation of your AI development environment.
Step 4: Build and Run the AI Development Container
Launch Your GPU-Accelerated Environment
Now we'll build and run our AI development container with GPU access.
docker build -t ai-dev-container .
docker run --gpus all -p 8888:8888 ai-dev-container
The --gpus all flag ensures full GPU access within the container. This mirrors how large data centers like those being funded by Nvidia invest in infrastructure to support GPU-accelerated AI workloads at scale.
Step 5: Test GPU Acceleration in Your Environment
Verify AI Framework GPU Support
Let's create a simple test script to verify that our environment can utilize GPU acceleration for AI workloads.
cat > test_gpu.py << EOF
import torch
import tensorflow as tf
print("PyTorch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
if torch.cuda.is_available():
print("CUDA device count:", torch.cuda.device_count())
print("Current device:", torch.cuda.current_device())
print("Device name:", torch.cuda.get_device_name(0))
print("TensorFlow version:", tf.__version__)
print("GPU devices:", tf.config.list_physical_devices('GPU'))
print("Built with CUDA:", tf.test.is_built_with_cuda())
EOF
This script tests both PyTorch and TensorFlow GPU support, ensuring that our containerized environment can properly utilize GPU acceleration for AI workloads.
Step 6: Run the Test Script
Validate Your Setup
Execute the test script within your running container to confirm GPU acceleration is working correctly.
docker exec -it <container_id> python3 test_gpu.py
When you run this test, you should see output showing that CUDA is available, GPU devices are detected, and both frameworks are properly configured to use GPU acceleration. This confirms your environment is ready for AI development.
Step 7: Create a Sample AI Project
Build a Simple Neural Network
Let's create a basic neural network example to demonstrate how you can leverage your GPU-accelerated environment for real AI workloads.
cat > simple_nn.py << EOF
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
# Create a simple neural network
class SimpleNN(nn.Module):
def __init__(self):
super(SimpleNN, self).__init__()
self.fc1 = nn.Linear(784, 128)
self.fc2 = nn.Linear(128, 64)
self.fc3 = nn.Linear(64, 10)
self.relu = nn.ReLU()
def forward(self, x):
x = self.relu(self.fc1(x))
x = self.relu(self.fc2(x))
x = self.fc3(x)
return x
# Initialize network, loss, and optimizer
net = SimpleNN()
if torch.cuda.is_available():
net = net.cuda()
print("Using GPU for training")
else:
print("Using CPU for training")
# Test forward pass
x = torch.randn(32, 784)
if torch.cuda.is_available():
x = x.cuda()
output = net(x)
print(f"Output shape: {output.shape}")
print("Neural network test completed successfully!")
EOF
This example creates a simple neural network and demonstrates how to move it to GPU memory when available. This is exactly the type of work that benefits from the infrastructure investments being made by companies like Nvidia and SoftBank.
Step 8: Run Your AI Project
Execute the Neural Network Test
Execute your sample neural network to verify everything works correctly in your GPU-accelerated environment.
docker exec -it <container_id> python3 simple_nn.py
You should see output confirming that the neural network is using GPU acceleration and that the forward pass executes correctly. This demonstrates how modern AI infrastructure enables efficient training and inference of neural networks.
Summary
In this tutorial, you've learned how to set up a GPU-accelerated AI development environment using NVIDIA's technologies. You've installed the NVIDIA Container Toolkit, created a Docker container with AI libraries, verified GPU acceleration, and run sample AI workloads. This environment mirrors the infrastructure being developed by companies like Nvidia and SoftBank, which invest billions in data center infrastructure to power AI workloads. The skills you've learned are directly applicable to developing and deploying AI applications at scale, whether for research or production use cases.
The key takeaway is understanding how modern AI infrastructure combines hardware (NVIDIA GPUs) with software (Docker containers, CUDA, AI frameworks) to create efficient, scalable environments for machine learning development. This is exactly the type of infrastructure that's being funded by investments like Nvidia's $1.5B commitment to SoftBank's data center projects.



