-
Notifications
You must be signed in to change notification settings - Fork 4
#15 - Add reusable C++ bench infrastructure for per-platform performance reports #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Capture host/NIC/GPU/build state for a benchmark run, so numbers are | ||
| # reproducible across machines and over time. Writes one structured text file | ||
| # with named sections. | ||
| # | ||
| # Usage: ./bench_capture_environment.sh <output_dir> | ||
| # Default output dir: bench-results/<UTC timestamp>/ | ||
|
|
||
| set -u | ||
|
|
||
| OUT_DIR="${1:-bench-results/$(date -u +%Y%m%dT%H%M%SZ)}" | ||
| mkdir -p "$OUT_DIR" | ||
| OUT="$OUT_DIR/environment.txt" | ||
|
|
||
| # Run a command, capturing exit status. Always write a header so the section is | ||
| # present even when the command is missing or fails — silent absence is harder | ||
| # to debug than an explicit "command not found". | ||
| run_section() { | ||
| local label="$1"; shift | ||
| { | ||
| echo "==========================================================" | ||
| echo "[$label]" | ||
| echo " cmd: $*" | ||
| echo "==========================================================" | ||
| if command -v "$1" >/dev/null 2>&1 || [[ "$1" == /* || "$1" == ./* ]]; then | ||
| "$@" 2>&1 | ||
| echo " (exit: $?)" | ||
| else | ||
| echo " (command not found in PATH: $1)" | ||
| fi | ||
| echo | ||
| } >> "$OUT" | ||
| } | ||
|
|
||
| # Cat a file/glob; write a header either way. | ||
| cat_section() { | ||
| local label="$1"; shift | ||
| { | ||
| echo "==========================================================" | ||
| echo "[$label]" | ||
| echo " paths: $*" | ||
| echo "==========================================================" | ||
| for p in "$@"; do | ||
| if compgen -G "$p" >/dev/null; then | ||
| for f in $p; do | ||
| echo "----- $f -----" | ||
| cat "$f" 2>&1 | ||
| done | ||
| else | ||
| echo " (no match: $p)" | ||
| fi | ||
| done | ||
| echo | ||
| } >> "$OUT" | ||
| } | ||
|
|
||
| : > "$OUT" | ||
|
|
||
| echo "DAQIRI benchmark environment capture" >> "$OUT" | ||
| echo "Generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$OUT" | ||
| echo "Host: $(hostname)" >> "$OUT" | ||
| echo "Output: $OUT" >> "$OUT" | ||
| echo >> "$OUT" | ||
|
|
||
| # --- Kernel / OS --- | ||
| run_section "uname" uname -a | ||
| cat_section "kernel-cmdline" /proc/cmdline | ||
| cat_section "os-release" /etc/os-release | ||
| run_section "lsb-release" lsb_release -a | ||
| run_section "clocksource" cat /sys/devices/system/clocksource/clocksource0/current_clocksource | ||
|
|
||
| # --- CPU / NUMA / IRQ --- | ||
| run_section "numactl" numactl --show | ||
| run_section "lscpu" lscpu | ||
| cat_section "cpu-isolated" /sys/devices/system/cpu/isolated | ||
| run_section "cpufreq-info" cpupower frequency-info | ||
| cat_section "cpu-governor" /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | ||
| run_section "irq-mlx5" bash -c "grep mlx5 /proc/interrupts || true" | ||
|
|
||
| # --- Hugepages --- | ||
| cat_section "hugepages" /sys/kernel/mm/hugepages/*/nr_hugepages | ||
| run_section "free-h" free -h | ||
|
|
||
| # --- PCIe topology --- | ||
| run_section "lspci-mellanox" bash -c "lspci -vvv -d 15b3: 2>/dev/null" | ||
| run_section "lspci-nvidia" bash -c "lspci -vvv -d 10de: 2>/dev/null" | ||
|
|
||
| # --- NIC: OFED / firmware / DPDK binding --- | ||
| run_section "ofed-info" ofed_info -s | ||
| run_section "mlxfwmanager" mlxfwmanager --query | ||
| run_section "dpdk-devbind" dpdk-devbind.py --status | ||
| # Per-iface ethtool — iterate over the daqiri-tx/rx names if present, else all mlx5. | ||
| for iface in daqiri-tx daqiri-rx $(ls /sys/class/net 2>/dev/null | grep -E '^(enP|enp|eth)' || true); do | ||
| [[ -d "/sys/class/net/$iface" ]] || continue | ||
| run_section "ethtool-i:$iface" ethtool -i "$iface" | ||
| run_section "ethtool-g:$iface" ethtool -g "$iface" | ||
| run_section "ethtool-l:$iface" ethtool -l "$iface" | ||
| cat_section "iface-mtu:$iface" "/sys/class/net/$iface/mtu" | ||
| cat_section "iface-mac:$iface" "/sys/class/net/$iface/address" | ||
| done | ||
|
|
||
| # --- GPU --- | ||
| run_section "nvidia-smi-q" nvidia-smi -q | ||
| run_section "nvidia-smi-tempclk" nvidia-smi --query-gpu=name,driver_version,temperature.gpu,clocks.current.sm,clocks.current.memory --format=csv | ||
|
|
||
| # --- Build state --- | ||
| DAQIRI_DIR="$(git -C "$(dirname "$0")/.." rev-parse --show-toplevel 2>/dev/null || pwd)" | ||
| run_section "git-rev-parse" git -C "$DAQIRI_DIR" rev-parse HEAD | ||
| run_section "git-status" git -C "$DAQIRI_DIR" status --short | ||
| run_section "git-describe" git -C "$DAQIRI_DIR" describe --always --dirty | ||
|
|
||
| echo "Capture complete: $OUT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR introduces the
TokenBucketPacerclass, the--target-gbpsflag, and rewrites every bench's final summary line to usename=valuefields (addingseconds=,send_bytes=,recv_bytes=, etc.). It also addsexamples/bench_capture_environment.sh. Per the repo's doc-sync rule, changes underexamples/*.cpprequire updatingdocs/tutorials/benchmarking_examples.md,docs/tutorials/configuration-walkthrough.md, and the benchmark table inAGENTS.md. None of those appear to be updated in this PR.Rule Used: DAQIRI has no automated doc-sync gate beyond mkdoc... (source)