-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow lightning.qubit to skip C++ compilation and provide a Python-on…
…ly binary (#129) * Makefile clean removes binary * Update lightning qubit to fallback to default qubit if binaries are unavailable * Tidy up test imports * Add skip to tests that do not make sense if lightning is default * Add test * Rename * Rename environment variable to be clearer * Add workflow for no binary * Update name of workflow * Update deploy * Update workflow * Update workflow * Update workflow * Update deploy workflow * Add to changelog * Remove pybind11 as a package dependency of lightning * Update makefile * Add mention of requirements.txt in installation instructions * Apply suggestions from code review Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com> * Fix line spacing * Update installation instructions * Update python version for RTD Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
252 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,120 @@ | ||
name: Deploy | ||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
CIBW_BUILD: 'cp37-* cp38-* cp39-*' | ||
|
||
# MacOS specific build settings | ||
|
||
CIBW_BEFORE_ALL_MACOS: | | ||
brew cask uninstall --force oclint | ||
brew install gcc libomp | ||
# Python build settings | ||
|
||
CIBW_BEFORE_BUILD: | | ||
pip install numpy==1.19.5 scipy pybind11 | ||
# Testing of built wheels | ||
CIBW_TEST_REQUIRES: numpy scipy pytest pytest-cov pytest-mock flaky | ||
|
||
CIBW_TEST_COMMAND: | | ||
pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report | ||
jobs: | ||
|
||
build-wheels: | ||
name: ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@0.4.1 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.7' | ||
|
||
- name: Install cibuildwheel | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install cibuildwheel==1.5.5 | ||
- name: Build wheels | ||
run: | | ||
python -m cibuildwheel --output-dir wheelhouse | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ runner.os }}-wheels.zip | ||
path: ./wheelhouse/*.whl | ||
|
||
upload-wheels: | ||
runs-on: ubuntu-latest | ||
needs: [build-wheels] | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: dist/ | ||
|
||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI }} | ||
|
||
upload-source: | ||
runs-on: ubuntu-latest | ||
needs: [build-wheels] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Build and install Plugin | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
python setup.py sdist | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI }} | ||
name: Deploy | ||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
CIBW_BUILD: 'cp37-* cp38-* cp39-*' | ||
|
||
# MacOS specific build settings | ||
|
||
CIBW_BEFORE_ALL_MACOS: | | ||
brew cask uninstall --force oclint | ||
brew install gcc libomp | ||
# Python build settings | ||
|
||
CIBW_BEFORE_BUILD: | | ||
pip install numpy==1.19.5 scipy pybind11 | ||
# Testing of built wheels | ||
CIBW_TEST_REQUIRES: numpy scipy pytest pytest-cov pytest-mock flaky | ||
|
||
CIBW_TEST_COMMAND: | | ||
pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report | ||
jobs: | ||
|
||
build-wheels: | ||
name: ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@0.4.1 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.7' | ||
|
||
- name: Install cibuildwheel | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install cibuildwheel==1.5.5 | ||
- name: Build wheels | ||
run: | | ||
python -m cibuildwheel --output-dir wheelhouse | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ runner.os }}-wheels.zip | ||
path: ./wheelhouse/*.whl | ||
|
||
build-pure-python-wheel: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout PennyLane-Lightning | ||
uses: actions/checkout@v2 | ||
with: | ||
path: main | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.7' | ||
|
||
- name: Build wheels | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
cd main | ||
python setup.py bdist_wheel | ||
env: | ||
SKIP_COMPILATION: True | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: pure-python-wheels.zip | ||
path: main/dist/*.whl | ||
|
||
upload-wheels: | ||
runs-on: ubuntu-latest | ||
needs: [build-wheels, build-pure-python-wheel] | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: dist/ | ||
|
||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI }} | ||
|
||
upload-source: | ||
runs-on: ubuntu-latest | ||
needs: [build-wheels, build-pure-python-wheel] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Build and install Plugin | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
python setup.py sdist | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Testing without binary | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
env: | ||
COVERAGE_FLAGS: "--cov=pennylane_lightning --cov-report=term-missing --cov-report=xml:../coverage.xml --no-flaky-report -p no:warnings --tb=native" | ||
|
||
jobs: | ||
pythontests: | ||
name: Python tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04] | ||
|
||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/cancel-workflow-action@0.4.1 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout PennyLane-Lightning | ||
uses: actions/checkout@v2 | ||
with: | ||
path: main | ||
|
||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: '3.7' | ||
|
||
- name: Get required Python packages | ||
run: | | ||
cd main | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Install lightning.qubit device | ||
run: | | ||
cd main | ||
pip install -e . | ||
env: | ||
SKIP_COMPILATION: True | ||
|
||
- name: Run PennyLane-Lightning unit tests | ||
run: | | ||
cd main/ | ||
pytest tests/ $COVERAGE_FLAGS | ||
pl-device-test --device lightning.qubit --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append | ||
pl-device-test --device lightning.qubit --shots=None --skip-ops $COVERAGE_FLAGS --cov-append | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1.0.12 | ||
with: | ||
file: coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.