---
title: "Command-line tools"
description: "Use tnpath to plan and save paths, tnexec to load or generate paths and execute contractions, and the MPI-enabled tnmpi for distributed sliced execution."
eyebrow: "API reference"
---

## tnpath {#tnpath}

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

| Argument | Meaning for Light / Heavy |
| --- | --- |
| --preset | light or heavy |
| --max-time | Search time limit in seconds, checked at algorithm checkpoints |
| --flops-weight / --read-write-weight | Objective weights for FLOPs and memory traffic |
| --target-size | Fixed-path slicing; the Light / Heavy command-line interface does not currently support Dynamic mode |
| --trials | Does not apply to Light / Heavy; the chosen mode determines the search budget |

`--method` accepts auto, greedy, rgreedy, reconf, bisect, budget, optimal, temper, stemper, treesa, orderdp, import, and all. Supported parameters vary by method; see `tnpath --help`.

## tnexec {#tnexec}

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

`--single` selects single-precision floating point, not single-threaded execution; omitting it selects double precision. `--check` performs a numerical cross-check for problems small enough to permit it.

`tnpath --save-path` writes a version 2 plan file containing network structure, path, and slicing information. `tnexec` reads version 1 and version 2 files, but both require a network supplied through `--net`; version 2 also checks that the saved network matches the supplied one. Older files without a format identifier require explicit `--allow-legacy-plan`. When `tnexec` generates a path itself, it supports only greedy or random-greedy search, not Light / Heavy.

## tnmpi {#tnmpi}

```bash
cargo build --release --features mpi --bin tnmpi
mpirun -n 8 target/release/tnmpi \
  --load-path plan.json --data tensors.bin
```

- Distribute tasks for different slicing-index values across MPI processes; individual tensors are not partitioned.
- Load an existing path and slicing set without searching again. `--dtype` supports `f32`, `f64`, `complex64`, and `complex128`, defaulting to `f64`; see [MPI execution](/docs/mpi#run) for input-file formats.
- Create the plan file with `arctn_plan(...).save(...)` or `tnpath --save-path`.
- Enforce a strict wall-time limit through a job scheduler or external timeout.
