2025-12-12 01:52:53 -05:00
# Distributed utils
2025-12-10 20:15:03 +08:00
This directory (vllm_omni/distributed/ray_utils) contains utilities for distributed execution in vllm-omni, supporting both **Ray** and **Multiprocessing** backends.
2026-01-05 19:09:05 +08:00
## 1. Installation
```bash
pip install "ray[default]"
```
## 2. Ray Utils
2025-12-10 20:15:03 +08:00
The `ray_utils` module provides helper functions for managing Ray clusters and actors, which is essential for:
* * *Multi-node deployment**: Running pipeline stages across different physical machines.
* * *Resource management**: Efficient GPU/CPU allocation.
2026-01-05 19:09:05 +08:00
### 2.1 Basic Usage
2025-12-10 20:15:03 +08:00
To use the Ray backend, specify `worker_backend="ray"` when initializing the engine.
**Command Line Example:**
```bash
vllm serve Qwen/Qwen2.5-Omni-7B \
--omni \
--port 8091 \
--worker-backend ray \
--ray-address auto
```
2026-01-05 19:09:05 +08:00
### 2.2 Cluster Setup
2025-12-10 20:15:03 +08:00
**Step 1: Start Head Node**
Run this on your primary machine:
```bash
ray start --head --port= 6399
```
**Step 2: Connect Worker Nodes**
Run this on each worker machine:
```bash
ray start --address= <HEAD_NODE_IP>:6399
```
> **Tip**: For a complete cluster setup script, refer to the vLLM example:
> [run_cluster.sh](https://github.com/vllm-project/vllm/blob/main/examples/online_serving/run_cluster.sh)
2026-01-05 19:09:05 +08:00
### 2.3 Distributed Connector Support
2025-12-10 20:15:03 +08:00
When running on Ray, the system automatically adapts its communication strategy:
2026-02-24 11:13:52 +08:00
* **Cross-Node** : Recommended to use `MooncakeTransferEngineConnector` (RDMA, fastest) or `MooncakeStoreConnector` (TCP fallback).
2025-12-10 20:15:03 +08:00
* **Same-Node** : Can still use `SharedMemoryConnector` for efficiency, or Ray's native object store (plasma).
2026-07-22 09:44:15 +08:00
* **SHM payload routing** : `SharedMemoryConnector` always stores payloads in `/dev/shm` .
2025-12-10 20:15:03 +08:00
2026-01-05 19:09:05 +08:00
### 2.4 Internal Helpers
2025-12-10 20:15:03 +08:00
* ** `initialize_ray_cluster` **: Connects to an existing Ray cluster or starts a local one.
2026-01-05 19:09:05 +08:00
## 3. Troubleshooting
2025-12-10 20:15:03 +08:00
* **Connection Issues** : Ensure the Ray head node is accessible and ports (default 6399 in this example) are open.
* **Version Mismatch** : Ensure all nodes run the same version of Ray and Python.