Skip to content

Commit

Permalink
Merge pull request NVIDIA#910 from bettinaheim/releases/v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bettinaheim authored Nov 13, 2023
2 parents d47028d + 5d8d988 commit 614c91d
Show file tree
Hide file tree
Showing 44 changed files with 1,983 additions and 222 deletions.
69 changes: 7 additions & 62 deletions .github/workflows/docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ jobs:
outputs:
tar_cache: ${{ steps.prereqs.outputs.tar_cache }}
tar_archive: ${{ steps.prereqs.outputs.tar_archive }}
image_hash: ${{ format('{0}/{1}@{2}', steps.prereqs.outputs.registry, steps.prereqs.outputs.image_short_name, steps.copy_build.outputs.digest || steps.cudaq_build.outputs.digest) }}
ngc_image_hash: ${{ steps.prereqs.outputs.ngc_registry && format('{0}/{1}@{2}', steps.prereqs.outputs.ngc_registry, steps.prereqs.outputs.image_short_name, steps.cudaq_build.outputs.digest) || '' }}
image_hash: ${{ steps.prereqs.outputs.image_name }}@${{ steps.cudaq_build.outputs.digest }}

environment:
name: ${{ inputs.environment || 'default' }}
Expand Down Expand Up @@ -418,9 +417,8 @@ jobs:
repo_owner=${{ github.repository_owner }}
registry=${{ vars.registry || 'localhost:5000' }}/${repo_owner,,}
ngc_registry=`${{ needs.metadata.outputs.push_to_ngc == 'true' }} && echo nvcr.io/${repo_owner,,}/nightly || echo ''`
image_short_name=cuda-quantum
dev_image_name=${registry}/${image_short_name}-dev
image_name=${ngc_registry:-$registry}/${image_short_name}
dev_image_name=${registry}/cuda-quantum-dev
image_name=${ngc_registry:-$registry}/cuda-quantum
image_description="CUDA Quantum toolkit for heterogeneous quantum-classical workflows"
platform_tag=${{ needs.metadata.outputs.platform_tag }}
Expand All @@ -436,9 +434,6 @@ jobs:
image_tag+=`echo ${{ github.ref_name }} | tr '/' '-'`
fi
echo "registry=$registry" >> $GITHUB_OUTPUT
echo "ngc_registry=$ngc_registry" >> $GITHUB_OUTPUT
echo "image_short_name=$image_short_name" >> $GITHUB_OUTPUT
echo "image_name=$image_name" >> $GITHUB_OUTPUT
echo "image_tag=$image_tag" >> $GITHUB_OUTPUT
echo "image_tag_suffix=-base" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -504,7 +499,7 @@ jobs:
run: cosign sign --yes --recursive "${TAGS}@${DIGEST}"

- name: Log in to NGC
if: steps.prereqs.outputs.ngc_registry != ''
if: needs.metadata.outputs.push_to_ngc == 'true'
uses: docker/login-action@v2
with:
registry: nvcr.io
Expand Down Expand Up @@ -554,14 +549,14 @@ jobs:
key: ${{ steps.prereqs.outputs.tar_cache }}

- name: Sign image with GitHub OIDC Token
if: inputs.environment && steps.prereqs.outputs.ngc_registry == ''
if: inputs.environment && needs.metadata.outputs.push_to_ngc != 'true'
env:
DIGEST: ${{ steps.cudaq_build.outputs.digest }}
TAGS: ${{ steps.cudaq_metadata.outputs.tags }}
run: cosign sign --yes --recursive "${TAGS}@${DIGEST}"

- name: Sign image with NGC CLI
if: inputs.environment && steps.prereqs.outputs.ngc_registry
if: inputs.environment && needs.metadata.outputs.push_to_ngc == 'true'
env:
TAGS: ${{ steps.cudaq_metadata.outputs.tags }}
NGC_CLI_API_KEY: ${{ secrets.NGC_CREDENTIALS }}
Expand All @@ -578,55 +573,6 @@ jobs:
echo "Signing ${TAGS}"
ngc-cli/ngc registry image publish --source ${TAGS} ${TAGS} --sign
# If the cuda-quantum image is initially pushed to ngc we recreate it
# and push it to the registry defined in the deployment environment
- name: Log in to the container registry
if: vars.registry
uses: docker/login-action@v2
with:
registry: ${{ vars.registry }}
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Set up additional deployment
id: copy
if: steps.prereqs.outputs.ngc_registry != ''
run: |
echo "FROM ${{ steps.prereqs.outputs.image_name }}@${{ steps.cudaq_build.outputs.digest }}" >> ngc.Dockerfile
- name: Update cuda-quantum metadata
id: updated_metadata
if: steps.copy.outcome != 'skipped'
uses: docker/metadata-action@v5
with:
images: ${{ steps.prereqs.outputs.registry }}/${{ steps.prereqs.outputs.image_short_name }}
flavor: |
latest=false
suffix=${{ steps.prereqs.outputs.image_tag_suffix }},onlatest=true
tags: type=raw,value=${{ steps.prereqs.outputs.image_tag }}
labels: |
org.opencontainers.image.title=cuda-quantum
org.opencontainers.image.description=${{ steps.prereqs.outputs.image_description }}
- name: Copy cuda-quantum NGC image
id: copy_build
if: steps.copy.outcome != 'skipped'
uses: docker/build-push-action@v5
with:
context: .
file: ngc.Dockerfile
tags: ${{ steps.updated_metadata.outputs.tags }}
labels: ${{ steps.updated_metadata.outputs.labels }}
platforms: ${{ inputs.platforms }}
push: true

- name: Sign copy with GitHub OIDC Token
if: steps.copy.outcome != 'skipped'
env:
DIGEST: ${{ steps.copy_build.outputs.digest }}
TAGS: ${{ steps.updated_metadata.outputs.tags }}
run: cosign sign --yes --recursive "${TAGS}@${DIGEST}"

documentation:
name: Documentation
needs: [metadata, cudaqdev_image, cudaq_image]
Expand Down Expand Up @@ -751,8 +697,8 @@ jobs:
load_output=`docker load --input "${{ needs.cudaq_image.outputs.tar_archive }}"`
cudaq_image=`echo "$load_output" | grep -o 'Loaded image: \S*:\S*' | head -1 | cut -d ' ' -f 3`
else
docker pull ${{ needs.cudaq_image.outputs.image_hash }}
cudaq_image=${{ needs.cudaq_image.outputs.image_hash }}
docker pull $cudaq_image
fi
docker run --rm -dit --name cuda-quantum $cudaq_image
Expand Down Expand Up @@ -789,7 +735,6 @@ jobs:
run: |
cudaqdev_hash=${{ needs.cudaqdev_image.outputs.image_hash }}
cudaq_hash=${{ needs.cudaq_image.outputs.image_hash }}
cudaq_ngc_hash=${{ needs.cudaq_image.outputs.ngc_image_hash }}
artifact_name=build_info
echo "artifact_name=$artifact_name" >> $GITHUB_OUTPUT
info_file="$artifact_name.txt"
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ on:
- CI
types:
- completed
branches:
# Don't publish documentation for experimental features;
# Instead edit the README in docker/release/ to describe the feature
# and link any additional resources.
- 'releases/*'

name: Documentation

Expand Down Expand Up @@ -100,6 +95,9 @@ jobs:
head_branch=${pr_base:-${{ github.event.workflow_run.head_branch }}}
if [ "$head_branch" == "main" ]; then
echo "target_folder=latest" >> $GITHUB_OUTPUT
elif ${{ github.event.workflow_run.name != 'CI' }} && [ "$head_branch" != "${head_branch#experimental/}" ]; then
echo "Documentation for experimental features will not be published."
echo "Instead, please edit the README in docker/release/ to describe the feature and link any additional resources."
else
version=`echo ${head_branch#releases/} | (egrep -o "^v?([0-9]{1,}\.)+[0-9]{1,}$" || true)`
echo "target_folder=${version#v}" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
environment: backend-validation
container:
image: ghcr.io/nvidia/cuda-quantum:latest
image: nvcr.io/nvidia/nightly/cuda-quantum:latest
options: --user root

steps:
Expand Down
135 changes: 46 additions & 89 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,51 +287,50 @@ jobs:
build_info=${{ matrix.info_file }}*
platforms=`cat $build_info | grep -o 'platforms: \S*' | cut -d ' ' -f 2`
cudaq_image=`cat $build_info | grep -o 'cuda-quantum-image: \S*' | cut -d ' ' -f 2`
cudaq_ngc_image=`cat $build_info | grep -o 'cuda-quantum-ngc-image: \S*' | cut -d ' ' -f 2`
cudaqbase_image=`cat $build_info | grep -o 'cuda-quantum-image: \S*' | cut -d ' ' -f 2`
cudaqdev_image=`cat $build_info | grep -o 'cuda-quantum-dev-image: \S*' | cut -d ' ' -f 2`
cudaqdevdeps_image=`cat $build_info | grep -o 'cuda-quantum-devdeps-image: \S*' | cut -d ' ' -f 2`
for file in `ls *zip`; do unzip "$file" && rm "$file"; done && cd -
docker pull $cudaq_image
repo_owner=${{ github.repository_owner }}
image_short_name=cuda-quantum
base_tag=`docker inspect $cudaq_image --format='{{json .Config.Labels}}' | jq -r '."org.opencontainers.image.version"'`
image_title=`docker inspect $cudaq_image --format='{{json .Config.Labels}}' | jq -r '."org.opencontainers.image.title"'`
image_description=`docker inspect $cudaq_image --format='{{json .Config.Labels}}' | jq -r '."org.opencontainers.image.description"'`
docker image rm $cudaq_image
docker pull $cudaqbase_image
base_tag=`docker inspect $cudaqbase_image --format='{{json .Config.Labels}}' | jq -r '."org.opencontainers.image.version"'`
image_title=`docker inspect $cudaqbase_image --format='{{json .Config.Labels}}' | jq -r '."org.opencontainers.image.title"'`
image_description=`docker inspect $cudaqbase_image --format='{{json .Config.Labels}}' | jq -r '."org.opencontainers.image.description"'`
docker image rm $cudaqbase_image
docker image prune --force
registry=${{ vars.registry || 'localhost:5000' }}/${repo_owner,,}
if [ -n "$(echo "$platforms" | grep ',')" ] && ${{ secrets.NGC_CREDENTIALS != '' }}; then
if [ -n "$cudaq_ngc_image" ]; then
ngc_registry=nvcr.io/${repo_owner,,}/nightly
fi
fi
registry=`echo $cudaqbase_image | rev | cut -d / -f2- | rev`
push_to_ngc=`([ "$registry" == "${registry#nvcr.io}" ] && echo false) || echo true`
echo "release_id=$release_id" >> $GITHUB_OUTPUT
echo "registry=$registry" >> $GITHUB_OUTPUT
echo "ngc_registry=$ngc_registry" >> $GITHUB_OUTPUT
echo "image_short_name=$image_short_name" >> $GITHUB_OUTPUT
echo "image_name=${ngc_registry:-$registry}/$image_short_name" >> $GITHUB_OUTPUT
echo "push_to_ngc=$push_to_ngc" >> $GITHUB_OUTPUT
echo "image_name=$registry/cuda-quantum" >> $GITHUB_OUTPUT
echo "image_tag=${base_tag%-base}" >> $GITHUB_OUTPUT
echo "image_title=$image_title" >> $GITHUB_OUTPUT
echo "image_description=$image_description" >> $GITHUB_OUTPUT
echo "platforms=$platforms" >> $GITHUB_OUTPUT
echo "cudaq_image=$cudaq_image" >> $GITHUB_OUTPUT
echo "cudaqbase_image=$cudaqbase_image" >> $GITHUB_OUTPUT
echo "cudaqdev_image=$cudaqdev_image" >> $GITHUB_OUTPUT
echo "cudaqdevdeps_image=$cudaqdevdeps_image" >> $GITHUB_OUTPUT
echo "assets_folder=$assets_folder" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}

- name: Log in to the registry
if: steps.release_info.outputs.ngc_registry || vars.registry
- name: Log in to default registry
if: steps.release_info.outputs.push_to_ngc != 'true'
uses: docker/login-action@v2
with:
registry: ${{ steps.release_info.outputs.ngc_registry || vars.registry }}
username: ${{ (steps.release_info.outputs.ngc_registry && '$oauthtoken') || github.actor }}
password: ${{ (steps.release_info.outputs.ngc_registry && secrets.NGC_CREDENTIALS) || github.token }}
registry: ${{ vars.registry }}
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Log in to NGC registry
if: steps.release_info.outputs.push_to_ngc == 'true'
uses: docker/login-action@v2
with:
registry: 'nvcr.io'
username: '$oauthtoken'
password: ${{ secrets.NGC_CREDENTIALS }}

- name: Set up buildx runner
uses: docker/setup-buildx-action@v2
Expand All @@ -354,7 +353,7 @@ jobs:
context: .
file: ./docker/release/cudaq.ext.Dockerfile
build-args: |
base_image=${{ steps.release_info.outputs.cudaq_image }}
base_image=${{ steps.release_info.outputs.cudaqbase_image }}
assets=${{ steps.release_info.outputs.assets_folder }}
vscode_config=docker/release/config/.vscode
tags: ${{ steps.metadata.outputs.tags }}
Expand All @@ -366,14 +365,14 @@ jobs:
uses: sigstore/[email protected]

- name: Sign image with GitHub OIDC Token
if: steps.release_info.outputs.ngc_registry == ''
if: steps.release_info.outputs.push_to_ngc != 'true'
env:
DIGEST: ${{ steps.cudaq_build.outputs.digest }}
TAGS: ${{ steps.metadata.outputs.tags }}
run: cosign sign --yes --recursive "${TAGS}@${DIGEST}"

- name: Sign image with NGC CLI
if: steps.release_info.outputs.ngc_registry
if: steps.release_info.outputs.push_to_ngc == 'true'
env:
TAGS: ${{ steps.metadata.outputs.tags }}
NGC_CLI_API_KEY: ${{ secrets.NGC_CREDENTIALS }}
Expand All @@ -390,62 +389,15 @@ jobs:
echo "Signing ${TAGS}"
ngc-cli/ngc registry image publish --source ${TAGS} ${TAGS} --sign
- name: Log in to the container registry
if: vars.registry
uses: docker/login-action@v2
with:
registry: ${{ vars.registry }}
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Set up additional deployment
id: copy
if: steps.release_info.outputs.ngc_registry != ''
run: |
echo "FROM ${{ steps.release_info.outputs.image_name }}@${{ steps.cudaq_build.outputs.digest }}" >> ngc.Dockerfile
echo "image_name=${{ steps.release_info.outputs.registry }}/${{ steps.release_info.outputs.image_short_name }}" >> $GITHUB_OUTPUT
- name: Update cuda-quantum metadata
id: updated_metadata
if: steps.copy.outcome != 'skipped'
uses: docker/metadata-action@v5
with:
images: ${{ steps.copy.outputs.image_name }}
flavor: latest=false
tags: type=raw,value=${{ steps.release_info.outputs.image_tag }}
labels: |
org.opencontainers.image.title=${{ steps.release_info.outputs.image_title }}
org.opencontainers.image.description=${{ steps.release_info.outputs.image_description }}
- name: Copy cuda-quantum NGC image
id: copy_build
if: steps.copy.outcome != 'skipped'
uses: docker/build-push-action@v5
with:
context: .
file: ngc.Dockerfile
tags: ${{ steps.updated_metadata.outputs.tags }}
labels: ${{ steps.updated_metadata.outputs.labels }}
platforms: ${{ steps.release_info.outputs.platforms }}
push: true

- name: Sign copy with GitHub OIDC Token
if: steps.copy.outcome != 'skipped'
env:
DIGEST: ${{ steps.copy_build.outputs.digest }}
TAGS: ${{ steps.updated_metadata.outputs.tags }}
run: cosign sign --yes --recursive "${TAGS}@${DIGEST}"

- name: Update release information
run: |
release_id=${{ steps.release_info.outputs.release_id }}
gh release view $release_id --json body --jq .body > rel_notes.txt
header_length=`cat rel_notes.txt | grep -n "Release notes generated" | cut -d ':' -f 1`
head -n $(($header_length - 1)) rel_notes.txt > new_notes.txt
image_copy=${{ steps.copy.outputs.image_name }}
echo -e "\nImages for ${{ steps.release_info.outputs.platforms }}:\n" >> new_notes.txt
echo "- cuda-quantum (base image): ${{ steps.release_info.outputs.cudaq_image }}" >> new_notes.txt
echo "- cuda-quantum (with hpc components): ${{ steps.release_info.outputs.image_name }}@${{ steps.cudaq_build.outputs.digest }}${image_copy:+ or $image_copy@${{ steps.copy_build.outputs.digest }}}" >> new_notes.txt
echo "- cuda-quantum (base image): ${{ steps.release_info.outputs.cudaqbase_image }}" >> new_notes.txt
echo "- cuda-quantum (with hpc components): ${{ steps.release_info.outputs.image_name }}@${{ steps.cudaq_build.outputs.digest }}" >> new_notes.txt
echo "- cuda-quantum-dev (for extension development): ${{ steps.release_info.outputs.cudaqdev_image }}" >> new_notes.txt
echo "- cuda-quantum-devdeps (development dependencies only): ${{ steps.release_info.outputs.cudaqdevdeps_image }}" >> new_notes.txt
(echo && tail -n +$header_length rel_notes.txt) >> new_notes.txt
Expand All @@ -459,8 +411,7 @@ jobs:
matrix-step-name: docker_images
matrix-key: ${{ matrix.info_file }}
outputs: |
image_hash: ${{ format('{0}/{1}@{2}', steps.release_info.outputs.registry, steps.release_info.outputs.image_short_name, steps.copy_build.outputs.digest || steps.cudaq_build.outputs.digest) }}
ngc_image_hash: ${{ steps.release_info.outputs.ngc_registry && format('{0}/{1}@{2}', steps.release_info.outputs.ngc_registry, steps.release_info.outputs.image_short_name, steps.cudaq_build.outputs.digest) || '' }}
image_hash: ${{ steps.release_info.outputs.image_name }}@${{ steps.cudaq_build.outputs.digest }}
cudaq_wheels:
name: CUDA Quantum Python wheels
Expand Down Expand Up @@ -617,26 +568,32 @@ jobs:
- name: Basic validation (GPU backends)
run: |
set +e # Allow script to keep going through errors
# Skip some tests (multi-controlled gates) for the MPS backend (https://github.com/NVIDIA/cuda-quantum/issues/884)
mps_skipped_tests=(/home/cudaq/examples/cpp/algorithms/grover.cpp /home/cudaq/examples/cpp/basics/multi_controlled_operations.cpp /home/cudaq/examples/cpp/other/builder/builder.cpp /home/cudaq/examples/cpp/algorithms/amplitude_estimation.cpp)
for file in `ls $CUDA_QUANTUM_PATH/targets/*.config`; do
if [ -n "$(cat $file | grep "GPU_REQUIREMENTS")" ]; then
target=`basename $file | cut -d "." -f 1`
echo "## Execute on $target target" >> $GITHUB_STEP_SUMMARY
for ex in `find /home/cudaq/examples -name '*.cpp' -not -path '*/providers/*'`; do
filename=$(basename -- "$ex")
nvq++ $ex --target $target
status=$?
if [ $status -eq 0 ]; then
./a.out
if [[ " ${mps_skipped_tests[*]} " =~ " ${ex} " ]] && [[ "$target" = "tensornet-mps" ]] ; then
echo ":white_flag: Issue: https://github.com/NVIDIA/cuda-quantum/issues/884. Test skipped." >> $GITHUB_STEP_SUMMARY
else
filename=$(basename -- "$ex")
nvq++ $ex --target $target
status=$?
if [ $status -eq 0 ]; then
echo ":white_check_mark: Successfully ran $filename." >> $GITHUB_STEP_SUMMARY
./a.out
status=$?
if [ $status -eq 0 ]; then
echo ":white_check_mark: Successfully ran $filename." >> $GITHUB_STEP_SUMMARY
else
echo ":x: Failed to execute $filename." >> $GITHUB_STEP_SUMMARY
status_sum=$((status_sum+1))
fi
else
echo ":x: Failed to execute $filename." >> $GITHUB_STEP_SUMMARY
echo ":x: Compilation failed for $filename." >> $GITHUB_STEP_SUMMARY
status_sum=$((status_sum+1))
fi
else
echo ":x: Compilation failed for $filename." >> $GITHUB_STEP_SUMMARY
status_sum=$((status_sum+1))
fi
done
fi
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ endif()
if(NOT CUSTATEVEC_ROOT)
SET(CUSTATEVEC_ROOT "$ENV{CUQUANTUM_INSTALL_PREFIX}")
endif()
if(NOT CUTENSORNET_ROOT)
SET(CUTENSORNET_ROOT "$ENV{CUQUANTUM_INSTALL_PREFIX}")
endif()
if(NOT OPENSSL_ROOT_DIR)
SET(OPENSSL_ROOT_DIR "$ENV{OPENSSL_INSTALL_PREFIX}")
endif()
Expand Down
Loading

0 comments on commit 614c91d

Please sign in to comment.