当前位置: 首页 > news >正文

NVIDIA Dynamo源码编译

Ref

https://github.com/PyO3/maturin

Rust 程序设计语言

代码库:

https://github.com/ai-dynamo/dynamo

https://github.com/ai-dynamo/nixl

dynamo/container/Dockerfile.vllm

相关whl包

官方提供了4个whl包

ai_dynamo # 这个包ubuntu 22.04也可以用,ubuntu 24.04可以直接安装不用重新编译。包含的是sdk部分。绝大多数是Python,少量bin。

ai_dynamo_runtime # 包含llm和runtime部分

ai_dynamo_vllm # VLLM的修改版本,有DynamoNixlConnector作为kv_connector, 还有KvMetrics的发送。apply container/deps/vllm/vllm_v0.7.2-dynamo-kv-disagg-patch.patch to vLLM[v0.7.2] source code

nixl # 通信库

上述包可以直接基于pip install在pypi上下载和安装。但是需要ubuntu 24.04系统。

构建ai_dynamo

Install uv: uv

curl -LsSf https://astral.sh/uv/install.sh | sh

在顶层目录:

uv build --wheel --out-dir /workspace/dist

构建ai_dynamo_runtime

参考https://github.com/ai-dynamo/dynamo/tree/main/lib/bindings/python

下载rust环境:

国内服务器最好设置环境变量,否则rustup-init.sh运行时的下载极其慢:

export RUSTUP_DIST_SERVER='https://mirrors.ustc.edu.cn/rust-static'
export RUSTUP_UPDATE_ROOT='https://mirrors.ustc.edu.cn/rust-static/rustup'
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
wget https://static.rust-lang.org/rustup/rustup-init.sh
./rustup-init.sh

安装依赖:

这里假设你已经有一个Python conda环境,否则可以安装miniconda设置环境,或者按照推荐使用uv环境。

pip install maturin
apt install protobuf-compiler

下载源码:

git clone --recursive https://github.com/ai-dynamo/dynamo.git
git clone --recursive https://github.com/ai-dynamo/nixl.git

在目录dynamo/lib/bindings/python运行

maturin build

即可在target/wheels/生成whl包。

或者:

uv build --wheel --out-dir /workspace/dist

构建nixl

依赖安装

sudo apt install -y build-essential cmake pkg-config
pip install meson ninja pybind11

在nixl源码目录执行(路径根据你的需求修改):

INSTALL_DIR=/root/nixl
UCX_INSTALL_DIR=/root/ucx

./util/build.sh $INSTALL_DIR $UCX_INSTALL_DIR

或者参考readme.md和util/build.sh分别构建ucx和nixl

首先构建ucx

wget https://github.com/openucx/ucx/releases/download/v1.18.0/ucx-1.18.0.tar.gz
tar xzf ucx-1.18.0.tar.gz
cd ucx-1.18.0
./contrib/configure-release --prefix=/root/ucx
make -j8
make install

构建nixl wheel包

在nixl源码路径,设置编译好的ucx路径

ref https://mesonbuild.com/meson-python/how-to-guides/meson-args.html

python -m pip wheel --config-settings=setup-args="-Ducx_path=/root/ucx" .
# or 
pip install build
python -m build -Csetup-args="-Ducx_path=/root/ucx" .

 或者:

uv build --wheel --out-dir /workspace/dist

构建ai_dynamo_vllm

下载VLLM 0.7.2的分支,然后打patch dynamo\container\deps\vllm\vllm_v0.7.2-dynamo-kv-disagg-patch.patch,然后源码编译VLLM。

相当于直接编译VLLM,参考vllm doc和其他博客

Installation — vLLM

https://github.com/vllm-project/vllm/blob/main/.github/workflows/scripts/build.sh 

https://zhuanlan.zhihu.com/p/692200573

# for cuda12.1, pytorch 2.5.1
# v0.0.28.post3 build for PyTorch 2.5.1
pip3 install -U xformers==v0.0.28.post3 --index-url https://download.pytorch.org/whl/cu121
git clone --recursive -b v0.7.2 https://github.com/vllm-project/vllm.git
git apply dynamo/container/deps/vllm/vllm_v0.7.2-dynamo-kv-disagg-patch.patch

python setup.py bdist_wheel

注意事项

需要确保你的网络通畅,否则编译过程下载各种代码库和软件包失败导致编译失败。

相关文章:

  • 《K230 从熟悉到...》图像获取+FPS
  • 【工具变量】全国地级市地方ZF债务数据集(2014-2023年)
  • JAVA学习*接口
  • Python连接StarRocks全流程实践: SQL文件调用与Pandas混合优化
  • 第16章:基于CNN和Transformer对心脏左心室的实验分析及改进策略
  • Kotlin的 noinline和crossinline关键字
  • k8s的核心组件整理
  • 多阶段构建实现 Docker 加速与体积减小:含文件查看、上传及拷贝功能的 FastAPI 应用镜像构建
  • Android 接 Twitter Share ,常见问题及解决方案
  • 流畅如丝:利用requestAnimationFrame优化你的Web动画体验
  • 基于Web大学生创新服务平台(源码+lw+部署文档+讲解),源码可白嫖!
  • 摄影工作室预约管理系统基于Spring BootSSM
  • Sympy入门之微积分基本运算
  • 【中间件】Rabbit离线部署操作
  • windows单节点验证victoriametrics结合AlertManger实现告警推送webhook
  • 对接马来西亚、印度、韩国、越南等全球金融数据示例
  • 个人作品集模板!除了Figma还可以选择什么软件?
  • neo4j-如何让外部设备访问wsl中的neo4j
  • Python 类与对象概念全解析:从零到实战
  • Ubuntu上安装Docker
  • 特朗普公开“怼”库克:苹果不应在印度生产手机
  • 铁路端午假期运输火车票今日开售,12306提升应对超大规模并发访问需求能力
  • 美联储主席:供应冲击或更频繁,将重新评估货币政策方法中的通胀和就业因素
  • 中办、国办关于持续推进城市更新行动的意见
  • 诠释微末处的丰盈:“上海制造佳品汇”首届海外专场即将亮相日本大阪
  • 陕西一村民被冒名贷款40余万续:名下已无贷款,将继续追责