Compute Engine Instance#
Create Virtual Machine#
Create a new Compute Engine Instance with GPUs, the NVIDIA Driver and the NVIDIA Container Runtime.
NVIDIA maintains a Virtual Machine Image (VMI) that pre-installs NVIDIA drivers and container runtimes, we recommend using this image.
Open Compute Engine.
Select Create Instance.
Select Marketplace.
Search for “nvidia” and select NVIDIA GPU-Optimized VMI, then select Launch.
In the New NVIDIA GPU-Optimized VMI deployment interface, fill in the name and any required information for the vm (the defaults should be fine for most users).
Read and accept the Terms of Service
Select Deploy to start the virtual machine.
Allow network access#
To access Jupyter and Dask we will need to set up some firewall rules to open up some ports.
Create the firewall rule#
Open VPC Network.
Select Firewall and Create firewall rule
Give the rule a name like
rapids
and ensure the network matches the one you selected for the VM.Add a tag like
rapids
which we will use to assign the rule to our VM.Set your source IP range. We recommend you restrict this to your own IP address or your corporate network rather than
0.0.0.0/0
which will allow anyone to access your VM.Under Protocols and ports allow TCP connections on ports
8786,8787,8888
.
Assign it to the VM#
Open Compute Engine.
Select your VM and press Edit.
Scroll down to Networking and add the
rapids
network tag you gave your firewall rule.Select Save.
Connect to the VM#
Next we need to connect to the VM.
Open Compute Engine.
Locate your VM and press the SSH button which will open a new browser tab with a terminal.
Read and accept the NVIDIA installer prompts.
Install RAPIDS#
There are a selection of methods you can use to install RAPIDS which you can see via the RAPIDS release selector.
For this example we are going to run the RAPIDS Docker container so we need to know the name of the most recent container. On the release selector choose Docker in the Method column.
Then copy the commands shown:
docker pull nvcr.io/nvidia/rapidsai/notebooks:24.10-cuda12.5-py3.12 docker run --gpus all --rm -it \ --shm-size=1g --ulimit memlock=-1 \ -p 8888:8888 -p 8787:8787 -p 8786:8786 \ nvcr.io/nvidia/rapidsai/notebooks:24.10-cuda12.5-py3.12
Note
If you see a “docker socket permission denied” error while running these commands try closing and reconnecting your
SSH window. This happens because your user was added to the docker
group only after you signed in.
Test RAPIDS#
To access Jupyter, navigate to <VM ip>:8888
in the browser.
In a Python notebook, check that you can import and use RAPIDS libraries like cudf
.
In [1]: import cudf
In [2]: df = cudf.datasets.timeseries()
In [3]: df.head()
Out[3]:
id name x y
timestamp
2000-01-01 00:00:00 1020 Kevin 0.091536 0.664482
2000-01-01 00:00:01 974 Frank 0.683788 -0.467281
2000-01-01 00:00:02 1000 Charlie 0.419740 -0.796866
2000-01-01 00:00:03 1019 Edith 0.488411 0.731661
2000-01-01 00:00:04 998 Quinn 0.651381 -0.525398
Open cudf/10min.ipynb
and execute the cells to explore more of how cudf
works.
When running a Dask cluster you can also visit <VM ip>:8787
to monitor the Dask cluster status.
Clean up#
Once you are finished head back to the Deployments page and delete the marketplace deployment you created.