Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into unitary-synthesis-unroll
Browse files Browse the repository at this point in the history
In Qiskit#6124 which recently merged the UnitarySynthesis pass was added to
preset passmanager to enable synthesis plugins that operate on > 2q from
having an impact (otherwise they wouldn't be called). However that PR
didn't have the option to avoid synthesizing 2q unitaries too early.
This commit updates the base branch to the latest state of main which
includes Qiskit#6124. This means this PR just adds a min_qubits option to
UnitarySynthesis and leverages it for the unroll3q stage in the
preset pass managers.
  • Loading branch information
mtreinish committed Sep 30, 2021
2 parents 657d096 + 4eda799 commit cd663a2
Show file tree
Hide file tree
Showing 483 changed files with 13,430 additions and 4,940 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Wheel Builds
on:
push:
tags:
- '*'
jobs:
build_wheels_aarch64:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.0.1 twine
- name: Build wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: cp27-* cp34-* cp35-* pp*
CIBW_BEFORE_BUILD: pip install -U Cython
CIBW_TEST_COMMAND: python {project}/examples/python/stochastic_swap.py
CIBW_ARCHS_LINUX: aarch64
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
- name: Upload to PyPI
run: twine upload ./wheelhouse/*.whl
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: qiskit
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ qiskit/quantum_info/states/cython/*.cpp
docs/stubs/*

# Notebook testing images
test/ipynb/mpl/*.png
test/ipynb/mpl/*.zip
test/ipynb/mpl/result_test.json
test/ipynb/mpl/circuit/*.png
test/ipynb/mpl/circuit/*.zip
test/ipynb/mpl/circuit/result_test.json
Expand Down
17 changes: 0 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,3 @@ jobs:
- pip install -U pip
- python setup.py build_ext --inplace
- make test_randomized

- name: Build aarch64 wheels
arch: arm64
services:
- docker
install:
- echo ""
env:
- CIBW_BEFORE_BUILD="pip install -U Cython"
- CIBW_SKIP="cp27-* cp34-* cp35-* pp*"
- TWINE_USERNAME=qiskit
- CIBW_TEST_COMMAND="python {project}/examples/python/stochastic_swap.py"
if: tag IS present
script:
- pip install -U twine importlib-metadata keyring cibuildwheel==1.9.0
- cibuildwheel --output-dir wheelhouse
- twine upload wheelhouse/*
115 changes: 57 additions & 58 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ stages:
TWINE_PASSWORD: $(TWINE_PASSWORD)
- job: 'macos'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
pool: {vmImage: 'macOS-latest'}
pool: {vmImage: 'macOS-10.15'}
variables:
python.version: '3.7'
CIBW_BEFORE_BUILD: pip install -U Cython
Expand All @@ -92,7 +92,7 @@ stages:
TWINE_PASSWORD: $(TWINE_PASSWORD)
- job: 'macos_arm'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
pool: {vmImage: 'macOS-latest'}
pool: {vmImage: 'macOS-10.15'}
variables:
python.version: '3.7'
CIBW_BEFORE_BUILD: pip install -U Cython
Expand Down Expand Up @@ -145,7 +145,7 @@ stages:
twine upload wheelhouse\*
env:
TWINE_PASSWORD: $(TWINE_PASSWORD)
- stage: 'Lint_and_Tests'
- stage: 'Lint_Docs_and_Tests'
dependsOn: []
jobs:
- job: 'Linux_Tests'
Expand Down Expand Up @@ -193,6 +193,7 @@ stages:
mkdir -p /tmp/terra-tests
cp -r test /tmp/terra-tests/.
cp .stestr.conf /tmp/terra-tests/.
cp -r .stestr /tmp/terra-tests/. || :
sudo apt install -y graphviz
pip check
displayName: 'Install dependencies'
Expand Down Expand Up @@ -225,11 +226,12 @@ stages:
pushd /tmp/terra-tests
mkdir -p junit
stestr last --subunit | ./subunit_to_junit.py -o junit/test-results.xml
popd
cp -r /tmp/terra-tests/junit .
pushd .stestr
ls | grep -P "^\d" | xargs -d "\n" rm -f
popd
popd
cp -r /tmp/terra-tests/junit .
cp -r /tmp/terra-tests/.stestr .
condition: succeededOrFailed()
displayName: 'Generate results'
- task: PublishTestResults@2
Expand Down Expand Up @@ -295,8 +297,54 @@ stages:
python tools/find_optional_imports.py
reno lint
displayName: 'Style and lint'
- job: 'Docs'
pool: {vmImage: 'ubuntu-latest'}
strategy:
matrix:
Python37:
python.version: '3.7'
variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "$(python.version)" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "$(python.version)"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: Cache pip
- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel
pip install -U tox
python setup.py build_ext --inplace
sudo apt install -y graphviz
displayName: 'Install dependencies'
- bash: |
tox -edocs
displayName: 'Run Docs build'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: 'docs/_build/html'
archiveType: tar
archiveFile: '$(Build.ArtifactStagingDirectory)/html_docs.tar.gz'
verbose: true
- task: PublishBuildArtifacts@1
displayName: 'Publish docs'
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'html_docs'
Parallel: true
ParallelCount: 8
- job: 'MacOS_Catalina_Tests'
pool: {vmImage: 'macOS-latest'}
pool: {vmImage: 'macOS-10.15'}
strategy:
matrix:
Python37:
Expand Down Expand Up @@ -451,8 +499,8 @@ stages:
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for Windows Python $(python.version)'
- stage: 'Python_Tests'
condition: and(succeeded('Lint_and_Tests'), not(startsWith(variables['Build.SourceBranch'], 'refs/tags')))
- stage: 'Python_Tests_and_Tutorials'
condition: and(succeeded('Lint_Docs_and_Tests'), not(startsWith(variables['Build.SourceBranch'], 'refs/tags')))
jobs:
- job: 'Windows_Tests'
pool: {vmImage: 'windows-latest'}
Expand Down Expand Up @@ -620,7 +668,7 @@ stages:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for Linux Python $(python.version)'
- job: 'MacOS_Catalina_Tests'
pool: {vmImage: 'macOS-latest'}
pool: {vmImage: 'macOS-10.15'}
strategy:
matrix:
Python36:
Expand Down Expand Up @@ -701,55 +749,6 @@ stages:
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for macOS Python $(python.version)'
- stage: 'Docs_and_Tutorials'
condition: and(succeeded('Python_Tests'), not(startsWith(variables['Build.SourceBranch'], 'refs/tags')))
jobs:
- job: 'Docs'
pool: {vmImage: 'ubuntu-latest'}
strategy:
matrix:
Python37:
python.version: '3.7'
variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
steps:
- checkout: self
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "$(python.version)" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "$(python.version)"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: Cache pip
- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel
pip install -U tox
python setup.py build_ext --inplace
sudo apt install -y graphviz
displayName: 'Install dependencies'
- bash: |
tox -edocs
displayName: 'Run Docs build'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: 'docs/_build/html'
archiveType: tar
archiveFile: '$(Build.ArtifactStagingDirectory)/html_docs.tar.gz'
verbose: true
- task: PublishBuildArtifacts@1
displayName: 'Publish docs'
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'html_docs'
Parallel: true
ParallelCount: 8
- job: 'Tutorials'
pool: {vmImage: 'ubuntu-latest'}
strategy:
Expand Down
4 changes: 4 additions & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ decorator==4.4.2
jax==0.2.13
jaxlib==0.1.67
networkx==2.5
importlib-metadata==4.6.4
# jsonschema pinning needed due nbformat==5.1.3 using deprecated behaviour in
# 4.0+. The pin can be removed after nbformat is updated.
jsonschema==3.2.0
10 changes: 0 additions & 10 deletions docs/_templates/autosummary/base.rst

This file was deleted.

68 changes: 30 additions & 38 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
{% if referencefile %}
.. include:: {{ referencefile }}
{% endif %}
{#
The general principle of this is that we manually document attributes here in
the same file, but give all methods their own page. By default, we document
all methods, including those defined by parent classes.
-#}

{{ objname }}
{{ underline }}
{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
{#-
Avoid having autodoc populate the class with the members we're about to
summarize to avoid duplication.
#}
:no-members:
:no-inherited-members:
:no-special-members:

{% block attributes_summary %}
{% if attributes %}

.. rubric:: Attributes

.. autosummary::
:toctree: ../stubs/
{% for item in all_attributes %}
{%- if not item.startswith('_') %}
{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
{% endblock %}

{% block methods_summary %}
{% if methods %}

:show-inheritance:
{#
Methods all get their own separate page, with their names and the first lines
of their docstrings tabulated. The documentation from `__init__` is
automatically included in the standard class documentation, so we don't want
to repeat it.
-#}
{% block methods_summary %}{% set wanted_methods = (methods | reject('==', '__init__') | list) %}{% if wanted_methods %}
.. rubric:: Methods

.. autosummary::
:nosignatures:
:toctree: ../stubs/
{% for item in all_methods %}
{%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in inherited_members %}
{%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %}
{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% for item in wanted_methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}{% endblock %}

{% endif %}
{% endblock %}
{% block attributes_summary %}{% if attributes %}
.. rubric:: Attributes
{# Attributes should all be summarized directly on the same page. -#}
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}{% endblock -%}
38 changes: 38 additions & 0 deletions docs/_templates/autosummary/class_no_inherited_members.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{#
This is very similar to the default class template, except this one is used
when we don't want to generate any inherited methods.
-#}

{{ objname | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
{#-
Avoid having autodoc populate the class with the members we're about to
summarize to avoid duplication.
#}
:no-members:
:show-inheritance:
{#
Methods all get their own separate page, with their names and the first lines
of their docstrings tabulated.
-#}
{% block methods_summary %}{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}{% if wanted_methods %}
.. rubric:: Methods Defined Here

.. autosummary::
:nosignatures:
:toctree: ../stubs/
{% for item in wanted_methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}{% endblock %}

{% block attributes_summary %}{% if attributes %}
.. rubric:: Attributes
{# Attributes should all be summarized directly on the same page. -#}
{% for item in attributes %}
.. autoattribute:: {{ item }}
{%- endfor %}
{% endif %}{% endblock -%}
Loading

0 comments on commit cd663a2

Please sign in to comment.