Io cpp bench default - #573
Conversation
Two changes toward using the native bench_engine as the default MORI-IO benchmark instead of the Python torchrun path: - bench_engine now emits perf records to $MORI_PERF_OUT as JSON lines in the exact schema tests/python/perf_report.py writes, so the C++ and Python benches feed one report pipeline (tools/perf/build_report.py). Captures per-iteration timing to report the Python bench's per-iteration metrics (avg/max bandwidth, avg/min latency) alongside the nixl whole-loop figure; no-op unless MORI_PERF_OUT is set, initiator-only, flock-appended. - run_internode_io_benchmark.sh takes --engine cpp|python (default cpp). The cpp path locates the built binary, sets LD_LIBRARY_PATH, and translates the torchrun rendezvous args (--master-addr/--host) to the C++ socket-bootstrap args (--master-ip/--self-ip). The python torchrun path is kept for parity. Both paths verified two-node on MI308X/ionic: matching bandwidth, byte-exact validation, and the emitted JSONL renders through build_report.py. Co-Authored-By: Claude <noreply@anthropic.com>
With the runner now defaulting to --engine cpp, wire the rest of the tree to match: - ci.yml: build bench_engine on both nodes before the internode IO steps, so the runner's cpp path has its binary. The IO steps already call the runner with no --engine, so they switch to C++ automatically. - nightly.yml: same build step; drop the now-redundant standalone C++ bench step (the write-sweep step covers it via the runner and emits perf records through the existing MORI_PERF_OUT wiring). The read smoke step keeps MORI_PERF_OUT cleared. - docs: MORI-IO-BENCHMARK.md now leads with the C++ benchmark and keeps Python as the parity alternative; README and MORI-IO-GUIDE point at the C++ default. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 499a401d2a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| payload << line.str(); | ||
| } | ||
|
|
||
| std::FILE* fh = std::fopen(out.c_str(), "a"); |
There was a problem hiding this comment.
Create the perf output directory before opening the file
On a clean nightly workspace, MORI_PERF_OUT is $GITHUB_WORKSPACE/_perf/perf.jsonl, but no step creates _perf before the MORI-IO write sweep. Unlike Python's record_perf, this implementation calls fopen without creating the parent, so it logs an error, continues successfully, and silently omits every IO row from the uploaded performance data. Create the parent directory before opening the file.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
"Fixed in c442590. WritePerfRecords now creates the parent directory before fopen (mkdir-p, matching Python's
os.makedirs(..., exist_ok=True)), so on a clean nightly workspace the _perf dir is created and IO rows are no longer
dropped. Verified by pointing MORI_PERF_OUT at a non-existent nested path."
| // Perf report: each initiator appends its own rows (matches the Python bench's | ||
| // per-rank _emit_io_perf; build_report.py dedups by op/backend/msg/batch). | ||
| // No-op unless MORI_PERF_OUT is set. | ||
| if (isInitiator) WritePerfRecords(a, mine); |
There was a problem hiding this comment.
Emit perf records for single-process XGMI runs
When invoked with --backend xgmi --xgmi-single-process and MORI_PERF_OUT set, RunBenchmark returns through RunXgmiSingleProcess before reaching this sole writer call, so the C++ benchmark produces no perf records even though the equivalent Python mode does. Preserve the RunSweep results in the single-process path and pass them to WritePerfRecords there as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
"Fixed in c442590. RunXgmiSingleProcess now captures the RunSweep results and calls WritePerfRecords, so
--xgmi-single-process emits perf records like the equivalent Python mode."
|
Thanks for moving the native benchmark into the common perf pipeline. I found three correctness issues in the new perf-recording path that can make the nightly data corrupt or nondeterministic; I think these should be addressed before merge:
|
Summary
Makes the native C++ benchmark (
tests/cpp/io/bench_engine) the defaultMORI-IO benchmark across the runner, CI, and docs, while keeping the Python
benchmark (
tests/python/io/benchmark.py) available for parity. The C++ pathhas no Python interpreter in the measurement loop and matches nixlbench timing,
so numbers are cleaner and directly comparable to NIXL.
What changed
Engine (code)
bench_enginenow appends one JSON lineper sweep point to
$MORI_PERF_OUT, in the exact schematests/python/perf_report.pywrites, so the C++ and Python benches feed theone report pipeline (
tools/perf/build_report.py). It captures per-iterationtiming to report the Python bench's per-iteration metrics (avg/max bandwidth,
avg/min latency) alongside the nixl whole-loop figure. No-op unless
MORI_PERF_OUTis set; initiator-only;flock-appended.tools/run_internode_io_benchmark.shtakes--engine cpp|python(defaultcpp). The cpp path locates the built binary,sets
LD_LIBRARY_PATH, and translates the torchrun rendezvous args(
--master-addr/--host) to the C++ socket-bootstrap args(
--master-ip/--self-ip). The python torchrun path is unchanged.CI
bench_engineon both nodes before the internode IO steps.The IO steps already call the runner with no
--engine, so they switch to C++automatically.
step -- the write-sweep step covers it via the runner and emits perf records
through the existing
MORI_PERF_OUTwiring. The read smoke step keepsMORI_PERF_OUTcleared.Docs
docs/MORI-IO-BENCHMARK.mdnow leads with the C++ benchmark and keeps Pythonas the parity alternative; adds a "Which benchmark to use" section. The Fabric
(UALink super-node) section is preserved and noted as also supported by C++.
README.mdanddocs/MORI-IO-GUIDE.mdpoint at the C++ default.Validation
Verified on a two-node MI308X / ionic (AINIC) cluster:
sweep; C++ ~10-20% faster; byte-exact validation on both.
build_report.py.--engine cppdefault and--engine python) run two-node.