You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document heterogeneous node groups for tasks (#4154)
* Document heterogeneous node groups for tasks
* Use node groups in Ray, Miles, and NCCL/RCCL examples
* Address review feedback on node groups docs
---------
Co-authored-by: Bihan Rana
Copy file name to clipboardExpand all lines: mkdocs/docs/concepts/tasks.md
+113-1Lines changed: 113 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,6 +179,118 @@ Jobs on each node communicate using their private IP addresses. Use `DSTACK_MAST
179
179
For convenience, `~/.ssh/config` is preconfigured with these options, so a simple `ssh <node_ip>` is enough.
180
180
For a list of nodes IPs check the `DSTACK_NODES_IPS` environment variable.
181
181
182
+
### Node groups
183
+
184
+
A task can define multiple node groups. Each group has its own `nodes` count,
185
+
`resources`, `commands`, and `ports`.
186
+
187
+
<div editor-title=".dstack.yml">
188
+
189
+
```yaml
190
+
type: task
191
+
name: ray-cluster
192
+
193
+
python: 3.12
194
+
195
+
groups:
196
+
- name: head
197
+
nodes: 1
198
+
commands:
199
+
- pip uninstall -y ray && pip install -U "ray[default]"
200
+
- ray start --head --port=6379 --block
201
+
resources:
202
+
cpu: 2
203
+
memory: 4GB..
204
+
ports:
205
+
- 8265
206
+
207
+
- name: workers
208
+
nodes: 2
209
+
commands:
210
+
- pip uninstall -y ray && pip install -U "ray[default]"
211
+
- ray start --address=${{ groups[0].nodes[0].IP_ADDRESS }}:6379 --block
212
+
resources:
213
+
gpu: H100:8
214
+
```
215
+
216
+
</div>
217
+
218
+
Commands in any group can reference the internal IP address of any node in the run via
219
+
`${{ groups[i].nodes[j].IP_ADDRESS }}`, where `i` is the index of the group in `groups` and `j` is
220
+
the index of the node within that group.
221
+
222
+
> `groups[0].nodes[0]` is the run's master node — it is what `DSTACK_MASTER_NODE_IP` resolves to.
223
+
224
+
Currently, only `resources`, `commands`, and `ports` can be configured per node group. [`groups`](../reference/dstack.yml/task.md#groups) and top-level `nodes` are mutually exclusive.Support for other properties is coming soon.
225
+
226
+
??? info "Prefill/decode example"
227
+
Node groups can mix CPU and GPU roles. This SGLang prefill/decode split uses a CPU
228
+
router (`groups[0]`, the master) and GPU workers. `startup_order: workers-first`
229
+
starts prefill and decode before the router.
230
+
231
+
<div editor-title=".dstack.yml">
232
+
233
+
```yaml
234
+
type: task
235
+
name: prefill-decode
236
+
image: lmsysorg/sglang:v0.5.10.post1
237
+
env:
238
+
- HF_TOKEN
239
+
- MODEL_ID=zai-org/GLM-4.5-Air-FP8
240
+
241
+
startup_order: workers-first
242
+
groups:
243
+
# Router (CPU) — master node; wires prefill + decode by IP
Copy file name to clipboardExpand all lines: mkdocs/docs/examples/clusters/nccl-rccl-tests.md
+69-50Lines changed: 69 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ This example shows how to run [NCCL](https://github.com/NVIDIA/nccl-tests) or [R
12
12
13
13
## Running as a task
14
14
15
-
Here's an example of a task that runs AllReduce test on 2 nodes, each with 4 GPUs (8 processes in total).
15
+
Here's an example of a task that runs AllReduce test on 2 nodes, each with 4 GPUs (8 processes in total), using [node groups](../../concepts/tasks.md#node-groups).
16
16
17
17
=== "NCCL tests"
18
18
@@ -22,33 +22,38 @@ Here's an example of a task that runs AllReduce test on 2 nodes, each with 4 GPU
0 commit comments