@@ -76,6 +76,18 @@ if [[ $# -ge 7 ]]; then
7676 EXTRA_APP_ARGS=(" ${@: 7} " )
7777fi
7878
79+ # The app defaults to one logical patch. The aggregate result sums residual
80+ # errors across patches, so retain the per-patch ceiling when --num_logical
81+ # requests multiple patches.
82+ NUM_LOGICAL=1
83+ for (( i = 0 ; i < ${# EXTRA_APP_ARGS[@]} ; i++ )) ; do
84+ if [[ " ${EXTRA_APP_ARGS[$i]} " == " --num_logical" ]] &&
85+ (( i + 1 < ${# EXTRA_APP_ARGS[@]} )) ; then
86+ i=$(( i + 1 ))
87+ NUM_LOGICAL=${EXTRA_APP_ARGS[$i]}
88+ fi
89+ done
90+
7991export CUDAQ_DEFAULT_SIMULATOR=stim
8092if [[ -n " ${QEC_DECODING_SERVER:- } " ]]; then
8193 export CUDAQ_QEC_REALTIME_MODE=external_server
@@ -90,10 +102,11 @@ P_SPAM=0.01
90102# d5/T6). A decoder that loads but never corrects reliably exceeds it; any
91103# working decoder sits well below it. This is a wiring/correctness check, not
92104# a performance target -- it must never be tightened toward a particular
93- # decoder's measured rate. Floored at 1 so small shot counts do not truncate
94- # the ceiling to 0.
95- MAX_NON_ZERO=$(( NUM_SHOTS / 50 ))
96- if [[ $MAX_NON_ZERO -lt 1 ]]; then MAX_NON_ZERO=1; fi
105+ # decoder's measured rate. Floored at 1 per logical patch so small shot counts
106+ # do not truncate the ceiling to 0, then scaled for the aggregate result.
107+ MAX_NON_ZERO_PER_LOGICAL=$(( NUM_SHOTS / 50 ))
108+ if [[ $MAX_NON_ZERO_PER_LOGICAL -lt 1 ]]; then MAX_NON_ZERO_PER_LOGICAL=1; fi
109+ MAX_NON_ZERO=$(( MAX_NON_ZERO_PER_LOGICAL * NUM_LOGICAL))
97110
98111# Multi-type mode: a comma list binds one decoder type per patch and the
99112# per-decoder ceilings below replace the aggregate ceiling (which is
@@ -174,6 +187,7 @@ echo " distance = $DISTANCE"
174187echo " num_rounds = $NUM_ROUNDS "
175188echo " decoder_type = $DECODER_TYPE "
176189echo " num_shots = $NUM_SHOTS "
190+ echo " num_logical = $NUM_LOGICAL "
177191echo " realtime mode = $CUDAQ_QEC_REALTIME_MODE "
178192if [[ -n " $ONNX_PATH " ]]; then
179193 echo " onnx_path = $ONNX_PATH "
0 commit comments