Skip to content

Commit

Permalink
Merge branch 'main' into pr-advance-stim-1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
bmhowe23 authored Oct 17, 2024
2 parents eee86eb + 71abfc7 commit aa1695f
Show file tree
Hide file tree
Showing 185 changed files with 7,745 additions and 3,865 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ on:
push:
branches:
- "pull-request/[0-9]+"

merge_group:
types:
- checks_requested

name: CI # do not change name without updating workflow_run triggers

concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clean_up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
/repos/nvidia/cuda-quantum/git/refs/heads/$branch
done
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.REPO_BOT_ACCESS_TOKEN || github.token }}
draft_releases:
name: Delete draft release
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# This workflow is used to override the set of languages analyzed,
# and to provide custom queries or build logic.

name: "CodeQL Advanced"

on:
push:
branches:
- 'main'
- 'releases/*'
- 'experimental/*'
- 'features/*'
pull_request:
branches:
- 'main'
- 'releases/*'
- 'experimental/*'
- 'features/*'
schedule:
- cron: '37 9 * * 2'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: 'ubuntu-latest'
permissions:
security-events: write
# read permissions below are only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# For analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
- language: c-cpp
build-mode: none # Consider setting this to manual and providing a build command to get more accurate scanning
- language: python
build-mode: none

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
5 changes: 4 additions & 1 deletion .github/workflows/config/spellcheck_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ matrix:

- name: rst
sources:
- '**/*.rst'
- '**/*.rst|!docs/sphinx/_templates/**/*.rst'
glob_flags: N|G|B
expect_match: false
aspell:
lang: en
Expand Down Expand Up @@ -192,6 +193,8 @@ matrix:
- name: cxx_examples
sources:
- 'docs/sphinx/examples/**/*.cpp'
- 'docs/sphinx/applications/cpp/*.cpp'
- 'docs/sphinx/targets/cpp/*.cpp'
expect_match: false
aspell:
lang: en
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/dco_merge_queue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
# Do not add any triggers here!
merge_group:
types:
- checks_requested

name: DCO (merge queue)

permissions: {} # no permissions needed.

jobs:
DCO:
runs-on: ubuntu-latest
steps:
- run:
echo "Enable merge_queue check to pass."
echo "No checks were performed; these checks were already performed during PR workflows."
1 change: 0 additions & 1 deletion .github/workflows/gh_registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ name: Update GHCR
jobs:
ghcr_config:
name: Read GHCR config
if: github.event_name == 'workflow_dispatch' || vars.enabled_workflows == 'all'
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
cudaq_test_image:
type: string
required: false
default: 'nvcr.io/nvidia/nightly/cuda-quantum:latest' # If changed, update env defaults, too
default: '' # picked up from repo variable if not provided
description: 'CUDA Quantum image to run the tests in. Default to the latest CUDA Quantum nightly image'
commit_sha:
type: string
Expand All @@ -43,7 +43,7 @@ on:
cudaq_nvqc_deploy_image:
type: string
required: false
default: 'nvcr.io/nvidia/nightly/cuda-quantum:latest' # If changed, update env defaults, too
default: '' # same as cudaq_test_image if not provided
description: 'CUDA Quantum image to use for NVQC deployment to NVCF. Default to the latest CUDA Quantum nightly image'
workflow_id:
type: string
Expand All @@ -52,7 +52,6 @@ on:
python_version:
type: choice
required: true
default: '3.10' # If changed, update env defaults, too
description: 'Python version to run wheel test'
options:
- '3.8'
Expand All @@ -70,10 +69,6 @@ env:
NVQC_FUNCTION_ID: 3bfa0342-7d2a-4f1b-8e81-b6608d28ca7d
# <Backend>:<GPU Type>:<Instance Type>:<Min Instances>:<Max Instances>
NGC_NVQC_DEPLOYMENT_SPEC: GFN:L40S:gl40s_1.br25_2xlarge:1:1
# If vars below are changed, it is recommended to also update the
# workflow_dispatch defaults above so they stay in sync.
cudaq_test_image: nvcr.io/nvidia/nightly/cuda-quantum:latest
cudaq_nvqc_deploy_image: nvcr.io/nvidia/nightly/cuda-quantum:latest
python_version: '3.10'

jobs:
Expand All @@ -84,11 +79,13 @@ jobs:
runs-on: ubuntu-latest
outputs:
cudaq_test_image: ${{ steps.vars.outputs.cudaq_test_image }}
cudaq_nvqc_deploy_image: ${{ steps.vars.outputs.cudaq_nvqc_deploy_image }}
steps:
- name: Set variables
id: vars
run: |
echo "cudaq_test_image=${{ inputs.cudaq_test_image || env.cudaq_test_image }}" >> $GITHUB_OUTPUT
echo "cudaq_test_image=${{ inputs.cudaq_test_image || vars.cudaq_test_image }}" >> $GITHUB_OUTPUT
echo "cudaq_nvqc_deploy_image=${{ inputs.cudaq_nvqc_deploy_image || vars.cudaq_test_image }}" >> $GITHUB_OUTPUT
metadata:
name: Retrieve commit info
Expand All @@ -112,7 +109,7 @@ jobs:
build_nvqc_image:
name: Build NVQC deployment image
runs-on: ubuntu-latest
needs: metadata
needs: [setup, metadata]
environment: ghcr-deployment
if: (inputs.target == 'nvqc' || github.event_name == 'schedule' || inputs.target == 'nightly')
steps:
Expand Down Expand Up @@ -153,7 +150,7 @@ jobs:
context: .
file: ./docker/release/cudaq.nvqc.Dockerfile
build-args: |
base_image=${{ inputs.cudaq_nvqc_deploy_image || env.cudaq_nvqc_deploy_image }}
base_image=${{ needs.setup.outputs.cudaq_nvqc_deploy_image }}
tags: nvcr.io/${{ env.NGC_QUANTUM_ORG }}/${{ env.NGC_QUANTUM_TEAM }}/cuda-quantum:nightly
platforms: linux/amd64
provenance: false
Expand Down Expand Up @@ -490,7 +487,7 @@ jobs:
export ORCA_ACCESS_URL='${{ secrets.ORCA_ACCESS_URL }}'
set +e # Allow script to keep going through errors
test_err_sum=0
cpp_tests="docs/sphinx/examples/cpp/providers/orca.cpp docs/sphinx/examples/cpp/providers/orca_mqpu.cpp"
cpp_tests="docs/sphinx/targets/cpp/orca.cpp docs/sphinx/targets/cpp/orca_mqpu.cpp"
for filename in $cpp_tests; do
[ -e "$filename" ] || echo "::error::Couldn't find file ($filename)"
nvq++ --target orca --orca-url $ORCA_ACCESS_URL $filename
Expand All @@ -509,7 +506,7 @@ jobs:
test_err_sum=$((test_err_sum+1))
fi
done
python_tests="docs/sphinx/examples/python/providers/orca.py docs/sphinx/examples/python/providers/orca_mqpu.py"
python_tests="docs/sphinx/targets/python/orca.py docs/sphinx/targets/python/orca_mqpu.py"
for filename in $python_tests; do
[ -e "$filename" ] || echo "::error::Couldn't find file ($filename)"
python3 $filename 1> /dev/null
Expand Down Expand Up @@ -636,7 +633,7 @@ jobs:
done
# Test C++ examples with NVQC
for filename in `find examples/cpp/ -name '*.cpp'`; do
for filename in `find examples/cpp/ applications/cpp/ targets/cpp/ -name '*.cpp'`; do
if [[ "$filename" == *"nvqc"* ]]; then
echo "$filename"
nvqc_config=""
Expand Down Expand Up @@ -672,7 +669,7 @@ jobs:
# Test NVQC Python examples + Python MLIR execution tests (not IR tests)
python3 -m pip install pytest
for ex in `find examples/python python/tests/mlir/target -name '*.py' -not -path '*/python/tutorials/*'`; do
for ex in `find examples/python python/tests/mlir/target -name '*.py'`; do
filename=$(basename -- "$ex")
filename="${filename%.*}"
echo "Testing $filename:"
Expand Down Expand Up @@ -789,7 +786,7 @@ jobs:
set +e # Allow script to keep going through errors
python$python_version -m pip install pytest
test_err_sum=0
for ex in `find examples/python python/tests/mlir/target -name '*.py' -not -path '*/python/tutorials/*'`; do
for ex in `find examples/python python/tests/mlir/target -name '*.py'`; do
filename=$(basename -- "$ex")
filename="${filename%.*}"
echo "Testing $filename:"
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/nvqc_regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
cudaq_test_image:
type: string
required: false
default: 'nvcr.io/nvidia/nightly/cuda-quantum:latest' # If changed, update env defaults, too
default: '' # picked up from repo variable if not provided
description: 'CUDA Quantum image to run the tests in. Default to the latest CUDA Quantum nightly image'
commit_sha:
type: string
Expand All @@ -25,7 +25,6 @@ on:
python_version:
type: choice
required: true
default: '3.10' # If changed, update env defaults, too
description: 'Python version to run wheel test'
options:
- '3.8'
Expand All @@ -37,9 +36,6 @@ on:
- cron: 0 3 * * *

env:
# If vars below are changed, it is recommended to also update the
# workflow_dispatch defaults above so they stay in sync.
cudaq_test_image: nvcr.io/nvidia/nightly/cuda-quantum:latest
python_version: '3.10'

jobs:
Expand All @@ -54,7 +50,7 @@ jobs:
- name: Set variables
id: vars
run: |
echo "cudaq_test_image=${{ inputs.cudaq_test_image || env.cudaq_test_image }}" >> $GITHUB_OUTPUT
echo "cudaq_test_image=${{ inputs.cudaq_test_image || vars.cudaq_test_image }}" >> $GITHUB_OUTPUT
metadata:
name: Retrieve commit info
Expand Down Expand Up @@ -158,7 +154,7 @@ jobs:
done
# Test C++ examples with NVQC
for filename in `find examples/cpp/ -name '*.cpp'`; do
for filename in `find examples/cpp/ applications/cpp/ targets/cpp/ -name '*.cpp'`; do
if [[ "$filename" == *"nvqc"* ]]; then
echo "$filename"
nvqc_config=""
Expand Down Expand Up @@ -194,7 +190,7 @@ jobs:
# Test NVQC Python examples + Python MLIR execution tests (not IR tests)
python3 -m pip install pytest
for ex in `find examples/python python/tests/mlir/target -name '*.py' -not -path '*/python/tutorials/*'`; do
for ex in `find examples/python python/tests/mlir/target -name '*.py'`; do
filename=$(basename -- "$ex")
filename="${filename%.*}"
echo "Testing $filename:"
Expand Down Expand Up @@ -308,7 +304,7 @@ jobs:
set +e # Allow script to keep going through errors
python$python_version -m pip install pytest
test_err_sum=0
for ex in `find examples/python python/tests/mlir/target -name '*.py' -not -path '*/python/tutorials/*'`; do
for ex in `find examples/python python/tests/mlir/target -name '*.py'; do
filename=$(basename -- "$ex")
filename="${filename%.*}"
echo "Testing $filename:"
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ jobs:
for info_file in ${{ join(fromJson(steps.artifacts.outputs.installers).info_files, ' ') }}; do
delete_staging_branch $info_file '${{ steps.artifacts.outputs.installers }}'
done
env:
GH_TOKEN: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}

- name: Retrieve
id: assets_retrieval
Expand Down Expand Up @@ -789,7 +791,7 @@ jobs:
run: |
chmod +x /tmp/install/install_cuda_quantum.*
/tmp/install/install_cuda_quantum.* --accept
rm -rf examples && mv docs/sphinx/examples examples && rm -rf examples/python
rm -rf examples applications targets && mv docs/sphinx/examples examples && mv docs/sphinx/applications applications && mv docs/sphinx/targets targets && rm -rf examples/python && rm -rf applications/python && rm -rf targets/python
GITHUB_STEP_SUMMARY=$GITHUB_STEP_SUMMARY \
bash -l scripts/validate_container.sh | tee /tmp/validation.out
Expand Down Expand Up @@ -835,6 +837,8 @@ jobs:
# Setup links for validate_wheel.sh script
ln -s $GITHUB_WORKSPACE/scripts/validate_wheel.sh .
ln -s $GITHUB_WORKSPACE/docs/sphinx/examples/python /tmp/examples
ln -s $GITHUB_WORKSPACE/docs/sphinx/applications/python /tmp/applications
ln -s $GITHUB_WORKSPACE/docs/sphinx/targets/python /tmp/targets
ln -s $GITHUB_WORKSPACE/docs/sphinx/snippets/python /tmp/snippets
ln -s $GITHUB_WORKSPACE/python/tests /tmp/tests
ln -s $GITHUB_WORKSPACE/python/README.md .
Expand Down Expand Up @@ -941,7 +945,7 @@ jobs:
fi; \
done`
rm -rf examples && mv github-repo/docs/sphinx/examples examples
rm -rf examples applications targets && mv github-repo/docs/sphinx/examples examples && mv github-repo/docs/sphinx/applications applications && mv github-repo/docs/sphinx/targets targets
mv github-repo/docs/notebook_validation.py .
GITHUB_STEP_SUMMARY=$GITHUB_STEP_SUMMARY \
bash github-repo/scripts/validate_container.sh $backends_to_test | tee /tmp/validation.out
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ jobs:
docker run --rm -dit --name wheel-validation-examples wheel_validation:local
status_sum=0
for ex in `find docs/sphinx/examples/python -name '*.py' -not -path '*/providers/*' -not -path '*/divisive_clustering_src/*' -not -path '*/utils_ipie.py' -not -path '*/vqe_cudaq_qnp.py'`; do
for ex in `find docs/sphinx/examples/python -name '*.py' -not -path '*/building_kernels.py'`; do
file="${ex#docs/sphinx/examples/python/}"
echo "__Example ${file}:__" >> /tmp/validation.out
(docker exec wheel-validation-examples bash -c "python${{ inputs.python_version }} /tmp/examples/$file" >> /tmp/validation.out) && success=true || success=false
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/repo_checks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
on:
workflow_dispatch:
pull_request:
merge_group:
types:
- checks_requested

name: "Basic content checks"

Expand Down Expand Up @@ -82,10 +85,10 @@ jobs:
create_output cxx '*.cpp *.h *.hpp :!:test :!:targettests :!:tpls :!:**/nlopt-src/*'
create_output cxx_headers '*.h *.hpp :!:test :!:targettests :!:tpls :!:**/nlopt-src/*'
create_output cxx_examples 'docs/sphinx/examples/**/*.cpp'
create_output cxx_examples 'docs/sphinx/examples/**/*.cpp' 'docs/sphinx/applications/cpp/*.cpp' 'docs/sphinx/targets/cpp/*.cpp'
create_output python '*.py :!:python/tests :!:test :!:targettests :!:tpls :!:docs/sphinx/conf.py'
create_output markdown '*.md :!:tpls'
create_output rst '*.rst :!:tpls'
create_output rst '*.rst :!:tpls :!:docs/sphinx/_templates/**/*.rst'
echo "json=$(echo $json)" >> $GITHUB_OUTPUT
formatting:
Expand Down
Loading

0 comments on commit aa1695f

Please sign in to comment.