命令行工具
tnpath 用于收缩序优化与保存,tnexec 用于加载或生成收缩序并执行,tnmpi 用于启用 MPI 功能后的分布式切片执行。
本页目录
tnpath
cargo run --release --bin tnpath -- \
network.net.json --method auto --preset heavy --seed 0 \
--save-path plan.json
| 参数 | Light / Heavy 中的含义 |
|---|---|
| --preset | light 或 heavy |
| --max-time | 搜索时间限制,单位为秒;在算法检查点生效 |
| --flops-weight / --read-write-weight | FLOPs 和读写量的目标权重 |
| --target-size | 固定路径切片;命令行 Light / Heavy 接口目前不支持 Dynamic 模式 |
| --trials | 不适用于 Light / Heavy;搜索预算由所选模式决定 |
--method 可选 auto、greedy、rgreedy、reconf、bisect、budget、optimal、temper、stemper、treesa、orderdp、import 与 all。不同方法支持的参数不同,详见 tnpath --help。
tnexec
cargo run --release --bin tnexec -- \
--net network.net.json --load-path plan.json \
--single --check
--single 表示使用单精度浮点数,不是单线程;省略时使用双精度。--check 对规模允许的任务进行数值对照。
tnpath --save-path 保存第 2 版收缩序文件,其中包含网络结构、收缩序和切片信息。tnexec 可以读取第 1 版和第 2 版文件,但都需要通过 --net 提供网络;读取第 2 版时,还会核对文件中的网络与传入网络是否一致。没有格式标识的旧文件需要显式传入 --allow-legacy-plan 才会读取。由 tnexec 生成路径时,只能选择 greedy 或 random-greedy,不运行 Light / Heavy 搜索。
tnmpi
cargo build --release --features mpi --bin tnmpi
mpirun -n 8 target/release/tnmpi \
--load-path plan.json --data tensors.bin
- 把不同切片取值对应的任务分配给各 MPI 进程,不拆分单个张量。
- 读取已有收缩序和切片集合,不重新搜索。
--dtype支持f32、f64、complex64和complex128,默认f64;输入文件格式见 MPI 执行。 - 收缩序文件可由
arctn_plan(...).save(...)或tnpath --save-path生成。 - 严格的运行时间上限由作业调度器或外部超时控制实现。