Ray Clusters are in beta. Features and behavior may change before general availability.
What you’ll learn
In this tutorial, you’ll learn how to:- Create a Ray Cluster with the Ray Cluster template.
- Check that every node has joined the Ray cluster.
- Run a Ray job that uses every GPU in the cluster.
- Monitor GPU usage for each node in the Ray dashboard.
Requirements
- A Runpod account with enough credits for a multi-node cluster.
Step 1: Create a Ray Cluster
- Open the Instant Clusters page and click Create Cluster.
- Select Ray as the cluster type.
- Name your cluster, set Pod Count to 2, and select a GPU type with 2 GPUs per Pod.
- Optionally, select a network volume to share data across nodes.
- Confirm that the Ray Cluster template is selected. The console selects it automatically for Ray Clusters.
- Click Deploy Cluster.
0 is the Ray head node, and the other Pod is a worker.
Step 2: Check that the cluster is ready
Each Pod starts Ray as soon as its container starts. The worker waits for the head node, then joins.-
On the Instant Clusters page, expand your cluster and select the head Pod (rank
0). - Click Connect, then open a Web Terminal.
-
Check the state of the Ray cluster:
When both nodes have joined, the output lists 2 active nodes and 4 GPUs.
ray status to confirm that every node has joined.
Step 3: Run a Ray job across every GPU
In the head node’s terminal, create a file namedgpu_job.py:
num_gpus=1), so Ray spreads the tasks across both nodes. When every task finishes, the script prints the node and GPU each one ran on.
Submit the script as a Ray job:
Step 4: Monitor the cluster
- Select the head Pod and click Connect.
- Click Ray Dashboard. The console signs you in with the head node’s token.
- Open the Jobs tab to see the job you submitted.
- Open the Cluster tab to see live CPU, GPU, memory, and disk usage for each node.
- Open the Metrics tab to see historical charts for every node.
Step 5: Clean up
When you’re done, return to the Instant Clusters page and delete your cluster. A running cluster continues to incur charges.Next steps
- Learn how Ray Clusters work, including environment variables and reserved ports.
- Add dependencies to your jobs with runtime environments or a virtual environment on a network volume.
- Build a custom image from the supported Ray cluster image.