-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow lightning.qubit to skip C++ compilation and provide a Python-only binary #129
Changes from all commits
252b0f8
09d1fe3
7e6ecfd
54ec268
69e35f1
10772da
b9f5f55
e9263ee
399820e
64d6941
17f1043
1c271eb
c651fdc
0357dbd
aa6af3e
f8026e1
2ce5a66
3c54052
edb3350
5e52b35
8e6ed64
df3bdef
bcf65af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder can we extract the artifacts create from the other wheel builder scripts, rather than rebuild here. Assuming a successful deploy, we fail to get the new architectures using this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get the new build scripts ( We can then:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, that sounds like a good plan. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! Are you ok if we do that in a separate PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, perfectly fine with me. |
||
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As with the above comment, I wonder if this should be offloaded into a separate build file, as the case for the other architectures. What do you think? |
||
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 | ||
Comment on lines
+61
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the main change |
||
|
||
upload-wheels: | ||
runs-on: ubuntu-latest | ||
needs: [build-wheels, build-pure-python-wheel] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also added job as a dependency |
||
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] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added as dependency, but not sure it's strictly needed. |
||
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 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Testing without binary | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very similar to the |
||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the diff for this file is not great, I believe my editor changed from
\r\n
to\n
for the new line style. The main changes are highlighted below.