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
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Languages: English | [简体中文](docs/sphinx/source/zh_CN/4-developer_guide/4

1. Fork and clone the repository.
2. Install dependencies for your platform:
- macOS (MPS, installs PyPI torch wheels): `make setup-motrix` (or `make setup-mujoco`)
- macOS (MPS, installs PyPI torch wheels): `uv sync --extra motrix` (or `uv sync --extra mujoco`)
- Linux default (installs PyTorch cu130 wheels; requires an NVIDIA GPU/driver supported by current PyTorch cu130 wheels): `make setup`
- Linux AMD / ROCm workstation: `make sync-rocm`, then run commands with `uv run --no-sync ...`
- For direct uv setup, use `uv sync --extra mujoco --extra motrix`; replace it
with `--extra mujoco` or `--extra motrix` for a single backend
- Physics adapters are supplied by the production PyPI package
`unisim-core>=0.1.14` (import namespace `unisim`).
- Physics adapters are supplied by the pinned production PyPI package
`unisim-core` (import namespace `unisim`).
3. Create a branch such as `git checkout -b docs/improve-readme` or `git checkout -b fix/backend-bug`.

## Development Rules
Expand All @@ -34,7 +34,7 @@ Languages: English | [简体中文](docs/sphinx/source/zh_CN/4-developer_guide/4

```bash
make format # ruff format + ruff check --fix
make sync-rocm # Linux AMD / ROCm >= 7.1: sync deps and install torch==2.11.0+rocm7.2
make sync-rocm # Linux AMD / ROCm: sync the ROCm dependency track
make type # mypy src/unilab + pyright
make check # format + type (required before code-related commits)
make test # non-slow tests
Expand Down Expand Up @@ -64,7 +64,7 @@ under the bilingual subsections `### Added / 新增`, `### Changed / 变更`, or
`### Fixed / 修复` (create the subsection when it is missing). Entries follow
the released-version style below: English prose first, then the Chinese
translation, with the driving GitHub issue or PR linked (for example
`([#706](https://github.com/Motphys/UniLab/issues/706))`). Purely internal
`([#706](https://github.com/unilabsim/UniLab/issues/706))`). Purely internal
changes (refactors, test-only, or CI plumbing) may skip the changelog. Release
maintainers rename `## Unreleased` to the version number and PyPI upload date
at release time.
Expand Down
17 changes: 14 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,29 @@ uv run --extra genesis eval --algo flashsac --task g1_motion_tracking --sim gene
```

使用 MPS 时,先为每张选中的 GPU 手动启动服务,在训练命令后追加
`training.cuda_process_sharing=mps`,训练结束后再手动关闭。例如 GPU 0、1:
`training.cuda_process_sharing=mps`,训练结束后再手动关闭。
`uv run uni-cumps status` 可随时列出可见 GPU 和所有已登记服务。例如 GPU 0、1:

```bash
uv run uni-cumps status # 可见 GPU + 已登记服务
uv run uni-cumps start --gpus 0 --name train-gpu0 --daemon
uv run uni-cumps start --gpus 1 --name train-gpu1 --daemon
CUDA_VISIBLE_DEVICES=0,1 \
uv run --extra mjwarp train --algo flashsac --task g1_motion_tracking --sim mjwarp \
training.cuda_process_sharing=mps
# 执行训练,等训练进程退出后,仅关闭上述服务。
uv run uni-cumps stop --name train-gpu0
uv run uni-cumps stop --name train-gpu1
uv run uni-cumps stop --name train-gpu0 # 或:stop --gpus 0
uv run uni-cumps stop --name train-gpu1 # 或:stop --gpus 1
```

`stop` 可按 `--name`、`--gpus` 选择,或在恰好有一个存活服务时隐式选择;
`stop --all` 会停止当前用户在这台主机上的所有已登记服务。启动时若不指定
`--name`,服务名为 `gpu-<full-uuid>`;`status` 会打印每个已登记名称及其 GPU。
UniLab 只停止自己登记的服务(记录位于 `~/.cache/unilab/cuda-mps/`)。如果控制
daemon 比其记录存活更久,请手动退出,例如
`echo quit | CUDA_MPS_PIPE_DIRECTORY=/tmp/uni-cumps/<name>/pipe CUDA_MPS_LOG_DIRECTORY=/tmp/uni-cumps/<name>/log nvidia-cuda-mps-control`,
然后删除对应的 `/tmp/uni-cumps/<name>` 目录。

请求 `mps` 后,每个 rank 会自动绑定本 GPU 已登记的服务(索引形式的
`CUDA_VISIBLE_DEVICES` 会在 CUDA 初始化前被规范为 per-GPU MPS 服务要求的 GPU
UUID);`uni-cumps env` 仅供外部启动器使用——训练前不要 `eval` 它,它会把可见性
Expand All @@ -134,6 +144,7 @@ recipe,同时消费同一套 task、backend 和 RL contract。目前的下游
- [Sharpa](https://github.com/unilabsim/sharpa_rl_unilab)
- [MicroDuck RL](https://github.com/unilabsim/microduck_rl_unilab)
- [EngineAI RL](https://github.com/unilabsim/engineai_rl_unilab)
- [Unitree RL](https://github.com/unilabsim/unitree_rl_unilab)
- [Wuji](https://github.com/unilabsim/wuji_unilab)
- [Legged Manipulation](https://github.com/unilabsim/legged-manipulation_unilab)
- [Cricket-Gym](https://github.com/kishanpb/Cricket-Gym-Unilab)
Expand Down
13 changes: 7 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# UniLab Documentation

UniLab 的全部文档源码统一在 [`docs/sphinx/`](sphinx/) 下,通过 Sphinx 构建,部署到
<https://unilabsim.github.io/UniLab-doc/>。站点按版本子路径发布(当前仅 `main/`,
如 `/UniLab-doc/main/en/0-index.html`),根路径自动重定向到 `main/`。
UniLab 的 Sphinx 站点文档源码统一在 [`docs/sphinx/`](sphinx/) 下,通过 Sphinx 构建,部署到
<https://unilabsim.github.io/UniLab-doc/>。站点按版本子路径发布
(如 `/UniLab-doc/main/en/0-index.html`),根路径自动重定向到 `main/`。

发布入口:

Expand Down Expand Up @@ -32,9 +32,10 @@ UniLab 的全部文档源码统一在 [`docs/sphinx/`](sphinx/) 下,通过 Sphin

```bash
cd docs/sphinx
uv pip install -r requirements.txt
make html # 一次性构建
make live # sphinx-autobuild,自动 reload
# 跳过 autodoc 的散文页构建
UNILAB_DOCS_SKIP_AUTODOC=1 uv run --no-project --with-requirements requirements.txt sphinx-build -b html -n source build/html
# sphinx-autobuild,自动 reload
UNILAB_DOCS_SKIP_AUTODOC=1 uv run --no-project --with-requirements requirements.txt sphinx-autobuild --watch ../../src source build/html -n
```

详细构建与部署流程见 [`docs/sphinx/README.md`](sphinx/README.md)。
Expand Down
9 changes: 5 additions & 4 deletions docs/flashsac_dp.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ This change ports the measured FlashMimic multi-GPU optimization to UniLab
1.5.0 (`03b75353`) with UniSim 2.1.0 (`6994cd1`). The intended PR base is `main`.
The requested scope is default DP graph execution and optional BF16 gradient
communication; the existing runner owns process lifecycle and synchronization.
No new runner or backend protocol is introduced. Communication remains FP32;
DP graphs default on, with explicit opt-out. The actor/temperature fusion experiment is excluded because
No new runner or backend protocol is introduced. Communication defaults to FP32,
with an explicit BF16 wire-precision option; DP graphs default on, with explicit
opt-out. The actor/temperature fusion experiment is excluded because
it did not provide a stable throughput improvement.

The proposed contract is recorded in
Expand Down Expand Up @@ -70,5 +71,5 @@ normalizes index-form visibility entries to GPU UUIDs before CUDA initializes
After training clients exit, stop each service with
`uv run uni-cumps stop --name train-gpu0`. The default `null` uses independent
CUDA contexts. Training does not start or stop services. README documents the
complete examples and optional env, batch, iteration, and transport overrides.
Full repository and current-head remote CI gates remain required before merge.
complete launch and MPS examples. Full repository and current-head remote CI
gates remain required before merge.
72 changes: 38 additions & 34 deletions docs/sphinx/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# UniLab Sphinx Documentation

UniLab 的文档源码全部在这里,**双语平行结构**——`source/en/` 是英文版,`source/zh_CN/`
是中文版,`adr/`、`api_reference/`、`glossary.md`、`changelog.md`、`_static/` 共享。
UniLab 的文档源码全部在这里,采用**双语平行结构**——`source/en/` 是英文版,
`source/zh_CN/` 是中文版,`adr/`、`api_reference/`、`glossary.md`、`changelog.md`、
`_static/` 共享。两语言使用相同的编号顶层结构,但不要求每个页面路径严格 1:1 镜像。

CI 在 push to `main` 时用 sphinx-multiversion 构建 Sphinx,通过 deploy key 推到独立仓
[`unilabsim/UniLab-doc`](https://github.com/unilabsim/UniLab-doc) 的 `gh-pages` 分支,
Expand All @@ -18,33 +19,38 @@ docs/sphinx/
├── requirements.txt ← Sphinx + 扩展依赖,不含 unilab 本身
└── source/
├── conf.py ← Sphinx 配置
├── index.md ← 根 landing(语言 picker)
├── index.md ← 根 redirect → en/0-index.html
│
├── _static/ ← 共享:CSS / 图片 / 视频 / teaser
├── _templates/ ← 共享:autosummary 模板
├── _templates/ ← 共享:侧栏与 autosummary 模板
├── adr/ ← 共享:ADR(中英共用,中文为主)
├── api_reference/ ← 共享:autodoc 驱动(英文,从 src/ docstring 拉)
├── glossary.md ← 共享:术语表
├── changelog.md ← 共享
│
├── en/ ← 英文版
│ ├── index.md ← 英文站根
│ ├── user_guide/ ← getting_started / backends / algorithms / tasks / DR / terrain / manipulation / tooling
│ ├── developer_guide/ ← architecture / contracts / extending / contributing
│ ├── transfer/ ← sim_to_real / sim_to_sim / framework_migration
│ └── agents/ ← 占位,待写
│ ├── 0-index.md ← 英文站根
│ ├── 1-getting_started/
│ ├── 2-user_guide/
│ ├── 3-deployment/
│ ├── 4-developer_guide/
│ ├── 5-reference/ ← 共享资源的语言本地 wrapper
│ └── 6-how_to/
│
└── zh_CN/ ← 中文版
├── index.md ← 中文站根
├── user_guide/ ← 01-getting-started / 02-simulation-backends / ... / A-E 速查
├── developer_guide/ ← development-standard / collaboration / domain-randomization-contract / ...
├── transfer/ ← 占位,待写
└── agents/ ← Agent 速查(中文,01-agent-quick-reference.md)
├── 0-index.md ← 中文站根
├── 1-getting_started/
├── 2-user_guide/
├── 3-deployment/
├── 4-developer_guide/
├── 5-reference/ ← 共享资源的语言本地 wrapper
└── 6-how_to/
```

URL 模式:`/`(重定向到 `main/en/0-index.html`)、`/main/en/...`、`/main/zh_CN/...`;
历史大版本在 `/<tag>/en/...`(如 `/v1.5.11/en/...`)。站点按
版本目录发布,版本目录内两种语言路径 1:1 镜像。
URL 模式:`/`(重定向到 `main/en/0-index.html`)、`/main/en/...`、
`/main/zh_CN/...`;历史版本在 `/<tag>/en/...`(如 `/v1.5.0/en/...`)。
站点按版本目录发布。语言切换器优先使用同路径页面;路径不镜像时使用 `conf.py`
的 `_LANGUAGE_PATH_FORWARD` 映射,未映射页面回退到目标语言首页。

## 本地构建

Expand Down Expand Up @@ -167,20 +173,18 @@ git push origin gh-pages

详细规则见 [`AGENTS.md`](AGENTS.md)。要点:

1. **双语平行**:英文进 `source/en/<section>/`,中文进 `source/zh_CN/<section>/`,**路径 1:1 镜像**(同名文件)
2. **共享内容**:ADR、API reference、glossary、changelog、`_static` 都在根目录共享,不写双语
3. **跨语言引用**:跨语言时用绝对路径 `/<lang>/<section>/<page>`,如 `{doc}`/zh_CN/user_guide/index``
4. **API 文档 = autodoc**:`api_reference/` 下页面只放 `automodule` / `autosummary`,不写手写表格
5. **图片放 `_static/`**:Sphinx 下用 `_static/assets/foo.png` 这种路径
6. **ADR 命名**:`ADR-NNNN-kebab-title.md`,挂到 `adr/README.md` 索引和各语言 developer_guide 的 ADR toctree

## 已知不全(框架已搭,内容待填)

- `source/en/user_guide/` 个别页面(中文等价物在 `zh_CN/user_guide/`)
- `source/en/developer_guide/architecture/`、`contracts/`、`extending/` 各页(中文等价物在 `zh_CN/developer_guide/`)
- `source/en/transfer/sim_to_real/` 个别页面
- `source/zh_CN/transfer/` 全部(等英文稳定后再翻)
- `source/en/agents/` 全部
- `source/en/agents/` 全部(中文版在 `source/zh_CN/agents/01-agent-quick-reference.md`)

中文版多数已有完整内容,可作为英文翻译底稿;反过来,英文 transfer 一节内容完整,可作为中文翻译底稿。
1. **双语平行**:英文进 `source/en/<section>/`,中文进 `source/zh_CN/<section>/`;
同主题优先保持同路径,但不要求两棵树严格 1:1 镜像。新增英文页面如有合适的中文
等价页,在 `conf.py` 的 `_LANGUAGE_PATH_FORWARD` 中登记映射。
2. **共享内容**:ADR、API reference、glossary、changelog、`_static` 都在根目录共享,
不写双语;语言侧栏通过 `5-reference/` 下的 wrapper 页面链接共享资源,不把共享
页面直接加入语言 toctree。
3. **跨语言引用**:跨语言时用绝对路径 `/<lang>/<section>/<page>`,如
`{doc}`/zh_CN/4-developer_guide/0-index``。
4. **API 文档 = autodoc**:`api_reference/` 下页面使用 `automodule` / `autoclass` /
`autosummary` 等指令;公共 API 的详细散文写在源码 docstring 中。
5. **图片放 `_static/`**:Sphinx 下用 `_static/assets/foo.png` 这种路径。
6. **ADR 命名**:`ADR-NNNN-kebab-title.md`,加入 `adr/ADR-0000-index.md` 索引;
中英文 `5-reference/4-adr.md` wrapper 只链接共享索引。

页面覆盖状态以各语言索引为准。
10 changes: 4 additions & 6 deletions docs/sphinx/source/adr/ADR-0000-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ orphan: true
| [ADR-0007 UniSim Extraction Boundary](ADR-0007-unisim-extraction-boundary.md) | Physics package extraction | Accepted |
| [ADR-0008 Debug Overlay Primitive Contract And Playback Session](ADR-0008-debug-overlay-primitive-contract-and-playback-session.md) | Debug overlay / playback session | Accepted |
| [ADR-0009 SuperDex Native C++ Scene Batch Executor](ADR-0009-superdex-persistent-cpu-workers.md) | Backend CPU scene execution | Accepted |
| [ADR-0010 Fixed Model Variant Ownership Boundary](ADR-0010-fixed-model-variant-ownership-boundary.md) | Fixed variants / cross-repository boundary | Proposed |
| [ADR-0011 Torch-Only Manager-Based Runtime](ADR-0011-torch-only-manager-based-runtime.md) | Manager runtime / tensor lifecycle | Accepted |
| [ADR-0010 Fixed Model Variant Ownership Boundary](ADR-0010-fixed-model-variant-ownership-boundary.md) | Fixed variants / cross-repository boundary | Accepted |
| [ADR-0011 Torch-Only Manager-Based Runtime](ADR-0011-torch-only-manager-based-runtime.md) | Manager runtime / tensor lifecycle | Superseded |
| [ADR-0012 Sole Tensor Manager And Scoped Backends](ADR-0012-sole-tensor-manager-and-scoped-backends.md) | Manager runtime / backend scope | Proposed |
| [ADR-0013 CUDA MPS Single-Rank Execution Sharing](ADR-0013-cuda-mps-single-rank-execution-sharing.md) | Training runtime / execution sharing | Proposed |
| [ADR-0014 CUDA MPS CLI Lifecycle Owner](ADR-0014-cuda-mps-cli-lifecycle-owner.md) | Training runtime / host tooling | Proposed |
| [ADR-0015 No Numba Runtime And Explicit NumPy Leaf Boundaries](ADR-0015-no-numba-and-explicit-numpy-leaf-boundaries.md) | Runtime dependency / NumPy boundary | Accepted |
| [ADR-0016 RL Reintegration Into unilab.rl And Single Distribution](ADR-0016-rl-reintegration-into-unilab-rl.md) | RL packaging / layer ownership | Proposed |
| [ADR-0017 FlashSAC Learner-Side Custom Actor Contract](ADR-0017-flashsac-learner-side-custom-actor-contract.md) | RL algorithm extension / checkpoint semantics | Proposed |
Expand Down Expand Up @@ -57,7 +59,3 @@ orphan: true
- 架构总览: {doc}`RL Infrastructure 开发标准 </zh_CN/4-developer_guide/0-index>`
- 后端能力和支持矩阵: {doc}`仿真后端 </zh_CN/2-user_guide/3-backends/0-index>`
- 协作流程与证据标准: {doc}`协作流程 </zh_CN/4-developer_guide/5-contributing_workflow>`

## Navigation

- Index: {doc}`Documentation </index>`
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
orphan: true
---

# ADR-0231 Integration-only K=1 MJWarp collector CUDA graph contract

语言: English
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/source/adr/ADR-TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ orphan: true

## Related Documents

- {doc}`ADR Index </adr/README>`
- {doc}`ADR Index </adr/ADR-0000-index>`
- {doc}`RL Infrastructure 开发标准 </zh_CN/4-developer_guide/0-index>`
50 changes: 3 additions & 47 deletions docs/sphinx/source/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,7 @@ orphan: true

语言: 简体中文

本目录记录 UniLab 的稳定架构决策。这里不跟踪阶段性执行状态,只记录已经落地并作为评审基线的 contract。
本页保留为旧链接入口。完整且持续维护的 ADR 列表与状态见
{doc}`ADR 索引 </adr/ADR-0000-index>`。

新增 ADR 使用 [ADR Template](ADR-TEMPLATE.md)。ADR 只记录已经或即将作为 review 基线的结构性决策,不记录阶段性执行状态。

## ADR 列表

| ADR | Layer / Topic | Status |
|-----|---------------|--------|
| [ADR-0001 Runtime Model And Layer Boundaries](ADR-0001-runtime-model-and-layer-boundaries.md) | Runtime / layering | Accepted |
| [ADR-0002 Backend Capability Boundary For Play And Snapshot](ADR-0002-backend-capability-boundary-for-play-and-snapshot.md) | Backend capability | Accepted |
| [ADR-0003 Task Owner And Config Compose Contract](ADR-0003-task-owner-and-config-compose-contract.md) | Config owner | Accepted |
| [ADR-0004 Registry Bootstrap Contract](ADR-0004-registry-bootstrap-contract.md) | Registry bootstrap | Accepted |
| [ADR-0005 Unified Obs Critic Env And IPC Contract](ADR-0005-unified-obs-critic-env-and-ipc-contract.md) | Observation / IPC | Accepted |
| [ADR-0006 Community Manager API On NumPy Runtime](ADR-0006-community-manager-api-on-numpy-runtime.md) | Manager API / NumPy runtime | Superseded |
| [ADR-0007 UniSim Extraction Boundary](ADR-0007-unisim-extraction-boundary.md) | Physics package extraction | Accepted |
| [ADR-0008 Debug Overlay Primitive Contract And Playback Session](ADR-0008-debug-overlay-primitive-contract-and-playback-session.md) | Debug overlay / playback session | Accepted |
| [ADR-0009 SuperDex Native C++ Scene Batch Executor](ADR-0009-superdex-persistent-cpu-workers.md) | Backend CPU scene execution | Accepted |
| [ADR-0010 Fixed Model Variant Ownership Boundary](ADR-0010-fixed-model-variant-ownership-boundary.md) | Fixed variants / cross-repository boundary | Proposed |
| [ADR-0011 Torch-Only Manager-Based Runtime](ADR-0011-torch-only-manager-based-runtime.md) | Manager runtime / tensor lifecycle | Superseded |
| [ADR-0012 Sole Tensor Manager And Scoped Backends](ADR-0012-sole-tensor-manager-and-scoped-backends.md) | Manager runtime / backend scope | Proposed |
| [ADR-0013 CUDA MPS Single-Rank Execution Sharing](ADR-0013-cuda-mps-single-rank-execution-sharing.md) | Training runtime / execution sharing | Proposed |
| [ADR-0014 CUDA MPS CLI Lifecycle Owner](ADR-0014-cuda-mps-cli-lifecycle-owner.md) | Training runtime / host tooling | Proposed |
| [ADR-0015 No Numba Runtime And Explicit NumPy Leaf Boundaries](ADR-0015-no-numba-and-explicit-numpy-leaf-boundaries.md) | Runtime dependency / NumPy boundary | Accepted |
| [ADR-0238 State-Update-Only CUDA Graph Boundary](ADR-0238-state-update-only-cuda-graph-boundary.md) | Manager runtime / CUDA graph pre-registration | Rejected / no-go |

## ADR Governance

每篇 ADR 应包含:

- `Status`
- `Date`
- `Owners`
- `Supersedes`
- `Superseded by`
- `Alternatives Considered`
- `Evidence In Repo`

当新 ADR 改写旧决策时,不直接删除旧 ADR;在旧 ADR 的 `Superseded by` 中指向新 ADR,并在新 ADR 的 `Supersedes` 中反向链接。

## 与主文档的关系

- 架构总览: {doc}`RL Infrastructure 开发标准 </zh_CN/4-developer_guide/0-index>`
- 后端能力和支持矩阵: {doc}`仿真后端 </zh_CN/2-user_guide/3-backends/0-index>`
- 协作流程与证据标准: {doc}`协作流程 </zh_CN/4-developer_guide/5-contributing_workflow>`

## Navigation

- Index: {doc}`Documentation </index>`
新增 ADR 使用 {doc}`ADR Template </adr/ADR-TEMPLATE>`,并加入上述索引。
Loading
Loading