Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ This guide covers Ubuntu and macOS. For a containerized dev environment that han
sudo apt install -y build-essential libhwloc-dev libudev-dev pkg-config libclang-dev protobuf-compiler python3-dev cmake
```

Dynamo needs `protoc` 3.15 or newer:

- **Ubuntu 24.04:** the `protobuf-compiler` package above is enough.
- **Ubuntu 22.04:** also install protoc 30.2 from the protobuf releases:

```bash
sudo apt install -y unzip
PROTOC_ZIP="protoc-30.2-linux-$(uname -m | sed s/aarch64/aarch_64/).zip"
curl -fsSLO "https://github.com/protocolbuffers/protobuf/releases/download/v30.2/${PROTOC_ZIP}"
unzip -o "${PROTOC_ZIP}" -d "$HOME/.local"
rm "${PROTOC_ZIP}"
export PATH="$HOME/.local/bin:$PATH"
protoc --version
```

**macOS:**

```bash
Expand All @@ -42,10 +57,10 @@ Install [uv](https://docs.astral.sh/uv/#installation) if you don't have it:
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Create and activate a virtual environment:
Create and activate a Python 3.12 virtual environment. If Python 3.12 is not installed, uv downloads it.

```bash
uv venv .venv
uv venv --python 3.12 .venv
source .venv/bin/activate
```

Expand All @@ -59,11 +74,22 @@ uv pip install pip 'maturin[patchelf]'

## 5. Build the Rust Bindings

Run one of these builds:

```bash
cd lib/bindings/python

# Minimal build
maturin develop --uv

# Build with the same features as the release wheels
maturin develop --uv --features kv-indexer,slot-tracker,select-service,mm-routing,ais-forward-pass,request-trace-s3
Comment thread
alec-flowers marked this conversation as resolved.
Resolved
```

The minimal build leaves out the [release wheel](https://github.com/ai-dynamo/dynamo/blob/main/container/templates/wheel_builder.Dockerfile) features: the standalone KV indexer, slot tracker and select service (some router tests start these), multimodal KV routing, the AISimulate perf model and S3 request traces.

To annotate Nsight Systems profiles, add `nvtx` to the feature list.

## 6. Install GPU Memory Service

```bash
Expand Down Expand Up @@ -123,6 +149,14 @@ If `maturin develop` fails with linker errors, verify all system dependencies ar
sudo apt install -y build-essential libhwloc-dev libudev-dev pkg-config libclang-dev protobuf-compiler python3-dev cmake
```

**`protoc failed: relay.proto: This file contains proto3 optional fields`**

Install protoc 30.2 as shown in step 1, then check that `protoc --version` prints `libprotoc 30.2`.

**`dynamo.indexer is not available in this build`**

Rebuild the bindings with the release-wheel `--features` list from step 5.

**Virtual environment not activated**

Maturin builds against the active Python interpreter. If you see errors about Python or site-packages, ensure your virtual environment is activated:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ description: 从源代码构建 Dynamo,用于开发和贡献
sudo apt install -y build-essential libhwloc-dev libudev-dev pkg-config libclang-dev protobuf-compiler python3-dev cmake
```

Dynamo 需要 `protoc` 3.15 或更高版本:

- **Ubuntu 24.04:** 上面的 `protobuf-compiler` 软件包即可。
- **Ubuntu 22.04:** 还需从 protobuf releases 安装 protoc 30.2:

```bash
sudo apt install -y unzip
PROTOC_ZIP="protoc-30.2-linux-$(uname -m | sed s/aarch64/aarch_64/).zip"
curl -fsSLO "https://github.com/protocolbuffers/protobuf/releases/download/v30.2/${PROTOC_ZIP}"
unzip -o "${PROTOC_ZIP}" -d "$HOME/.local"
rm "${PROTOC_ZIP}"
export PATH="$HOME/.local/bin:$PATH"
protoc --version
```

**macOS:**

```bash
Expand All @@ -42,10 +57,10 @@ source $HOME/.cargo/env
curl -LsSf https://astral.sh/uv/install.sh | sh
```

创建并激活虚拟环境:
创建并激活 Python 3.12 虚拟环境。如果没有安装 Python 3.12,uv 会自动下载。

```bash
uv venv .venv
uv venv --python 3.12 .venv
source .venv/bin/activate
```

Expand All @@ -59,11 +74,22 @@ uv pip install pip 'maturin[patchelf]'

## 5. 构建 Rust 绑定

任选以下一种构建方式:

```bash
cd lib/bindings/python

# Minimal build
maturin develop --uv

# Build with the same features as the release wheels
maturin develop --uv --features kv-indexer,slot-tracker,select-service,mm-routing,ais-forward-pass,request-trace-s3
```

最小构建不包含[发布版 wheel](https://github.com/ai-dynamo/dynamo/blob/main/container/templates/wheel_builder.Dockerfile) 的以下 features:独立的 KV indexer、slot tracker 和 select service(部分 router 测试会启动它们)、多模态 KV 路由、AISimulate 性能模型以及 S3 请求追踪。

如需在 Nsight Systems profile 中添加标注,请在 feature 列表中加上 `nvtx`。

## 6. 安装 GPU Memory Service

```bash
Expand Down Expand Up @@ -123,6 +149,14 @@ pre-commit run --all-files
sudo apt install -y build-essential libhwloc-dev libudev-dev pkg-config libclang-dev protobuf-compiler python3-dev cmake
```

**`protoc failed: relay.proto: This file contains proto3 optional fields`**

按第 1 步安装 protoc 30.2,然后确认 `protoc --version` 输出 `libprotoc 30.2`。

**`dynamo.indexer is not available in this build`**

使用第 5 步中发布版 wheel 的 `--features` 列表重新构建绑定。

**虚拟环境未激活**

Maturin 会针对当前激活的 Python 解释器进行构建。如果你看到与 Python 或 site-packages 相关的错误,请确保虚拟环境已激活:
Expand Down
Loading