Skip to content

Commit a90f183

Browse files
committed
Merge down from main
2 parents 46bcb65 + 3079c21 commit a90f183

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2058
-91
lines changed

.github/workflows/all_libs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
# Install the correct torch first.
110110
cuda_no_dot=$(echo ${{ matrix.cuda_version }} | sed 's/\.//')
111111
pip install torch==2.9.0 --index-url https://download.pytorch.org/whl/cu${cuda_no_dot}
112-
pip install numpy pytest cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} lightning ml_collections mpi4py transformers quimb opt_einsum nvidia-cublas cuquantum-python-cu${{ steps.config.outputs.cuda_major }}==25.09.1
112+
pip install numpy pytest onnxscript cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} lightning ml_collections mpi4py transformers quimb opt_einsum nvidia-cublas cuquantum-python-cu${{ steps.config.outputs.cuda_major }}==25.09.1
113113
# The following tests are needed for docs/sphinx/examples/qec/python/tensor_network_decoder.py.
114114
if [ "$(uname -m)" == "x86_64" ]; then
115115
# Stim is not currently available on manylinux ARM wheels, so only

.github/workflows/all_libs_release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
# Install the correct torch first.
134134
cuda_no_dot=$(echo ${{ matrix.cuda_version }} | sed 's/\.//')
135135
pip install torch==2.9.0 --index-url https://download.pytorch.org/whl/cu${cuda_no_dot}
136-
pip install numpy pytest cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} lightning ml_collections mpi4py transformers quimb opt_einsum nvidia-cublas cuquantum-python-cu${{ steps.config.outputs.cuda_major }}==25.09.1
136+
pip install numpy pytest onnxscript cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} lightning ml_collections mpi4py transformers quimb opt_einsum nvidia-cublas cuquantum-python-cu${{ steps.config.outputs.cuda_major }}==25.09.1
137137
# The following tests are needed for docs/sphinx/examples/qec/python/tensor_network_decoder.py.
138138
if [ "$(uname -m)" == "x86_64" ]; then
139139
# Stim is not currently available on manylinux ARM wheels, so only

.github/workflows/lib_qec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
# Install the correct torch first.
107107
cuda_no_dot=$(echo ${{ matrix.cuda_version }} | sed 's/\.//')
108108
pip install torch==2.9.0 --index-url https://download.pytorch.org/whl/cu${cuda_no_dot}
109-
pip install numpy pytest cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} quimb opt_einsum nvidia-cublas cuquantum-python-cu${{ steps.config.outputs.cuda_major }}==25.09.1
109+
pip install numpy pytest onnxscript cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} quimb opt_einsum nvidia-cublas cuquantum-python-cu${{ steps.config.outputs.cuda_major }}==25.09.1
110110
# The following tests are needed for docs/sphinx/examples/qec/python/tensor_network_decoder.py.
111111
if [ "$(uname -m)" == "x86_64" ]; then
112112
# Stim is not currently available on manylinux ARM wheels, so only

.github/workflows/lib_solvers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
# Install the correct torch first.
9595
cuda_no_dot=$(echo ${{ matrix.cuda_version }} | sed 's/\.//')
9696
pip install torch==2.9.0 --index-url https://download.pytorch.org/whl/cu${cuda_no_dot}
97-
pip install numpy pytest cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} lightning ml_collections mpi4py transformers pytest
97+
pip install numpy pytest onnxscript cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} lightning ml_collections mpi4py transformers pytest
9898
9999
100100
- name: Run Python tests

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ apps/
9898
# vim files
9999
*.tmp
100100

101+
# Wheel files
102+
*.whl
103+
101104
# Temporary build files for metapackages
102105
libs/*/python/metapackages/LICENSE
103106
libs/*/python/metapackages/NOTICE

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
# Welcome to the CUDA-QX repository
22

3-
This repository contains a set of libraries that build on
4-
NVIDIA CUDA-Q. These libraries enable the rapid development of hybrid quantum-classical
5-
application code leveraging state-of-the-art CPUs, GPUs, and QPUs.
3+
This repository contains a set of libraries that build on
4+
NVIDIA CUDA-Q. These libraries enable the rapid development of hybrid quantum-classical
5+
application code leveraging state-of-the-art CPUs, GPUs, and QPUs.
66

77
## Getting Started
8-
To learn more about how to work with the CUDA-QX libraries, please take a look at the
9-
[CUDA-QX Documentation][cudaqx_docs]. The page contains detailed
10-
[installation instructions][official_install] for officially released packages.
8+
9+
To learn more about how to work with the CUDA-QX libraries, please take a look at the
10+
[CUDA-QX Documentation][cudaqx_docs]. The page contains detailed
11+
[installation instructions][official_install] for officially released packages.
1112

1213
[cudaqx_docs]: https://nvidia.github.io/cudaqx
1314
[official_install]: https://nvidia.github.io/cudaqx/quickstart/installation.html
1415

1516
## Contributing
1617

1718
There are many ways in which you can get involved with CUDA-QX. If you are
18-
interested in developing quantum applications with the CUDA-QX libraries,
19-
this repository is a great place to get started! For more information about
20-
contributing to the CUDA-QX platform, please take a look at
19+
interested in developing quantum applications with the CUDA-QX libraries,
20+
this repository is a great place to get started! For more information about
21+
contributing to the CUDA-QX platform, please take a look at
2122
[Contributing.md](./Contributing.md).
2223

2324
## License
2425

2526
The code in this repository is licensed under [Apache License 2.0](./LICENSE).
2627

28+
When distributed via PyPI, GHCR, or NGC, the binaries generated from this source
29+
code are also distributed under the Apache License 2.0; however, the
30+
`libcudaq-qec-nv-qldpc-decoder.so` library is closed source and is subject to
31+
the [NVIDIA Software License Agreement][github_qec_license]
32+
33+
[github_qec_license]: https://github.com/NVIDIA/cudaqx/blob/main/libs/qec/LICENSE
34+
2735
Contributing a pull request to this repository requires accepting the
2836
Contributor License Agreement (CLA) declaring that you have the right to, and
2937
actually do, grant us the rights to use your contribution. A CLA-bot will

docker/release/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ ARG TARGETARCH
2727

2828
USER root
2929

30+
# Update the copyright notification:
31+
RUN echo -e "This container also includes CUDA-Q QEC and CUDA-Q Solvers.\n"\
32+
"Use of this container implies consent to the NVIDIA Software License agreement at\n"\
33+
"https://github.com/NVIDIA/cudaqx/blob/main/libs/qec/LICENSE\n" >> "$CUDA_QUANTUM_PATH/Copyright.txt"
34+
3035
# Determine the appropriate zip file
3136
COPY installed_files-${TARGETARCH}.zip /tmp/
3237

docs/Doxyfile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ EXTRACT_STATIC = YES
2727
ENABLE_PREPROCESSING = YES
2828
MACRO_EXPANSION = YES
2929
EXPAND_ONLY_PREDEF = YES
30-
PREDEFINED = "__qpu__="
30+
PREDEFINED = "__qpu__=" \
31+
"__attribute__(x)="
3132

3233
#---------------------------------------------------------------------------
3334
# Configuration options related to the HTML output

docs/sphinx/api/qec/cpp_api.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,32 @@ NVIDIA QLDPC Decoder
5151

5252
.. include:: nv_qldpc_decoder_api.rst
5353

54+
Sliding Window Decoder
55+
----------------------
56+
57+
.. include:: sliding_window_api.rst
58+
59+
Real-Time Decoding
60+
==================
61+
62+
.. include:: cpp_realtime_decoding_api.rst
63+
64+
.. _parity_check_matrix_utilities:
65+
5466
Parity Check Matrix Utilities
5567
=============================
5668

5769
.. doxygenfunction:: cudaq::qec::dense_to_sparse(const cudaqx::tensor<uint8_t> &)
5870
.. doxygenfunction:: cudaq::qec::generate_random_pcm(std::size_t, std::size_t, std::size_t, int, std::mt19937_64 &&);
71+
.. doxygenfunction:: cudaq::qec::generate_timelike_sparse_detector_matrix(std::uint32_t num_syndromes_per_round, std::uint32_t num_rounds, bool include_first_round = false)
72+
.. doxygenfunction:: cudaq::qec::generate_timelike_sparse_detector_matrix(std::uint32_t num_syndromes_per_round, std::uint32_t num_rounds, std::vector<std::int64_t> first_round_matrix)
5973
.. doxygenfunction:: cudaq::qec::get_pcm_for_rounds(const cudaqx::tensor<uint8_t> &, std::uint32_t, std::uint32_t, std::uint32_t, bool, bool);
6074
.. doxygenfunction:: cudaq::qec::get_sorted_pcm_column_indices(const std::vector<std::vector<std::uint32_t>> &, std::uint32_t);
6175
.. doxygenfunction:: cudaq::qec::get_sorted_pcm_column_indices(const cudaqx::tensor<uint8_t> &, std::uint32_t);
6276
.. doxygenfunction:: cudaq::qec::pcm_extend_to_n_rounds(const cudaqx::tensor<uint8_t> &, std::size_t, std::uint32_t);
77+
.. doxygenfunction:: cudaq::qec::pcm_from_sparse_vec(const std::vector<std::int64_t>& sparse_vec, std::size_t num_rows, std::size_t num_cols)
6378
.. doxygenfunction:: cudaq::qec::pcm_is_sorted(const cudaqx::tensor<uint8_t> &, std::uint32_t);
79+
.. doxygenfunction:: cudaq::qec::pcm_to_sparse_vec(const cudaqx::tensor<uint8_t>& pcm)
6480
.. doxygenfunction:: cudaq::qec::reorder_pcm_columns(const cudaqx::tensor<uint8_t> &, const std::vector<std::uint32_t> &, uint32_t, uint32_t);
6581
.. doxygenfunction:: cudaq::qec::shuffle_pcm_columns(const cudaqx::tensor<uint8_t> &, std::mt19937_64 &&);
6682
.. doxygenfunction:: cudaq::qec::simplify_pcm(const cudaqx::tensor<uint8_t> &, const std::vector<double> &, std::uint32_t);
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.. _cpp_realtime_decoding_api:
2+
3+
4+
The Real-Time Decoding API enables low-latency error correction on quantum hardware by allowing CUDA-Q quantum kernels to interact with decoders during circuit execution. This API is designed for use cases where corrections must be calculated and applied within qubit coherence times.
5+
6+
The real-time decoding system supports simulation environments for local testing and hardware integration (e.g., on
7+
`Quantinuum's Helios QPU
8+
<https://www.quantinuum.com/products-solutions/quantinuum-systems/helios>`_).
9+
10+
Core Decoding Functions
11+
------------------------
12+
13+
These functions can be called from within CUDA-Q quantum kernels (``__qpu__`` functions) to interact with real-time decoders.
14+
15+
.. doxygenfunction:: cudaq::qec::decoding::enqueue_syndromes
16+
.. doxygenfunction:: cudaq::qec::decoding::get_corrections
17+
.. doxygenfunction:: cudaq::qec::decoding::reset_decoder
18+
19+
20+
Configuration API
21+
-----------------
22+
23+
The configuration API enables setting up decoders before circuit execution. Decoders are configured using YAML files or programmatically constructed configuration objects.
24+
25+
.. doxygenfunction:: cudaq::qec::decoding::config::configure_decoders
26+
.. doxygenfunction:: cudaq::qec::decoding::config::configure_decoders_from_file
27+
.. doxygenfunction:: cudaq::qec::decoding::config::configure_decoders_from_str
28+
.. doxygenfunction:: cudaq::qec::decoding::config::finalize_decoders
29+
30+
Helper Functions
31+
----------------
32+
33+
Real-time decoding requires converting matrices to sparse format for efficient decoder configuration. The following utility functions are essential:
34+
35+
- :cpp:func:`cudaq::qec::pcm_to_sparse_vec` for converting a dense PCM to a sparse PCM.
36+
37+
**Usage in real-time decoding:**
38+
39+
.. code-block:: cpp
40+
41+
config.H_sparse = cudaq::qec::pcm_to_sparse_vec(dem.detector_error_matrix);
42+
config.O_sparse = cudaq::qec::pcm_to_sparse_vec(dem.observables_flips_matrix);
43+
- :cpp:func:`cudaq::qec::pcm_from_sparse_vec` for converting a sparse PCM to a dense PCM.
44+
- :cpp:func:`cudaq::qec::generate_timelike_sparse_detector_matrix` for generating a sparse detector matrix.
45+
46+
**Usage in real-time decoding:**
47+
48+
.. code-block:: cpp
49+
50+
config.D_sparse = cudaq::qec::generate_timelike_sparse_detector_matrix(
51+
numSyndromesPerRound, numRounds, false);
52+
53+
See also :ref:`parity_check_matrix_utilities` for additional PCM manipulation functions.

0 commit comments

Comments
 (0)