Ensure that bulk-debug-python script is enclosed in markers

This permits extracting Python script using Unix CLI tools
when `--bulk-debug-python stdout` is used.

Added example of using this to nvbench_compare.md doc.
This commit is contained in:
Oleksandr Pavlyk
2026-06-22 11:58:16 -05:00
parent 5cc14fc948
commit f18d48d2fd
3 changed files with 34 additions and 0 deletions

View File

@@ -996,6 +996,7 @@ def make_bulk_debug_row(
def format_bulk_debug_python(bulk_rows: list[dict[str, Any]]) -> str:
return (
"# NVB-BULK-BEGIN\n"
"# Generated by nvbench-compare --bulk-debug-python.\n"
"import numpy as np\n\n"
f"bulk_rows = {pprint.pformat(bulk_rows, sort_dicts=False)}\n\n"
@@ -1028,6 +1029,7 @@ def format_bulk_debug_python(bulk_rows: list[dict[str, Any]]) -> str:
"# row = bulk_rows[0]\n"
"# arrays = load_bulk_data(row)\n"
"# ambiguous = [row for row in bulk_rows if row['status'] == 'AMBG']\n"
"# NVB-BULK-END\n"
)