Playbook · DGX Spark cluster

Set up a Ray cluster on two DGX Sparks.

Ray joins the two Sparks into one pool that Python programs can send work to. vLLM can also use it to reach the second Spark.

A Ray cluster runs whatever code it is sent. Ray says anyone who can reach its dashboard, jobs or client services can run code on your machines. Never expose them, and set up the protections below before you start it.

How to make a two-node Ray cluster on DGX Sparks

  1. Install the same Ray and Python versions on both Sparks.
  2. Make one access token, copy it to the second Spark, and turn token authentication on for both.
  3. Start the head on the first Spark's link address, then join the second.
  4. Keep the dashboard on localhost and every Ray port off other networks.

Checked on 26 November 2026 against: Ray's security, token authentication, on-premise cluster, ports and CLI documentation (latest release then: 2.60.1) and NVIDIA's vLLM playbook for two Sparks. We have not yet run this playbook start to finish on our own hardware.

Watch, then follow

Decide, set up and check a Ray cluster, in two parts.

Part 1 of 2: Decide and configure

Video, part 1: Decide and configure. It covers: Pick the head node; CPUs, GPUs, memory; pip, or containers; Shared, and not shared; Fit first, then choose; DEFAULT or SPREAD; Splitting data work; Requests are not load. Chapters and transcript
Read the words of this video

Decide before you start. Here's what to decide for Ray on two DGX Sparks, and what it splits for you.

The AI stack. We're at the bottom of the stack: two machines, working over their own cable.

Pick the head node. One Spark is the head. It also manages the cluster. If the head fails, the whole cluster fails.

CPUs, GPUs, memory. Ray counts each Spark's CPUs and GPUs. You can offer it fewer, to leave room for other work. By default it sets seventy percent of available memory for scheduling, and thirty for its object store. On a DGX Spark the processor and GPU share that memory, so leave room for your model.

pip, or containers. With pip, you keep the versions matching on both Sparks yourself. With containers, one image holds the software. Pass in the token, and give them enough shared memory.

Shared, and not shared. Ray places tasks and actors, and moves their objects between the Sparks when needed. It doesn't pool the two memories, and it doesn't move an ordinary program.

Fit first, then choose. Each task or actor asks for resources. A task asks for one CPU unless you say otherwise. Ray keeps only the nodes that could fit it. One task can't combine two Sparks. Then a strategy picks one of them.

DEFAULT or SPREAD. The default strategy doesn't promise an even split. By our reading, a small batch may stay on one Spark. Spread tries to put tasks on different nodes. A strict spread placement group requires separate nodes.

Splitting data work. Ray Data cuts a dataset into blocks, and works on them in parallel. Files need to be reachable from the nodes that read them, such as a shared filesystem at the same path.

Requests are not load. Those CPU numbers are requests, not measurements. Ray doesn't stop a task using more. So watch the real load on each Spark as well.

Ready to set up. Keep it private, whatever you choose. Part two sets the cluster up.

Slides for this part, at your own pace:

10 steps

  1. Diagram for step 1, Choose the head node: Pick the head node
    Diagram: Pick the head node, for step 1

    Decide

    1. Choose the head node

    Pick one Spark as the head, and keep it the same one. If the head fails, the whole cluster fails. Our advice: use the one you leave running and sign in to.

  2. Diagram for step 2, Set the CPUs and GPUs each node offers: CPUs, GPUs, memory
    Diagram: CPUs, GPUs, memory, for step 2

    Decide

    2. Set the CPUs and GPUs each node offers

    Ray counts them itself. --num-cpus and --num-gpus replace the counts, and cannot change while the node runs. They are bookkeeping and fence off nothing. Our advice: offer fewer if other heavy work shares the Spark.

    --num-cpus=CPUS-FOR-RAY --num-gpus=GPUS-FOR-RAY
  3. Diagram for step 3, Plan the memory and object store: CPUs, GPUs, memory
    Diagram: CPUs, GPUs, memory, for step 3

    Decide

    3. Plan the memory and object store

    By default: 70% of the memory available at start for scheduling, 30% for the object store, with caps on the store. The processor and GPU share one memory, and Ray does not manage GPU memory. --object-store-memory takes bytes.

  4. Diagram for step 4, Choose pip or containers: pip, or containers
    Diagram: pip, or containers, for step 4

    Decide

    4. Choose pip or containers

    Use one way for both nodes. pip is the path in part 2. For vLLM, NVIDIA's playbook uses containers: pass in the token settings and token file, and check their shared memory size.

    NVIDIA's vLLM playbook

  5. Diagram for step 5, Know what Ray does not share: Shared, and not shared
    Diagram: Shared, and not shared, for step 5

    What is split

    5. Know what Ray does not share

    Ray places work you hand to it with .remote() or a Ray library. A plain program stays on the Spark where you started it. The two memories are not pooled. Files, packages and models are not copied unless you arrange it.

  6. Diagram for step 6, Say what each task needs: Fit first, then choose
    Diagram: Fit first, then choose, for step 6

    What is split

    6. Say what each task needs

    Ray first keeps the nodes that fit the request. A task asks for 1 CPU by default. An actor needs 1 to be placed and 0 while running, so set num_cpus on actors. One task cannot add two Sparks together.

    @ray.remote(num_cpus=4)
    def heavy_step(part):
        ...
  7. Diagram for step 7, Pick a strategy: DEFAULT or SPREAD
    Diagram: DEFAULT or SPREAD, for step 7

    What is split

    7. Pick a strategy

    DEFAULT goes by requested resources, and for tasks by where large arguments are. In our reading, a small batch may stay on one Spark. SPREAD tries different nodes, without promising equal counts.

    work.options(scheduling_strategy="SPREAD").remote(i)
  8. Diagram for step 8, Use a placement group to require two nodes: DEFAULT or SPREAD
    Diagram: DEFAULT or SPREAD, for step 8

    What is split Only if placement must be guaranteed

    8. Use a placement group to require two nodes

    A placement group reserves bundles first. STRICT_SPREAD requires a separate node for each bundle, and STRICT_PACK requires one node. Each bundle must fit on one node.

  9. Diagram for step 9, Make data reachable from both: Splitting data work
    Diagram: Splitting data work, for step 9

    What is split Only if you use Ray Data

    9. Make data reachable from both

    Ray Data cuts a dataset into blocks and works on them in parallel. Use cloud storage, or a shared filesystem mounted at the same path on every node.

  10. Diagram for step 10, Watch real load too: Requests are not load
    Diagram: Requests are not load, for step 10

    What is split

    10. Watch real load too

    Ray does not limit what a task really uses, and ray status shows requests, not processor use. Check each Spark itself.

    top
    free -h
    nvidia-smi

Part 2 of 2: Set up, check and stop

Video, part 2: Set up, check and stop. It covers: Ray runs code; Install the same version; One token for both; Start the head; Join the worker; Check both joined; See where work ran; Stop the worker first. Chapters and transcript
Read the words of this video

Set up, check, stop. Now set up Ray on two DGX Sparks. First, the safety warning.

Ray runs code. Anyone who can reach Ray's dashboard, jobs or client services can run code on your Sparks. Never expose them. Block Ray's ports from every network except the cluster link. Turn on token authentication. It adds to that protection, and doesn't replace it.

Install the same version. Make a Python environment on both Sparks. Switch it on. Install the same Ray version on both, with matching Python versions.

One token for both. Make the token on the first Spark. This prints it, so keep your screen private. Make a private folder on the second Spark. Copy the token across, over the cluster link. Then make the copy readable only by you.

Start the head. On the first Spark, turn token mode on. Then start the head on its cluster link address, with the dashboard on localhost.

Join the worker. On the second Spark, turn token mode on there too. Then join the head, using the second Spark's own link address.

Check both joined. Check the listening ports, so you know what your firewall must block. Then ask for the status. You want two active nodes, and two GPUs if you offered both.

See where work ran. Run the small example from the written page. It counts tasks by host name. Compare default with spread. The counts needn't be equal. Ray's task list can also show which node ran each task.

Stop the worker first. Finish your jobs first. Stopping ends all Ray processes on that machine. Run it on the worker. Then run it on the head.

Checked, and private. The written page covers vLLM, undoing the setup, and problems.

Slides for this part, at your own pace:

11 steps

  1. Diagram for step 1, Keep Ray private: Ray runs code
    Diagram: Ray runs code, for step 1

    Safety

    1. Keep Ray private

    Anyone who can reach the dashboard, jobs or client services can run code on your machines. Never expose them.

    Plan token authentication, a dashboard on localhost, and a firewall that lets only the other Spark reach Ray's ports, over the cluster link. Run only code you trust.

  2. Diagram for step 2, Install the same Ray on both: Install the same version
    Diagram: Install the same version, for step 2

    Both Sparks

    2. Install the same Ray on both

    Replace VERSION with one release from Ray's list, 2.52.0 or later, the same on both. The Python versions must match too.

    python3 -m venv ~/ray-env
    source ~/ray-env/bin/activate
    pip install "ray[default]==VERSION"
    ray --version
    python --version
  3. Diagram for step 3, Make the token: One token for both
    Diagram: One token for both, for step 3

    First Spark

    3. Make the token

    The token is a password to run code on your cluster, and this prints it. Keep it out of chats and screenshots.

    This writes the token to ~/.ray/auth_token. If a token is already there, check what else uses it before you copy it to another machine.

    ray get-auth-token --generate
  4. Diagram for step 4, Copy the token to the second Spark: One token for both
    Diagram: One token for both, for step 4

    First Spark

    4. Copy the token to the second Spark

    This replaces any token file already on the second Spark.

    Copy it over the cluster link, and keep both copies readable only by you.

    ssh USER@SECOND-SPARK-LINK-ADDRESS 'mkdir -p ~/.ray && chmod 700 ~/.ray'
    scp ~/.ray/auth_token USER@SECOND-SPARK-LINK-ADDRESS:.ray/auth_token
    ssh USER@SECOND-SPARK-LINK-ADDRESS 'chmod 600 .ray/auth_token'
    chmod 600 ~/.ray/auth_token
  5. Diagram for step 5, Start the head: Start the head
    Diagram: Start the head, for step 5

    First Spark

    5. Start the head

    A Ray cluster runs whatever code it is sent. Start it only with your firewall plan in place and the token ready.

    Add the resource options you decided on in part 1, if any.

    source ~/ray-env/bin/activate
    export RAY_AUTH_MODE=token
    ray start --head --port=6379 \
      --node-ip-address=FIRST-SPARK-LINK-ADDRESS \
      --dashboard-host=localhost
  6. Diagram for step 6, Join the worker: Join the worker
    Diagram: Join the worker, for step 6

    Second Spark

    6. Join the worker

    The worker does not turn token authentication on by itself, so set it first.

    source ~/ray-env/bin/activate
    export RAY_AUTH_MODE=token
    ray start --address=FIRST-SPARK-LINK-ADDRESS:6379 \
      --node-ip-address=SECOND-SPARK-LINK-ADDRESS
  7. Diagram for step 7, Check what is listening: Check both joined
    Diagram: Check both joined, for step 7

    Check

    7. Check what is listening

    Run this on both. Ray uses several ports, some picked at random. Make sure other networks cannot reach them.

    sudo ss -ltnp
  8. Diagram for step 8, Look for two active nodes: Check both joined
    Diagram: Check both joined, for step 8

    Check

    8. Look for two active nodes

    In a shell with the environment on and token mode set, run this. Success is two active nodes, and two GPUs if you offered both.

    ray status
  9. Diagram for step 9, See where the work ran: See where work ran
    Diagram: See where work ran, for step 9

    Check

    9. See where the work ran

    Save where_ran.py from the section below on the head and run it. It counts tasks by host name under DEFAULT and SPREAD. We have not run it on hardware.

    python where_ran.py
    ray list nodes
    ray list tasks --detail

    The where_ran.py example

  10. Diagram for step 10, Stop the worker: Stop the worker first
    Diagram: Stop the worker first, for step 10

    Stop

    10. Stop the worker

    ray stop ends all Ray processes on that machine, including other Ray work there.

    Finish or cancel your jobs first. Then, on the second Spark:

    ray stop
  11. Diagram for step 11, Stop the head: Stop the worker first
    Diagram: Stop the worker first, for step 11

    Stop

    11. Stop the head

    ray stop ends all Ray processes on this machine too.

    On the first Spark. To remove Ray afterwards, follow Stop and undo below.

    ray stop

    Stop and undo

Written from the makers' own documents, linked below. The sections on decisions, settings and sharing work were checked on 27 November 2026 against Ray 2.60.1's documentation. We have not run these steps on hardware.

Is this the one?

When is a Ray cluster worth it on two DGX Sparks?

Best for

Python work cut into many tasks, Ray's own libraries, or a guide or tool that asks for Ray.

Strengths

Python code can place work on either Spark. NVIDIA's two-Spark vLLM playbook uses it to split a model.

Drawbacks

More software to keep at matching versions, many network ports, and a head node that the cluster depends on. You may not need it: vLLM can split a model across two machines without Ray.

Compare all five in the cluster method chooser.

Before you start

What you need first.

Two DGX Sparks on the same current DGX OS, with the cable link set up and tested as in the cluster setup guide. In the commands, my-spark is the first Spark, spark-two the second, and USER your user name. Replace words in capitals with your own values. Nothing on this page has been run by us on hardware.

Python 3 with venv on both, the same Python version on both. Ray publishes ARM64 Linux packages. Token authentication needs Ray 2.52.0 or later.

If you only want to split one model, compare the split-model page first.

Security first

Ray security: what to set before you start.

Isolated network

Ray expects a controlled network and trusted code. Security has to come from outside Ray.

Token on

A shared token stops casual access. Ray says it adds to network isolation and does not replace it. It is sent unencrypted over plain HTTP.

Dashboard local

The dashboard listens on localhost by default. Keep it so, and use an SSH tunnel.

Nothing public

Never forward or publish the Ray ports. Run only code you trust.

Newer Ray releases change the default for tokens, and Ray's documentation describes changes in 2.59 and 2.61. Setting RAY_AUTH_MODE=token yourself on both nodes avoids relying on the default.

How it fits together

A head node and a worker node.

Your computerSSH tunnel onlymy-spark: Ray headdashboard on localhostspark-two: Ray workerjoins with the tokenRay ports: cluster link only
The head and worker talk over the cable. The dashboard is reached only through SSH. Our own drawing.

Decide first

Ray cluster decisions to make before you start.

Settle these six before you type a start command. Ray does not let you change a node’s resource amounts after it has started there, so changing your mind means stopping and starting that node.

Which DGX Spark should be the Ray head node?

The head runs the ordinary node processes and extra ones that manage the whole cluster. Ray says that if the head node fails, the entire cluster fails. If a worker fails, the tasks and actors running on it fail, and Ray's fault tolerance settings decide what can be recovered elsewhere. By default the script of a submitted job runs on the head.

Our advice: two DGX Sparks have the same hardware, so make the head the one you leave running, sign in to and tunnel to. Keep it the same one each time.

How many CPUs and GPUs should each node offer?

NVIDIA lists a 20-core Arm processor and 128 GB of unified memory in each DGX Spark. By default Ray counts the CPUs and GPUs it finds on the machine or in the container. --num-cpus and --num-gpus replace those counts. They are numbers for Ray's bookkeeping: they do not reserve or fence off any hardware. Giving a node zero CPUs stops it taking tasks or actors that ask for a CPU. By Ray's default rules that includes an actor with no stated request.

Our advice: keep the automatic counts if Ray is the only heavy work. If a Spark also runs something else, such as a database, a desktop or another model server, offer Ray fewer CPUs. If another program owns that Spark's GPU, start the node with --num-gpus=0. Do not set the head to zero CPUs on a two-Spark cluster unless you mean to use only one Spark for CPU work.

# example only: add to the head or worker start command
--num-cpus=CPUS-FOR-RAY --num-gpus=GPUS-FOR-RAY

How much memory and object store should Ray use?

By default Ray sets two figures when it starts on a node: schedulable memory at 70% of the memory available at that moment, and the object store at 30% of it. The object store is shared memory that holds task results and objects you put there. On Linux Ray also caps it at 200 GB and at 95% of the size of /dev/shm. When it fills, Ray spills objects to disk.

Ray does not manage how much GPU memory each task takes: that is your job. On a DGX Spark the processor and the GPU share one memory.

Our reasoning: a loaded model, Ray's workers and the object store therefore draw on the same 128 GB. And because Ray measures available memory as it starts, starting it before or after another program loads can give different figures. If a model server will take most of the memory, consider a smaller --object-store-memory. We have no tested value to give you.

Which network and Ray ports should the cluster use?

Give each node its cluster link address with --node-ip-address. Nodes talk to each other in both directions, on a few fixed ports and several random ones. A firewall rule for the cluster link between the two Sparks is easier to get right than a list of single ports. If you need a port list, fix each random port with its option first. Every other network should be blocked.

How should the Ray cluster be secured?

Decide these before the first start: token authentication on, the dashboard on localhost or turned off, no Ray port reachable from outside the pair, and only code you trust. Ray can also encrypt its gRPC traffic with TLS, which is off by default. It needs certificates you make yourself, has a speed cost, and does not replace network isolation. This guide does not set TLS up.

Should you run Ray in containers or install it with pip?

pip in a venv

The steps on this page. Little to learn. You keep Ray, Python and your packages the same on both Sparks yourself.

Containers

One image on both keeps the software together. NVIDIA's vLLM playbook uses them. The token, shared memory and file mounts must be passed in.

Never half each

Our advice: do not mix the two in one cluster. Ray lists different Ray versions as a reason a node cannot connect.

If you use containers, check two options. vLLM's run_cluster.sh, as we read it on 27 November 2026, uses --network host and --shm-size 10.24g. The second matters because the object store lives in /dev/shm: a container's shared memory size limits it. NVIDIA's playbook downloads an older pinned copy of the script, so read the one you actually run.

Our advice: use the pip steps to learn Ray and to run your own Python. To serve a model with vLLM, follow NVIDIA's container playbook and add the protections.

Settings

Ray cluster settings, defaults and when to change them.

Options with -- go on ray start, listed in Ray's command line reference. Names starting RAY_ are environment variables: set them on each node before Ray starts. Defaults are as the documents described them for Ray 2.60.1. Check them for your version.

Node and resource settings.

SettingWhat it controlsDefaultWhen to change it
--head, --addressStarts the head, or joins a worker to itNeither: you chooseAlways: one of them on each node
--node-ip-addressThe address this node usesThe CLI reference states noneSet it to the cluster link address
--num-cpusLogical CPUs offered to RayCPUs foundTo leave room for other work
--num-gpusLogical GPUs offered to RayGPUs found0 if another program owns the GPU
--resourcesYour own countable resources, as JSONNone addedTo limit or steer particular work
--object-store-memoryObject store size, in bytes30% of available memory, with capsLower to leave memory for a model; raise if objects spill
--object-spilling-directoryWhere overflowing objects are writtenRay's temporary directoryTo pick a drive with room
--temp-dirRay's logs and session files/tmp/rayIf that place is short of room

Ray ports and dashboard settings.

SettingWhat it controlsDefaultWhen to change it
--portHead's cluster service port (GCS)6379If something else uses it
--include-dashboardWhether the dashboard runsOnfalse if unused. Job submission and ray list need the dashboard
--dashboard-hostWhere the dashboard listenslocalhostLeave it. Use an SSH tunnel
--dashboard-portDashboard and job submission port8265If it is taken
--ray-client-server-portRay Client port on the head10001If it is taken
--min-worker-port, --max-worker-portPorts for worker processes10002 to 19999To fit firewall rules; too narrow a range limits workers
--dashboard-agent-listen-portDashboard agent, HTTP, each node52365If it is taken
--node-manager-port, --object-manager-port, --runtime-env-agent-port, --dashboard-agent-grpc-port, --metrics-export-portOther services on each nodeRandomTo write exact firewall rules

Security, memory and scheduling settings.

SettingWhat it controlsDefaultWhen to change it
RAY_AUTH_MODEToken authenticationDiffers by release. In 2.60.1 a worker does not turn it on by itselfSet token on every node and client
RAY_AUTH_TOKEN_PATHWhich token file is used~/.ray/auth_token is used if no token variable is setIf you keep more than one token
RAY_USE_TLSTLS on gRPC channels0, offIf your network rules require it
--disable-usage-statsRay's usage reports to its makersAsks in a terminal; on if it cannot ask, unless set beforeAdd it on the head to send none
RAY_memory_usage_thresholdWhen Ray's memory monitor kills a worker to free memory0.95 of the node's memoryRarely; read Ray's page first
RAY_memory_monitor_refresh_msHow often it checks; 0 stops its killing250NVIDIA's vLLM playbook sets 0 in its containers
RAY_scheduler_spread_thresholdHow busy a node must look before the default strategy ranks it lower0.5Most clusters never need to

With the memory monitor off, Ray no longer steps in when a node runs short of memory; Linux may then end a process itself. Ray's resource isolation option changes how the monitor works, and has its own rules.

What is split

How Ray splits CPU work across two DGX Sparks, and what it does not.

Ray splits work that your program hands to it: functions and classes marked @ray.remote and then called with .remote(), or work built with a Ray library. It does not turn two Sparks into one big computer.

Shared or handled by RayNot shared or not automatic
WorkTasks and actors are placed on a node that can fit themAn ordinary program stays on the Spark where it started
CPUs and GPUsTheir counts are added up for schedulingOne task or actor cannot use cores or GPUs from both nodes
MemoryRay objects are fetched from the other node when neededThe two memories are not pooled into one
Files, packages, modelsA runtime environment can send packages and files you listOtherwise each node needs its own, at paths your code can open
LoadChoices use what tasks and actors ask forThe default strategy does not rank nodes by measured CPU use

How Ray places a task or actor.

Ray schedules in two steps. First it keeps the nodes that can meet the declared CPU, GPU, memory, custom resource and label needs. Then a scheduling strategy picks one. A task asks for 1 logical CPU unless you say otherwise. An actor, by default, needs 1 logical CPU to be placed and 0 while it runs, so any number of such actors can pile onto a node with a free CPU. Ray recommends setting num_cpus on actors yourself.

If no free node fits right now, the work waits. If no node could ever fit it, it cannot be scheduled on this cluster: asking one task for more CPUs than either Spark offers does not combine the two.

Task or actorstates what it needs1. Which fit?declared resources2. Pick oneby the strategymy-sparkspark-twopython my_script.py, with no Ray callsstays where you started it
Ray first keeps the nodes that fit the declared needs, then a strategy picks one. An ordinary program is not placed at all. Our own drawing.

The DEFAULT strategy does not promise an even split.

Under "DEFAULT", Ray scores each node by its logical resource use. Below the spread threshold, 0.5, nodes score the same as an idle one. It then picks at random from a short list of the best nodes. Ray also says it favours nodes that already have tasks or actors scheduled. By Ray's published default sizes, a two-node cluster has a short list of one.

What that means, in our reading: do not expect half the tasks on each Spark. A small batch may run mostly or wholly on one.

For tasks, there is one more rule: Ray prefers a node that already holds the task’s large arguments, ahead of balancing load. Actors do not get this, and naming another strategy turns it off.

When to use SPREAD or a placement group.

# ask Ray to try to spread these tasks across nodes
work.options(scheduling_strategy="SPREAD").remote(i)

"SPREAD" tries to spread tasks or actors across the nodes that are available. It does not promise equal counts, and it cannot use a node that does not fit the request. A placement group reserves bundles of resources first. PACK, its default, tries to keep them on one node. SPREAD tries separate nodes. STRICT_PACK requires one node and STRICT_SPREAD requires separate nodes. Each bundle must fit on a single node, and the group reserves nothing until all of it fits. Ray can also pin work to one named node; it calls that a low-level tool for when the others will not do.

How to make CPU work split: ask for what you use.

@ray.remote(num_cpus=4)
def heavy_step(part):
    ...

Resource requests do not limit real use. A task that asks for 1 CPU can still start many threads, and Ray does not pin it to a core. So the logical figures can say a Spark is nearly idle while its processor is busy, or full while its tasks only wait. Ray sets OMP_NUM_THREADS to 1 for a task with no num_cpus, and to your figure when you give one; libraries that read it follow it, and others have their own setting. If you set the variable yourself, yours wins.

Our advice: cut the work into many independent pieces, give each a num_cpus close to what it really uses, then watch each Spark's processor and memory while it runs.

How Ray Data splits a data job.

Ray Data cuts a dataset into blocks and works on blocks in parallel, using tasks and actors. By default it chooses the number of read blocks from the data's size and the CPUs available: it starts at 200, adjusts for block size, and aims for at least twice the available CPUs. A read task asks for 1 CPU, and Ray Data currently gives at most one read task to each input file. It needs ray[data] on both nodes.

Files must be reachable from the nodes that read them. Ray says to use cloud storage or a shared filesystem mounted at the same path on every node.

What happens to a single ordinary process.

A plain Python program, a shell command or a compile job runs entirely on the Spark where you started it. Joining the cluster does not move it, or its threads, to the other one. The same is true of Python's own multiprocessing. Ray offers a replacement pool that you must choose in your code:

from ray.util.multiprocessing import Pool
pool = Pool(ray_address="auto")

A job sent with ray job submit is the same idea: its main script runs on the head by default. --entrypoint-num-cpus and its related options let Ray place that script by its needs instead. Only the work the script hands to Ray is spread further.

Logical resources are not measured load.

ray status shows what has been requested out of what was offered, for the cluster. It is not a processor meter. To see real load, look at each Spark itself with top, free -h and nvidia-smi. The memory monitor is different: it watches real memory use on each node. By default a task it kills is retried; an actor is not restarted unless you allowed restarts.

See for yourself

How to see which DGX Spark ran each Ray task.

Set the cluster up first, with the steps below. Then save this short example of ours as where_ran.py on the head:

import collections, socket, time
import ray

ray.init(address="auto")

@ray.remote(num_cpus=1)
def work(i):
    time.sleep(2)
    return socket.gethostname()

def count(task):
    return collections.Counter(ray.get([task.remote(i) for i in range(60)]))

print("script ran on:", socket.gethostname())
print("DEFAULT:", count(work))
print("SPREAD: ", count(work.options(scheduling_strategy="SPREAD")))
source ~/ray-env/bin/activate
export RAY_AUTH_MODE=token
python where_ran.py

It prints the script's own Spark, then a count of tasks for each host name under each strategy. We have not run it on hardware, so we show no counts. They need not be equal and can change between runs. If only one name appears under SPREAD, check ray status and what else is using CPUs. The tasks only sleep, yet Ray counts one logical CPU for each while it runs.

With ray[default] and the dashboard running, Ray's state commands also report on work. Match the node ID of a task to a node:

ray list nodes
ray list tasks --detail
ray summary tasks

Set up

How to set up Ray on two DGX Sparks.

  1. Install the same version on both.

    Pick one version from Ray's release list, and use it on both:

    python3 -m venv ~/ray-env
    source ~/ray-env/bin/activate
    pip install "ray[default]==VERSION"
    ray --version
    python --version
  2. Make a token and copy it.

    On the first Spark only. The second command copies it over the cluster link.

    The token is a password to run code on your cluster, and the first command prints it. The copy replaces any token file already on the second Spark. Do not paste it into chats, tickets, screenshots or a code repository. Ray says tokens do not expire.

    ray get-auth-token --generate
    ssh USER@SECOND-SPARK-LINK-ADDRESS 'mkdir -p ~/.ray && chmod 700 ~/.ray'
    scp ~/.ray/auth_token USER@SECOND-SPARK-LINK-ADDRESS:.ray/auth_token
    ssh USER@SECOND-SPARK-LINK-ADDRESS 'chmod 600 .ray/auth_token'
    chmod 600 ~/.ray/auth_token
  3. Join the worker.

    On the second Spark. The worker does not turn authentication on by itself, so the first setting matters.

    source ~/ray-env/bin/activate
    export RAY_AUTH_MODE=token
    ray start --address=FIRST-SPARK-LINK-ADDRESS:6379 \
      --node-ip-address=SECOND-SPARK-LINK-ADDRESS
  4. Check what is listening.

    sudo ss -ltnp

    Ray needs the nodes to reach each other on many ports: 6379 on the head, worker ports 10002 to 19999 by default, and others that are chosen at random. The head also uses 10001 for Ray Client and 8265 for the dashboard. An address option does not prove every one of them is limited to the cable. Block them from every other network.

Check

How to check both nodes joined.

On the first Spark, with the environment active and RAY_AUTH_MODE=token set:

ray status

Success is two active nodes. Check that the resources list the GPUs you expect, two in all. If a GPU is missing, fix that before you go on. Then prove a task runs on each node. Save this as two_nodes.py:

import socket, time
import ray

ray.init(address="auto")

@ray.remote(num_gpus=1)
def where():
    time.sleep(5)
    return socket.gethostname()

print(sorted(ray.get([where.remote(), where.remote()])))
python two_nodes.py

It should print both names, such as ['my-spark', 'spark-two']. If other work already holds a GPU, the script waits.

For the dashboard, open a tunnel from your computer, then browse to http://localhost:8265. It asks for the token.

ssh -N -L 8265:localhost:8265 USER@my-spark.local

vLLM on Ray

How to run vLLM on a Ray cluster.

vLLM must be installed with the same versions inside the same Ray environment on both nodes. Containers are the usual way. NVIDIA’s two-Spark vLLM playbook does it with vLLM's run_cluster.sh script: it downloads a pinned copy, changes it to install Ray inside the NVIDIA container, and starts a head container and a worker container. The server is then started once, on the head:

vllm serve ORG/MODEL --tensor-parallel-size 2 \
  --distributed-executor-backend ray \
  --host localhost

--host localhost keeps the server to this Spark. Without it, vLLM listens on every network the Spark is on, with no password. To reach it from your computer, open an SSH tunnel and use http://localhost:8000/v1:

ssh -N -L 8000:localhost:8000 USER@my-spark.local

Those containers are a separate Ray cluster from the one set up above: run one or the other, not both.

Add the protections yourself. When we read it on 26 November, the playbook's start commands did not turn token authentication on, and its multi-switch section gives a dashboard address that uses the head's network address. Do not open the dashboard to your network. The script passes extra Docker options through, so a token setting and a read-only mount of the token file can be added to both nodes, using Ray's token settings. We have not tested that combination.

vLLM also says traffic between nodes is unencrypted and could be abused to run code, so the private link still matters.

Stop and undo

How to stop Ray, and remove it.

ray stop ends all Ray processes on that machine, including any other Ray work you have there.

To stop: finish or cancel your jobs, stop the worker first, then the head. For the playbook's containers, stop each container instead.

ray stop

To undo: remove the environment and the token on both Sparks. Close any firewall openings you made.

Deleting is final. If you use the same token file for another Ray setup, keep it.

deactivate
rm -r ~/ray-env
rm ~/.ray/auth_token

Problems

If the Ray worker will not join.

What you seeWhat to try
Unable to connect to GCSRay lists: head not running, different Ray versions, wrong address, or a firewall. Check port 6379 over the link.
Authentication token not found or invalidThe same token file on both, and RAY_AUTH_MODE=token in the shell that runs the command.
Only one node in ray statusRead the worker's output. Check its --node-ip-address and the two-way firewall.
No GPU listedCheck nvidia-smi on that node, then Ray's start log.

More: cluster problems by symptom.

Next

Keep going.

About Server AI Hub

Server AI Hub is our app for looking after a DGX Spark. You do not need it to follow this playbook. It is coming soon to the App Store and the Microsoft Store.

See what Server AI Hub does

Sources

Check the makers’ own pages.

Read on 26 November 2026, and again on 27 November 2026 for decisions, settings and sharing work. These projects change often; if their pages differ from this one, follow them.

General guidance only, in our own words. Back up before you start; you use these steps at your own risk. NVIDIA, DGX, DGX Spark, ConnectX and CUDA are trademarks of NVIDIA Corporation; Kubernetes, K3s, Ray, PyTorch, vLLM, SGLang, NGINX, Docker and other names belong to their owners. 6ixLabs is not affiliated with or endorsed by NVIDIA or any of these projects.