Skip to content

Commit

Permalink
Merge branch 'master' into unary_mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ddhawan11 authored Nov 22, 2024
2 parents e9d6c59 + 9c1292d commit 74884c6
Show file tree
Hide file tree
Showing 329 changed files with 9,610 additions and 11,306 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ body:
value: |
## Before posting a bug report
Search existing GitHub issues to make sure the issue does not already exist:
https://github.com/xanaduai/pennylane/issues
https://github.com/PennyLaneAI/pennylane/issues
For general technical details check out our documentation:
https://pennylane.readthedocs.io
https://docs.pennylane.ai
# Issue description
Description of the issue - include code snippets in the Source code section below and screenshots if relevant.
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ body:
value: |
## Before posting a feature request
Search existing GitHub issues to make sure the issue does not already exist:
https://github.com/xanaduai/pennylane/issues
https://github.com/PennyLaneAI/pennylane/issues
For general technical details check out our documentation:
https://pennylane.readthedocs.io
https://docs.pennylane.ai
# Feature description
Description of the feature request - include code snippets and screenshots here if relevant.
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/check_in_artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
echo "has_changes=$(git status --porcelain | wc -l | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Prepare Commit Author
id: prep_commit
if: steps.changed.outputs.has_changes != '0'
env:
HEAD_BRANCH_NAME: ${{ inputs.pull_request_head_branch_name }}
Expand All @@ -104,9 +105,11 @@ jobs:
if git ls-remote --exit-code origin "refs/heads/$HEAD_BRANCH_NAME"; then
echo "$HEAD_BRANCH_NAME exists! Checking out..."
git checkout "$HEAD_BRANCH_NAME"
echo "branch_exists='true'" >> $GITHUB_OUTPUT
else
echo "$HEAD_BRANCH_NAME does not exist! Creating..."
git checkout -b "$HEAD_BRANCH_NAME"
echo "branch_exists='false'" >> $GITHUB_OUTPUT
fi
- name: Stage changes
Expand All @@ -130,20 +133,20 @@ jobs:
PR_BODY: ${{ inputs.pull_request_body }}
run: |
EXISTING_PR="$(gh pr list --state open --base master --head $HEAD_BRANCH_NAME --json 'url' --jq '.[].url' | head -n 1)"
EXISTING_CLOSED_PR="$(gh pr list --state closed --base master --head $HEAD_BRANCH_NAME --json 'mergedAt,url' --jq '.[] | select(.mergedAt == null).url' | head -n 1)"
if [ -n "${EXISTING_PR}" ]; then
echo "PR already exists ==> ${EXISTING_PR}"
exit 0
else
if [ '${{ steps.prep_commit.outputs.branch_exists }}' = 'false' ]; then
echo "Creating PR..."
gh pr create --title "$PR_TITLE" --body "$PR_BODY"
exit 0
fi
EXISTING_CLOSED_PR="$(gh pr list --state closed --base master --head $HEAD_BRANCH_NAME --json 'mergedAt,url' --jq '.[] | select(.mergedAt == null).url' | head -n 1)"
if [ -n "${EXISTING_CLOSED_PR}" ]; then
echo "Reopening PR... ${EXISTING_CLOSED_PR}"
gh pr reopen "${EXISTING_CLOSED_PR}"
elif [ -n $EXISTING_PR ]; then
echo "Open PR already exists ==> $EXISTING_PR"
echo "Editing with provided title and body..."
gh pr edit --title "$PR_TITLE" --body "$PR_BODY"
else
echo "Reopening PR... $EXISTING_CLOSED_PR"
gh pr reopen "$EXISTING_CLOSED_PR"
echo "Editing with provided title and body..."
gh pr edit --title "$PR_TITLE" --body "$PR_BODY"
exit 0
fi
31 changes: 13 additions & 18 deletions .github/workflows/interface-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ on:
required: false
type: string
default: ''
disable_new_opmath:
description: Whether to disable the new op_math or not when running the tests
required: false
type: string
default: "False"
additional_python_packages:
description: Additional Python packages to install separated by a space
required: false
Expand Down Expand Up @@ -246,7 +241,7 @@ jobs:
${{ needs.default-dependency-versions.outputs.pytorch-version }}
${{ inputs.additional_python_packages }}
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: torch and not qcut and not finite-diff and not param-shift
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'torch.txt' || '' }}
Expand Down Expand Up @@ -282,7 +277,7 @@ jobs:
additional_pip_packages: ${{ inputs.additional_python_packages }}
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_markers: autograd and not qcut and not finite-diff and not param-shift


Expand Down Expand Up @@ -320,7 +315,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: tf and not qcut and not finite-diff and not param-shift
pytest_additional_args: --splits 3 --group ${{ matrix.group }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --splits 3 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_durations_file_path: '.github/durations/tf_tests_durations.json'
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'tf.txt' || '' }}

Expand Down Expand Up @@ -358,7 +353,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: jax and not qcut and not finite-diff and not param-shift
pytest_additional_args: --dist=loadscope --splits 4 --group ${{ matrix.group }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --dist=loadscope --splits 4 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_durations_file_path: '.github/durations/jax_tests_durations.json'
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'jax.txt' || '' }}

Expand Down Expand Up @@ -395,7 +390,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: core and not qcut and not finite-diff and not param-shift
pytest_additional_args: --splits 6 --group ${{ matrix.group }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --splits 6 --group ${{ matrix.group }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_durations_file_path: '.github/durations/core_tests_durations.json'
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'core.txt' || '' }}

Expand Down Expand Up @@ -435,7 +430,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: all_interfaces
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
requirements_file: ${{ github.event_name == 'schedule' && strategy.job-index == 0 && 'all_interfaces.txt' || '' }}


Expand Down Expand Up @@ -468,9 +463,9 @@ jobs:
python_version: ${{ matrix.python-version }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: external
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
additional_pip_packages: |
pyzx matplotlib stim quimb mitiq ply
pyzx matplotlib stim quimb==1.8.4 mitiq ply
git+https://github.com/PennyLaneAI/pennylane-qiskit.git@master
${{ needs.default-dependency-versions.outputs.jax-version }}
${{ needs.default-dependency-versions.outputs.tensorflow-version }}
Expand Down Expand Up @@ -515,7 +510,7 @@ jobs:
python_version: ${{ matrix.python-version }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: qcut
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
additional_pip_packages: |
kahypar==1.1.7
opt_einsum
Expand Down Expand Up @@ -557,7 +552,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: qchem
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
additional_pip_packages: |
openfermionpyscf basis-set-exchange
${{ inputs.additional_python_packages }}
Expand Down Expand Up @@ -592,7 +587,7 @@ jobs:
branch: ${{ inputs.branch }}
coverage_artifact_name: gradients-${{ matrix.config.suite }}-coverage
python_version: ${{ matrix.python-version }}
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
additional_pip_packages: |
${{ needs.default-dependency-versions.outputs.jax-version }}
${{ needs.default-dependency-versions.outputs.tensorflow-version }}
Expand Down Expand Up @@ -632,7 +627,7 @@ jobs:
python_version: ${{ matrix.python-version }}
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_additional_args: --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_markers: data
additional_pip_packages: |
h5py
Expand Down Expand Up @@ -681,7 +676,7 @@ jobs:
additional_pip_packages_post: ${{ needs.default-dependency-versions.outputs.pennylane-lightning-latest }}
pytest_test_directory: pennylane/devices/tests
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_additional_args: --device=${{ matrix.config.device }} --shots=${{ matrix.config.shots }} --disable-opmath=${{ inputs.disable_new_opmath }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}
pytest_additional_args: --device=${{ matrix.config.device }} --shots=${{ matrix.config.shots }} -W ${{ inputs.python_warning_level }} ${{ inputs.python_warning_level != 'default' && '--continue-on-collection-errors' || '' }}


upload-to-codecov:
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/legacy_op_math.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,3 @@ jobs:
```
git commit --allow-empty -m 'trigger ci'
```
# TODO: This will be added separately in a future PR
# upload-durations-files:
# needs: tests
# uses: ./.github/workflows/check_in_artifact.yml
# if: github.event_name == 'push'
# with:
# artifact_name_pattern: '*-durations.json'
# artifact_save_path: '.github/durations/'
# pull_request_head_branch_name: bot/durations-update
# commit_message_description: Durations Update
# pull_request_title: Update durations files
# pull_request_body: |
# Automatic update of durations files to snapshot valid python environments.

# Because bots are not able to trigger CI on their own, please do so by pushing an empty commit to this branch using the following command:

# ```
# git commit --allow-empty -m 'trigger ci'
# ```
63 changes: 63 additions & 0 deletions .github/workflows/update-durations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow is designed to run unit tests and open a pull request to update
# JSON files that store test durations for better load balancing

name: Update Durations
on:
workflow_dispatch:
# Scheduled trigger every Saturday at 2:47am UTC
schedule:
- cron: '47 2 * * 6'

concurrency:
group: update-durations-${{ github.ref }}
cancel-in-progress: true

jobs:
update-durations:
uses: ./.github/workflows/interface-unit-tests.yml
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
branch: master
upload_to_codecov: false
run_lightened_ci: true
skip_ci_test_jobs: 'torch-tests,autograd-tests,all-interfaces-tests,external-libraries-tests,qcut-tests,qchem-tests,gradients-tests,data-tests,device-tests'

merge-durations-files:
needs: update-durations
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: durations-*
path: ./
merge-multiple: false

- name: Merge artifacts into single file
run: |
mkdir durations
jq -s 'add' durations-core-*/*.json > durations/core_tests_durations.json
jq -s 'add' durations-jax-*/*.json > durations/jax_tests_durations.json
jq -s 'add' durations-tf-*/*.json > durations/tf_tests_durations.json
- name: Upload combined durations artifacts
uses: actions/upload-artifact@v4
with:
name: merged-durations
path: ./durations
include-hidden-files: true

upload-durations:
needs:
- update-durations
- merge-durations-files
uses: ./.github/workflows/check_in_artifact.yml
with:
artifact_name_pattern: "merged-durations"
artifact_save_path: ".github/durations"
merge_multiple: true
pull_request_head_branch_name: bot/update-durations
commit_message_description: Update test durations
pull_request_title: Update test durations
pull_request_body: Automatic update of test duration files
14 changes: 0 additions & 14 deletions doc/code/qml_utils.rst

This file was deleted.

2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
# built documents.

import pennylane
pennylane.Hamiltonian = pennylane.ops.op_math.linear_combination.Hamiltonian

pennylane.Hamiltonian = pennylane.ops.Hamiltonian

# The full version, including alpha/beta/rc tags.
release = pennylane.__version__
Expand Down
Loading

0 comments on commit 74884c6

Please sign in to comment.