Skip to main content

Command-line interfaces

Tomii has two command-line entry points: the Python module (python -m tomii) for inspection, schema, and visualization, and the Rust runner binary that executes graphs. The Python Graph.run() method constructs a runner invocation for you (see running); this page documents both interfaces directly.

python -m tomii

Flag definitions live in tomii/__main__.py. Exactly one subcommand flag is processed per invocation.

FlagArgumentsDescription
--list-knobsHuman-readable list of graph.run() options (also the default with no arguments, and the output of --help)
--list-knobs-jsonMachine-readable JSON knob catalog (see knob catalog)
--knob-space[graph.json] [--workload NAME]Versioned tuning search space; with a graph, adds per-graph knobs to the catalog's perf knobs
--schemaJSON schema for graph construction parameters
--dumpgraph.json [--out FILE]Emit graph topology as GraphViz DOT (to stdout, or to FILE with --out)
--visualizegraph.json [--edit] [--ascii] [--port N]Interactive graph viewer

--visualize modes:

InvocationMode
--visualize graph.jsonView (read-only, browser)
--visualize graph.json --editEdit (save back to the file)
--visualize new.jsonCreate (file does not exist yet)
--visualize graph.json --asciiTerminal box-drawing art
--visualize graph.json --port 8080Custom web-server port

--dump emits topology only. Runtime state snapshots come from the runner binary's --dump-state flag, described below.

Runner binary

The runner is built by cargo build -p tomii-core (binary main). Flag definitions live in tomii-core/src/bin/main.rs.

cargo run -p tomii-core --bin main -- \
--json /path/to/graph.json \
--dylib /path/to/plugin.so \
--workers 4 \
--core-offset 1 \
--max-runtime 60

Core flags

FlagType / defaultDescription
--json FILEstring, requiredGraph JSON file
--dylib FILEstring, requiredPlugin library (.so)
--workers Nint, 1Worker (Rayon) threads
--core-offset Nint, 1First CPU to pin workers to
--system-threads Nint, 1Resolution threads
--receiver-threads Nint, 1Dedicated network receiver threads
--slots Nint, 1Concurrent in-flight frames
--max-frames Nint, 1Total frames to process
--max-runtime SECSint, 0Stop after this many seconds; 0 = no time limit

Scheduling flags

FlagType / defaultDescription
--fifobool, offFIFO scheduler instead of the default work-stealing one
--custombool, offCustom lock-free priority scheduler
--batching-size Nint, 1Completed tasks to batch before processing
--batching-limit USint, 10Maximum time to wait for a batch, in microseconds
--slot-prioritybool, offProcess slots sequentially with automatic round-robin
--coalesce-barriersbool, offCoalesce barrier fan-outs into bulk tasks (min(N, workers) tasks instead of N)
--inline-continuationbool, offRun one ready successor inline on the completing worker instead of spawning it
--no-fanout-bulkbool, offDisable 1:1 fanout-bulk dispatch; bit-identical to the per-cell path, for correctness verification
--resolution-strategy Sstring, multi-slot-batchBatch resolution strategy; multi-slot-batch is the only available value

--coalesce-barriers targets fine-grained workloads where per-task compute is far below spawn overhead (e.g. wavefront); it serializes coarse-grained tasks, so leave it off for MIMO-style graphs. --inline-continuation removes a scheduler round-trip for chain-dominant graphs (factor 1 chains) and must likewise stay off for coarse-grained workloads. Tuning guidance for these flags lives in knobs.

Output and diagnostics flags

FlagType / defaultDescription
--output FILEstring, stdoutRedirect stdout to a file
--timing FILEstring, unsetPer-node timing CSV
--report FILEstring, unsetJSON performance report
--recordbool, offScheduler event recording
--record-frame IDint, unsetRecord only one frame (memory optimization)
--exclude-frames Nint, 0Exclude the first N frames from timing statistics
--use-rdtscbool, offRDTSC-based timing (x86)
--debugbool, offDebug-level logging (RUST_LOG overrides it)
--initsbool, offPrint initializations to stdout
--dump-state FILEstring, unsetRuntime state snapshot (JSON) at shutdown

The pre-rename spellings --max-streams, --record-stream, and --exclude-streams still parse as hidden aliases of the --*-frame(s) flags above, so existing scripts keep working.

With --dump-state FILE set, the binary writes a JSON snapshot of per-slot runtime state to FILE at shutdown. On Unix, sending SIGUSR1 to the running process additionally writes numbered live snapshots (FILE.1, FILE.2, ...) — useful for diagnosing wedged runs. See observability.

Low-level tuning flags

FlagType / defaultDescription
--batch-queue-capacity Nint, 65536Capacity of the lock-free task-completion ring buffer
--spin-iterations Nint, 32Spin iterations before blocking recv in resolution threads
--sched-flush-threshold Nint, 32Flush accumulated successors to workers every N items during batch processing
--socket-recv-buf-bytes BYTESint, 16777216UDP socket kernel receive buffer size
--recv-pool-size Nint, 1024Pre-allocated packet buffers per receiver thread
--spin-wait-spin-iters Nint, 64spin_loop() iterations before switching to yield_now()
--spin-wait-yield-iters Nint, 256yield_now() iterations before switching to park_timeout()
--spin-wait-park-ns NSint, 100park_timeout() duration in nanoseconds

The subset of flags exposed as tuning knobs through the Python API — with roles, domains, and search hints — is cataloged in the knob catalog. Environment variables read by the binary and the build are listed in environment variables.