---
title: "命令行工具"
description: "tnpath 负责寻路与保存计划，tnexec 负责加载或现场构造路径并执行，tnmpi 负责 feature-gated 分布式切片执行。"
eyebrow: "API Reference"
---

## tnpath {#tnpath}

```bash
cargo run --release --bin tnpath -- \
  network.net.json --method auto --preset heavy --seed 0 \
  --save-path plan.json
```

| 参数 | Auto 中的含义 |
| --- | --- |
| --preset | light 或 heavy |
| --max-time | cooperative 秒数上限 |
| --flops-weight / --read-write-weight | per-call objective |
| --target-size | 固定路径切片；CLI Auto 当前不暴露 dynamic mode |
| --trials | Auto 会拒绝；preset 自己解析预算 |

可选 method 包括 auto、greedy、rgreedy、reconf、bisect、budget、optimal、temper、stemper、treesa、orderdp、import 与 all。不同 method 的参数并不通用，应以 `tnpath --help` 为准。

## tnexec {#tnexec}

```bash
cargo run --release --bin tnexec -- \
  --net network.net.json --load-path plan.json \
  --single --check
```

`tnpath --save-path` 写入 self-contained execution-plan version 2。`tnexec` 可读取 version 1 和 version 2，但当前命令仍要求显式 `--net`，并会核对 embedded network 与当前网络；它不会因为 v2 自包含就跳过输入验证。schema-less legacy artifact 只有显式允许时才读取。`tnexec` 自己现场寻路时只提供 greedy / random-greedy，不等同于完整 Auto。

## tnmpi {#tnmpi}

```bash
cargo build --release --features mpi --bin tnmpi
mpirun -n 8 target/release/tnmpi \
  --net network.json --trials 32 --seed 1 \
  --target-size 1048576 --exec
```

- 通过 sliced assignments 向 ranks 分配工作，不拆分单个张量。
- 当前主执行路径是固定路径 `f64` sliced execution。
- 不是 distributed Light / Heavy Auto pathfinding。
- 没有内部严格 max\_time；由作业调度器或外部 timeout 控制。
