File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed
libs/qec/unittests/realtime/app_examples Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 66# the terms of the Apache License 2.0 which accompanies this distribution. #
77# ============================================================================ #
88
9+ #------------------------------------------------------------------------------#
10+ # Maintenance note: to generate QIR files and corresponding config files for
11+ # Quantinuum, you may manually run tests like the following:
12+ # CUDAQ_DUMP_JIT_IR=1 KEEP_LOG_FILES=1 ctest -R quantinuum
13+ # The resulting files will be in:
14+ # build/libs/qec/unittests/realtime/app_examples/config-*.yml
15+ # build/libs/qec/unittests/realtime/app_examples/qir-*.ll
16+ #------------------------------------------------------------------------------#
17+
918#------------------------------------------------------------------------------#
1019# Surface code 1, fully local, regular Stim simulator
1120add_executable (surface_code-1-local)
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ NUM_SHOTS=1000
4646# Get timestamp suffix in YYYY-MM-DD-HH-MM-SS, with random number appended using /dev/urandom.
4747timestamp=$( date +%Y-%m-%d-%H-%M-%S)
4848RNG_SUFFIX=$( od -An -N4 -i /dev/urandom | tr -d ' ' )
49+ # Remove any negative sign.
50+ RNG_SUFFIX=$( echo $RNG_SUFFIX | sed ' s/-//g' )
4951FULL_SUFFIX=$timestamp -$RNG_SUFFIX
5052
5153CONFIG_FILE=config-${FULL_SUFFIX} .yml
@@ -70,6 +72,15 @@ export CUDAQ_DUMP_JIT_IR=${CUDAQ_DUMP_JIT_IR:-0}
7072echo Running $EXE_PATH2 --distance $DISTANCE --num_shots $NUM_SHOTS --load_dem $CONFIG_FILE --num_rounds $NUM_ROUNDS --decoder_window $DECODER_WINDOW
7173$EXE_PATH2 --distance $DISTANCE --num_shots $NUM_SHOTS --load_dem $CONFIG_FILE --num_rounds $NUM_ROUNDS --decoder_window $DECODER_WINDOW | & tee load_dem-$FULL_SUFFIX .log
7274
75+ # If CUDAQ_DUMP_JIT_IR is "1", then extract the QIR from the
76+ # load_dem-$FULL_SUFFIX.log file and place it in qir-$FULL_SUFFIX.ll.
77+ if [[ " ${CUDAQ_DUMP_JIT_IR} " == " 1" ]]; then
78+ # The QIR starts with "ModuleID" and ends with "backwards_branching"
79+ QIR=$( sed -n ' /ModuleID/,/backwards_branching/p' load_dem-$FULL_SUFFIX .log)
80+ echo " Writing QIR to qir-$FULL_SUFFIX .ll"
81+ echo " $QIR " > qir-$FULL_SUFFIX .ll
82+ fi
83+
7384
7485# Look for results like this in the output:
7586# Number of non-zero values measured : 2
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ NUM_SHOTS=1000
4242# Get timestamp suffix in YYYY-MM-DD-HH-MM-SS, with random number appended using /dev/urandom.
4343timestamp=$( date +%Y-%m-%d-%H-%M-%S)
4444RNG_SUFFIX=$( od -An -N4 -i /dev/urandom | tr -d ' ' )
45+ # Remove any negative sign.
46+ RNG_SUFFIX=$( echo $RNG_SUFFIX | sed ' s/-//g' )
4547FULL_SUFFIX=$timestamp -$RNG_SUFFIX
4648
4749CONFIG_FILE=config-${FULL_SUFFIX} .yml
@@ -66,6 +68,14 @@ export CUDAQ_DUMP_JIT_IR=${CUDAQ_DUMP_JIT_IR:-0}
6668echo Running $EXE_PATH2 --distance $DISTANCE --num_shots $NUM_SHOTS --load_dem $CONFIG_FILE
6769$EXE_PATH2 --distance $DISTANCE --num_shots $NUM_SHOTS --load_dem $CONFIG_FILE | & tee load_dem-$FULL_SUFFIX .log
6870
71+ # If CUDAQ_DUMP_JIT_IR is "1", then extract the QIR from the
72+ # load_dem-$FULL_SUFFIX.log file and place it in qir-$FULL_SUFFIX.ll.
73+ if [[ " ${CUDAQ_DUMP_JIT_IR} " == " 1" ]]; then
74+ # The QIR starts with "ModuleID" and ends with "backwards_branching"
75+ QIR=$( sed -n ' /ModuleID/,/backwards_branching/p' load_dem-$FULL_SUFFIX .log)
76+ echo " Writing QIR to qir-$FULL_SUFFIX .ll"
77+ echo " $QIR " > qir-$FULL_SUFFIX .ll
78+ fi
6979
7080# Look for results like this in the output:
7181# Number of non-zero values measured : 2
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ NUM_SHOTS=1000
4343# Get timestamp suffix in YYYY-MM-DD-HH-MM-SS, with random number appended using /dev/urandom.
4444timestamp=$( date +%Y-%m-%d-%H-%M-%S)
4545RNG_SUFFIX=$( od -An -N4 -i /dev/urandom | tr -d ' ' )
46+ # Remove any negative sign.
47+ RNG_SUFFIX=$( echo $RNG_SUFFIX | sed ' s/-//g' )
4648FULL_SUFFIX=$timestamp -$RNG_SUFFIX
4749
4850CONFIG_FILE=config-${FULL_SUFFIX} .yml
@@ -66,6 +68,14 @@ export CUDAQ_DUMP_JIT_IR=${CUDAQ_DUMP_JIT_IR:-0}
6668echo Running $EXE_PATH2 --distance $DISTANCE --num_shots $NUM_SHOTS --load_dem $CONFIG_FILE
6769$EXE_PATH2 --distance $DISTANCE --num_shots $NUM_SHOTS --load_dem $CONFIG_FILE --p_spam $ERROR_RATE --state_prep $STATE_PREP | & tee load_dem-$FULL_SUFFIX .log
6870
71+ # If CUDAQ_DUMP_JIT_IR is "1", then extract the QIR from the
72+ # load_dem-$FULL_SUFFIX.log file and place it in qir-$FULL_SUFFIX.ll.
73+ if [[ " ${CUDAQ_DUMP_JIT_IR} " == " 1" ]]; then
74+ # The QIR starts with "ModuleID" and ends with "backwards_branching"
75+ QIR=$( sed -n ' /ModuleID/,/backwards_branching/p' load_dem-$FULL_SUFFIX .log)
76+ echo " Writing QIR to qir-$FULL_SUFFIX .ll"
77+ echo " $QIR " > qir-$FULL_SUFFIX .ll
78+ fi
6979
7080# ------------------------------------------------------------------------------
7181# Validation of decoder results using mismatch percentage:
You can’t perform that action at this time.
0 commit comments