Skip to content

Commit 74c8a1e

Browse files
authored
Merge branch 'main' into pr-update-dev-scripts
2 parents fa6627e + 4227924 commit 74c8a1e

100 files changed

Lines changed: 8071 additions & 3528 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Build decoding-server image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image_name:
7+
type: string
8+
description: GHCR image name, without a tag
9+
default: ghcr.io/nvidia/private/cudaq-decoders
10+
required: true
11+
image_tag:
12+
type: string
13+
description: Base tag; defaults to wiring-<run number>, with -cu<version> added
14+
required: false
15+
16+
jobs:
17+
build:
18+
name: Build decoding-server image (${{ matrix.platform }}, CUDA ${{ matrix.cuda_version }})
19+
if: ${{ github.repository == 'NVIDIA/cudaqx' }}
20+
runs-on: linux-${{ matrix.platform }}-cpu8
21+
permissions:
22+
contents: read
23+
packages: write
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
platform: [amd64, arm64]
28+
cuda_version: ['12.6', '13.0']
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
- name: Set up context for buildx
34+
run: docker context create builder_context
35+
36+
- name: Set up buildx
37+
uses: docker/setup-buildx-action@v3
38+
with:
39+
endpoint: builder_context
40+
version: v0.19.0
41+
driver-opts: |
42+
network=host
43+
image=moby/buildkit:v0.19.0
44+
45+
- name: Log in to GitHub CR
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ github.token }}
51+
52+
- name: Build and push image by digest
53+
id: docker-build
54+
uses: docker/build-push-action@v5
55+
with:
56+
context: .
57+
file: docker/decoding-server/Dockerfile
58+
platforms: linux/${{ matrix.platform }}
59+
build-args: |
60+
CUDA_VERSION=${{ matrix.cuda_version }}
61+
labels: |
62+
org.opencontainers.image.source=${{ github.repositoryUrl }}
63+
org.opencontainers.image.revision=${{ github.sha }}
64+
outputs: type=image,name=${{ inputs.image_name }},push-by-digest=true,name-canonical=true,push=true
65+
66+
- name: Export image digest
67+
env:
68+
IMAGE_DIGEST: ${{ steps.docker-build.outputs.digest }}
69+
run: |
70+
set -euo pipefail
71+
72+
mkdir -p /tmp/digests
73+
touch "/tmp/digests/${IMAGE_DIGEST#sha256:}"
74+
75+
- name: Upload image digest
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: decoding-server-digest-cu${{ matrix.cuda_version }}-${{ matrix.platform }}
79+
path: /tmp/digests/*
80+
if-no-files-found: error
81+
retention-days: 1
82+
83+
publish:
84+
name: Publish decoding-server multi-platform image (CUDA ${{ matrix.cuda_version }})
85+
needs: build
86+
runs-on: ubuntu-latest
87+
permissions:
88+
packages: write
89+
strategy:
90+
fail-fast: false
91+
matrix:
92+
cuda_version: ['12.6', '13.0']
93+
steps:
94+
- name: Set up buildx
95+
uses: docker/setup-buildx-action@v3
96+
97+
- name: Log in to GitHub CR
98+
uses: docker/login-action@v3
99+
with:
100+
registry: ghcr.io
101+
username: ${{ github.actor }}
102+
password: ${{ github.token }}
103+
104+
- name: Download image digests
105+
uses: actions/download-artifact@v4
106+
with:
107+
path: /tmp/digests
108+
pattern: decoding-server-digest-cu${{ matrix.cuda_version }}-*
109+
merge-multiple: true
110+
111+
- name: Create and verify multi-platform image
112+
env:
113+
IMAGE_NAME: ${{ inputs.image_name }}
114+
IMAGE_TAG: ${{ inputs.image_tag || format('wiring-{0}', github.run_number) }}
115+
CUDA_VERSION: ${{ matrix.cuda_version }}
116+
run: |
117+
set -euo pipefail
118+
119+
cd /tmp/digests
120+
image_ref="${IMAGE_NAME}:${IMAGE_TAG}-cu${CUDA_VERSION}"
121+
mapfile -t digests < <(find . -maxdepth 1 -type f -printf '%f\n' | sort)
122+
if [[ "${#digests[@]}" != 2 ]]; then
123+
echo "::error::Expected 2 image digests, found ${#digests[@]}"
124+
exit 1
125+
fi
126+
127+
refs=()
128+
for digest in "${digests[@]}"; do
129+
refs+=("${IMAGE_NAME}@sha256:${digest}")
130+
done
131+
132+
docker buildx imagetools create --tag "$image_ref" "${refs[@]}"
133+
134+
manifest=$(docker buildx imagetools inspect --raw "$image_ref")
135+
for architecture in amd64 arm64; do
136+
jq -e \
137+
--arg architecture "$architecture" \
138+
'.manifests[] | select(.platform.os == "linux" and .platform.architecture == $architecture)' \
139+
<<< "$manifest" > /dev/null
140+
done
141+
142+
docker buildx imagetools inspect "$image_ref"

.github/workflows/build_wheels.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ on:
6565
type: string
6666
default: ''
6767
required: false
68+
cudaq_repo:
69+
type: string
70+
description: Optional CUDA-Q repository override.
71+
default: ''
72+
required: false
73+
cudaq_ref:
74+
type: string
75+
description: Optional CUDA-Q ref override.
76+
default: ''
77+
required: false
6878
cache_key_suffix:
6979
type: string
7080
default: ''
@@ -76,7 +86,7 @@ on:
7686
required: false
7787

7888
concurrency:
79-
group: ${{ github.workflow }}-build-wheels-${{ github.ref }}
89+
group: ${{ github.workflow }}-build-wheels-${{ github.ref }}-${{ inputs.cudaq_repo || 'default-repo' }}-${{ inputs.cudaq_ref || 'default-ref' }}
8090
cancel-in-progress: true
8191

8292
jobs:
@@ -176,6 +186,9 @@ jobs:
176186
- name: Get required CUDAQ version
177187
id: get-cudaq-version
178188
uses: ./.github/actions/get-cudaq-version
189+
with:
190+
repo: ${{ inputs.cudaq_repo }}
191+
ref: ${{ inputs.cudaq_ref }}
179192

180193
- name: Get CUDAQ code
181194
uses: actions/checkout@v4
@@ -283,6 +296,9 @@ jobs:
283296
- name: Get required CUDAQ version
284297
id: get-cudaq-version
285298
uses: ./.github/actions/get-cudaq-version
299+
with:
300+
repo: ${{ inputs.cudaq_repo }}
301+
ref: ${{ inputs.cudaq_ref }}
286302

287303
- name: Get CUDAQ wheels
288304
uses: ./.github/actions/get-cudaq-wheels

.github/workflows/nightly_tests.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ jobs:
114114
cache_key_suffix: nightly
115115
secrets: inherit
116116

117+
cudaq-main-wheels:
118+
name: Wheels against CUDA-Q main
119+
needs: [resolve-cudaq-main, build-cudaq-main]
120+
uses: ./.github/workflows/build_wheels.yaml
121+
with:
122+
build_type: Release
123+
cudaq_wheels: Custom
124+
cache_key_suffix: nightly
125+
cudaq_repo: ${{ needs.resolve-cudaq-main.outputs.repo }}
126+
cudaq_ref: ${{ needs.resolve-cudaq-main.outputs.ref }}
127+
secrets: inherit
128+
117129
cleanup-nightly-cache:
118130
name: Clean up nightly cache
119131
if: ${{ always() }}
@@ -125,6 +137,7 @@ jobs:
125137
- cudaq-main-qec
126138
- cudaq-main-solvers
127139
- cudaq-main-docs
140+
- cudaq-main-wheels
128141
runs-on: ubuntu-latest
129142
permissions:
130143
actions: write

docker/decoding-server/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ============================================================================ #
2+
# Copyright (c) 2025 - 2026 NVIDIA Corporation & Affiliates. #
3+
# All rights reserved. #
4+
# #
5+
# This source code and the accompanying materials are made available under #
6+
# the terms of the Apache License 2.0 which accompanies this distribution. #
7+
# ============================================================================ #
8+
9+
# This is a temporary, minimal image used to validate the decoding-server
10+
# multi-platform publication workflow while getting the CI wiring in place.
11+
FROM ubuntu:24.04
12+
13+
ARG TARGETARCH
14+
ARG CUDA_VERSION
15+
16+
RUN printf '%s\n' \
17+
'CUDA-QX decoding-server image wiring test' \
18+
"architecture=${TARGETARCH}" \
19+
"cuda=${CUDA_VERSION}" \
20+
> /etc/cudaqx-decoding-server-image
21+
22+
CMD ["cat", "/etc/cudaqx-decoding-server-image"]

docs/sphinx/api/qec/cpp_api.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ Detector Error Model
3030
.. doxygenstruct:: cudaq::qec::detector_error_model
3131
:members:
3232

33+
.. doxygenstruct:: cudaq::qec::decoder_context
34+
:members:
35+
3336
.. doxygenfunction:: cudaq::qec::dem_from_memory_circuit(const code &, operation, std::size_t, cudaq::noise_model &, bool)
3437
.. doxygenfunction:: cudaq::qec::x_dem_from_memory_circuit(const code &, operation, std::size_t, cudaq::noise_model &, bool)
3538
.. doxygenfunction:: cudaq::qec::z_dem_from_memory_circuit(const code &, operation, std::size_t, cudaq::noise_model &, bool)
39+
.. doxygenfunction:: cudaq::qec::decoder_context_from_memory_circuit(const code &, operation, std::size_t, cudaq::noise_model &, bool)
3640
.. doxygenfunction:: cudaq::qec::dem_from_stim_text(const std::string &, bool)
3741

3842
Decoder Interfaces
@@ -82,12 +86,14 @@ Parity Check Matrix Utilities
8286
.. doxygenfunction:: cudaq::qec::generate_random_pcm(std::size_t, std::size_t, std::size_t, int, std::mt19937_64 &&);
8387
.. 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)
8488
.. 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)
85-
.. doxygenfunction:: cudaq::qec::get_pcm_for_rounds(const cudaqx::tensor<uint8_t> &, std::uint32_t, std::uint32_t, std::uint32_t, bool, bool);
89+
.. doxygenfunction:: cudaq::qec::get_pcm_for_rounds(const cudaqx::tensor<uint8_t> &, std::uint32_t, std::uint32_t, std::uint32_t, bool, bool, std::uint32_t);
8690
.. doxygenfunction:: cudaq::qec::get_sorted_pcm_column_indices(const std::vector<std::vector<std::uint32_t>> &, std::uint32_t);
91+
.. doxygenfunction:: cudaq::qec::get_sorted_pcm_column_indices(const std::vector<std::vector<std::uint32_t>> &, std::uint32_t, std::uint32_t);
8792
.. doxygenfunction:: cudaq::qec::get_sorted_pcm_column_indices(const cudaqx::tensor<uint8_t> &, std::uint32_t);
8893
.. doxygenfunction:: cudaq::qec::pcm_extend_to_n_rounds(const cudaqx::tensor<uint8_t> &, std::size_t, std::uint32_t);
8994
.. 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)
9095
.. doxygenfunction:: cudaq::qec::pcm_is_sorted(const cudaqx::tensor<uint8_t> &, std::uint32_t);
96+
.. doxygenfunction:: cudaq::qec::pcm_is_sorted(const std::vector<std::vector<std::uint32_t>> &, std::uint32_t, std::uint32_t);
9197
.. doxygenfunction:: cudaq::qec::pcm_to_sparse_vec(const cudaqx::tensor<uint8_t>& pcm)
9298
.. doxygenfunction:: cudaq::qec::reorder_pcm_columns(const cudaqx::tensor<uint8_t> &, const std::vector<std::uint32_t> &, uint32_t, uint32_t);
9399
.. doxygenfunction:: cudaq::qec::shuffle_pcm_columns(const cudaqx::tensor<uint8_t> &, std::mt19937_64 &&);

docs/sphinx/api/qec/python_api.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ Detector Error Model
2929
.. autoclass:: cudaq_qec.DetectorErrorModel
3030
:members:
3131

32+
.. autoclass:: cudaq_qec.DecoderContext
33+
:members:
34+
3235
.. autofunction:: cudaq_qec.dem_from_memory_circuit
3336
.. autofunction:: cudaq_qec.x_dem_from_memory_circuit
3437
.. autofunction:: cudaq_qec.z_dem_from_memory_circuit
38+
.. autofunction:: cudaq_qec.decoder_context_from_memory_circuit
3539
.. autofunction:: cudaq_qec.dem_from_stim_text
3640

3741
Decoder Interfaces

0 commit comments

Comments
 (0)