Skip to content

Commit 3ce4379

Browse files
committed
docs(cookbook): Add section on generating data for realtime predecoder
Signed-off-by: Ben Howe <[email protected]>
1 parent 615ce6b commit 3ce4379

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

cookbook/predecoder.ipynb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,54 @@
10631063
"\n",
10641064
"# Load a pre-built engine file:\n",
10651065
"ONNX_WORKFLOW=3 WORKFLOW=inference bash code/scripts/local_run.sh\n",
1066+
"```\n",
1067+
"\n",
1068+
"### Generating data for CUDA-Q QEC realtime predecoder test application\n",
1069+
"\n",
1070+
"When evaluating the neural pre-decoder in an end-to-end downstream system like\n",
1071+
"CUDA-Q Realtime, you will need a test harness with valid inputs—both the\n",
1072+
"exported neural network model and the corresponding syndrome data.\n",
1073+
"\n",
1074+
"The utility script `code/export/generate_test_data.py` is provided to generate\n",
1075+
"this exact data (both an `.onnx` file and several `.bin` files) so you can\n",
1076+
"easily consume it in the CUDA-Q QEC realtime AI decoder.\n",
1077+
"\n",
1078+
"> **Important:** The `--distance` and `--n-rounds` arguments provided to this\n",
1079+
"script **must match** the values used in the preceding section when running the\n",
1080+
"ONNX export (e.g. `ONNX_WORKFLOW=2`).\n",
1081+
"\n",
1082+
"For a detailed walkthrough on how to ingest these files into the CUDA-Q Realtime\n",
1083+
"C++ pipeline, see the downstream documentation here: [Realtime AI Predecoder\n",
1084+
"Pipeline](https://nvidia.github.io/cudaqx/examples_rst/qec/realtime_predecoder_pymatching.html).\n",
1085+
"\n",
1086+
"```text\n",
1087+
"python3 code/export/generate_test_data.py --distance 13 --n-rounds 104 --num-samples 10000 --basis X --p-error=0.003 --simple-noise\n",
1088+
"```\n",
1089+
"\n",
1090+
"**Example output:**\n",
1091+
"\n",
1092+
"```text\n",
1093+
"Building circuit: D=13, T=104, basis=X, rotation=XV, p=0.003\n",
1094+
" Circuit built in 0.007s\n",
1095+
"Building detector error model and PyMatching matcher...\n",
1096+
" DEM + matcher built in 0.083s\n",
1097+
" Detectors: 17472, Observables: 1\n",
1098+
"Extracting check matrices (beliefmatching)...\n",
1099+
" H shape: (17472, 93864), O shape: (1, 93864), priors shape: (93864,)\n",
1100+
"Sampling 10000 shots...\n",
1101+
" Sampled in 1.006s\n",
1102+
"Decoding with PyMatching (baseline)...\n",
1103+
" Errors: 30/10000, LER: 0.0030\n",
1104+
" Decode time: 5.439s (543.9 µs/shot)\n",
1105+
"Writing outputs to test_data/d13_T104_X/\n",
1106+
"Done.\n",
1107+
" H_csr.bin 808,944 bytes\n",
1108+
" O_csr.bin 2,932 bytes\n",
1109+
" detectors.bin 698,880,008 bytes\n",
1110+
" metadata.txt 162 bytes\n",
1111+
" observables.bin 40,008 bytes\n",
1112+
" priors.bin 750,916 bytes\n",
1113+
" pymatching_predictions.bin 40,008 bytes\n",
10661114
"```"
10671115
]
10681116
},

0 commit comments

Comments
 (0)