From 2b15d02bf4f53a3856d0b7a743c2828c40b279a3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 3 Nov 2021 14:27:58 -0400 Subject: [PATCH 1/6] Version Bump `0.19.0` (#163) * Added auto version bump functionality to pl lightning (#159) * Added auto version bump functionality to pl lightning * Update .github/workflows/pre_release_version_bump.yml removed trailing white space * Update .github/workflows/post_release_version_bump.yml Co-authored-by: Jay Soni * Update .github/workflows/pre_release_version_bump.yml Co-authored-by: Jay Soni * removed flag for pennylane release as it is not required Co-authored-by: antalszava * Update pre_release_version_bump.yml (#160) * Update pre_release_version_bump.yml * Update pre_release_version_bump.yml * Update pre_release_version_bump.yml * Update .github/workflows/pre_release_version_bump.yml * Apply suggestions from code review * Update post_release_version_bump.yml swap main --> master * Update CHANGELOG.md To be consistent with other plugins and not cause errors for the auto version bumping * pre release version bump * updates * Update pennylane_lightning/_version.py * formatting updates to changelog Co-authored-by: Jay Soni Co-authored-by: antalszava Co-authored-by: antalszava --- .github/CHANGELOG.md | 22 +-- .github/workflows/changelog_template.txt | 17 ++ .../workflows/post_release_version_bump.yml | 39 ++++ .../workflows/pre_release_version_bump.yml | 37 ++++ .github/workflows/vb_script.py | 167 ++++++++++++++++++ pennylane_lightning/_version.py | 2 +- 6 files changed, 270 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/changelog_template.txt create mode 100644 .github/workflows/post_release_version_bump.yml create mode 100644 .github/workflows/pre_release_version_bump.yml create mode 100644 .github/workflows/vb_script.py diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 1cead9fdac..5a655bb7ed 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,26 +1,22 @@ -# Release 0.19.0-dev (development release) - -### New features since last release +# Release 0.19.0 ### Improvements * The performance of parametric gates has been improved. -[(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157) + [(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157) * AVX support is enabled for Linux users on Intel/AMD platforms. -[(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157) - -* PennyLane-Lightning has been updated to conform with clang-tidy recommendations for modernization, offering performance improvements across all use-cases. -[(#153)](https://github.com/PennyLaneAI/pennylane-lightning/pull/153) + [(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157) -### Documentation +* PennyLane-Lightning has been updated to conform with clang-tidy + recommendations for modernization, offering performance improvements across + all use-cases. + [(#153)](https://github.com/PennyLaneAI/pennylane-lightning/pull/153) ### Breaking changes -* Linux users on x86_64 must have a CPU supporting AVX. -[(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157) - -### Bug fixes +* Linux users on `x86_64` must have a CPU supporting AVX. + [(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157) ### Contributors diff --git a/.github/workflows/changelog_template.txt b/.github/workflows/changelog_template.txt new file mode 100644 index 0000000000..4482cede21 --- /dev/null +++ b/.github/workflows/changelog_template.txt @@ -0,0 +1,17 @@ +# Release x.x.x-dev + +### New features since last release + +### Breaking changes + +### Improvements + +### Documentation + +### Bug fixes + +### Contributors + +This release contains contributions from (in alphabetical order): + +--- diff --git a/.github/workflows/post_release_version_bump.yml b/.github/workflows/post_release_version_bump.yml new file mode 100644 index 0000000000..fea3780732 --- /dev/null +++ b/.github/workflows/post_release_version_bump.yml @@ -0,0 +1,39 @@ +name: Automated Release Version Bumps + +on: + release: + types: [published] + +jobs: + post_release_version_bump: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v2 + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pennylane + + - name: Run version bump + run: > + python .github/workflows/vb_script.py + --version_path "./pennylane_lightning/_version.py" + --changelog_path "./.github/CHANGELOG.md" --post_release + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: post release version bump + title: Version Bump + body: updated changelog and _version.py + branch: post-release-version-bump + reviewers: antalszava + base: master diff --git a/.github/workflows/pre_release_version_bump.yml b/.github/workflows/pre_release_version_bump.yml new file mode 100644 index 0000000000..6dd844b112 --- /dev/null +++ b/.github/workflows/pre_release_version_bump.yml @@ -0,0 +1,37 @@ +name: Manually Triggered Version Bumps + +on: + workflow_dispatch: + +jobs: + pre_release_version_bump: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v2 + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pennylane + + - name: Run version bump + run: > + python .github/workflows/vb_script.py + --version_path "./pennylane_lightning/_version.py" + --changelog_path "./.github/CHANGELOG.md" --pre_release + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: pre release version bump + title: Version Bump + body: updated changelog and _version.py + branch: pre-release-version-bump + reviewers: antalszava + base: master diff --git a/.github/workflows/vb_script.py b/.github/workflows/vb_script.py new file mode 100644 index 0000000000..06c1cada28 --- /dev/null +++ b/.github/workflows/vb_script.py @@ -0,0 +1,167 @@ +# Copyright 2018-2021 Xanadu Quantum Technologies Inc. + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import argparse +import pennylane as qml +pl_version = '"' + qml.version() + '"' + + +def bump_version(version_line, pre_release): + """ A helper function which takes the current version string and + replaces it with the bumped version depending on the pre/post + release flag. + + Args: + version_line (string): The string containing the current + version of the plugin. + pre_release (bool): A flag which determines if this is a + pre-release or post-release version bump. + + Returns: + resultant_line (string): A string of the same form as the version line + with the version number replaced with the bumped version. + bumped_version (string): The bumped version string. + """ + data = version_line.split(" ") + curr_version = data[-1] + + if pre_release: + curr_version = pl_version # get current Pennylane version + + split_version = curr_version.split(".") # "0.17.0" --> ["0,17,0"] + split_version[1] = str(int(split_version[1]) + 1) # take middle value and cast as int and bump it by 1 + + if not pre_release: + split_version[2] = split_version[2].replace('"', '-dev"') # add -dev, ["0,18,0"] --> ["0,18,0-dev"] + + bumped_version = ".".join(split_version) + data[-1] = bumped_version + return " ".join(data), bumped_version + + +def update_version_file(path, pre_release=True): + """ Updates the __version__ attribute in a specific version file. + + Args: + path (str): The path to the version file. + pre_release (bool): A flag which determines if this is a + pre-release or post-release version bump. + + Return: + new_version (str): The bumped version string. + """ + with open(path, 'r', encoding="utf8") as f: + lines = f.readlines() + + with open(path, 'w', encoding="utf8") as f: + for line in lines: + if "__version__" in line.split(' '): + new_line, new_version = bump_version(line, pre_release) + f.write(new_line) + else: + f.write(line) + return new_version + + +def remove_empty_headers(lines): + """ Takes a paragraph (list of strings) and removes sections which are empty. + Where a section begins with a header (### Header_Title). + + Args: + lines (list[string]): The paragraph containing the changelog sections. + + Returns: + cleaned_lines (list[string]): The paragraph with empty sections removed. + """ + cleaned_lines = [] + pntr1 = 0 + + while pntr1 < len(lines): + is_empty = True + for pntr2 in range(pntr1 + 1, len(lines)): + line2 = lines[pntr2] + + if (len(line2) >= 4) and (line2[:4] == "### "): + if (pntr1 == 0) or (not is_empty): + cleaned_lines.extend(lines[pntr1:pntr2]) # keep these sections! + + pntr1 = pntr2 + is_empty = True # reset the empty flag + + elif line2 == '\n': + pass + + else: + is_empty = False + + cleaned_lines.extend(lines[pntr1:pntr1+1]) + pntr1 += 1 + + return cleaned_lines + + +def update_changelog(path, new_version, pre_release=True): + """ Updates the Changelog file depending on whether it's a pre-release + or post-release version bump. + + Args: + path (str): The path to the changelog file. + new_version (str): The bumped version string. + pre_release (bool): A flag which determines if this is a + pre-release or post-release version bump. + """ + with open(path, 'r', encoding="utf8") as f: + lines = f.readlines() + end_of_section_index = 0 + for index, line in enumerate(lines): + if (len(line) >= 3) and (line[:3] == "---"): + end_of_section_index = index + break + + with open(path, 'w', encoding="utf8") as f: + if not pre_release: # post_release append template to top of the changelog + with open("./.github/workflows/changelog_template.txt", 'r', encoding="utf8") as template_f: + template_lines = template_f.readlines() + template_lines[0] = template_lines[0].replace('x.x.x-dev', new_version) + f.writelines(template_lines) + f.writelines(lines) + + else: # pre_release update the release header and remove any empty headers + # update release header + line = lines[0] + split_line = line.split(" ") + split_line[-1] = new_version # replace version (split_line = [#, Release, 0.17.0-dev]) + new_line = " ".join(split_line) + '\n' + f.write(new_line) + + # remover empty headers + cleaned_lines = remove_empty_headers(lines[1:end_of_section_index]) + f.writelines(cleaned_lines) + + # keep the rest of the changelog + rest_of_changelog_lines = lines[end_of_section_index:] + f.writelines(rest_of_changelog_lines) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--version_path", type=str, required=True, help="Path to the _version.py file") + parser.add_argument("--changelog_path", type=str, required=True, help="Path to the changelog") + parser.add_argument("--pre_release", dest="release_status", action="store_true", + help="True if this is a pre-release version bump, False if it is post release") + parser.add_argument("--post_release", dest="release_status", action="store_false", + help="True if this is a pre-release version bump, False if it is post release") + + args = parser.parse_args() + updated_version = update_version_file(args.version_path, args.release_status) + update_changelog(args.changelog_path, updated_version, args.release_status) diff --git a/pennylane_lightning/_version.py b/pennylane_lightning/_version.py index 371d0ed563..8af13ea3e5 100644 --- a/pennylane_lightning/_version.py +++ b/pennylane_lightning/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.19.0-dev" +__version__ = "0.19.0" From 6b570ed818d91b1db0faeb03fe930ab03df14549 Mon Sep 17 00:00:00 2001 From: Lee James O'Riordan Date: Mon, 8 Nov 2021 16:58:20 +0000 Subject: [PATCH 2/6] Fix OpenMP library issues on M1 Macs (#166) * Fix OMP issue on M1 macs * Update changelog --- .github/CHANGELOG.md | 6 ++++++ .github/workflows/wheel_macos_arm64.yml | 1 - .github/workflows/wheel_macos_x86_64.yml | 1 + setup.py | 15 ++++++++++----- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 5a655bb7ed..b2efbfef22 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -18,6 +18,12 @@ * Linux users on `x86_64` must have a CPU supporting AVX. [(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157) +### Bug fixes + +* OpenMP built with Intel MacOS CI runners causes failures on M1 Macs. OpenMP is currently + disabled in the built wheels until this can be resolved with Github Actions runners. + [(#166)](https://github.com/PennyLaneAI/pennylane-lightning/pull/166) + ### Contributors This release contains contributions from (in alphabetical order): diff --git a/.github/workflows/wheel_macos_arm64.yml b/.github/workflows/wheel_macos_arm64.yml index c0b83ab86c..b743ccad1e 100644 --- a/.github/workflows/wheel_macos_arm64.yml +++ b/.github/workflows/wheel_macos_arm64.yml @@ -10,7 +10,6 @@ env: # MacOS specific build settings CIBW_BEFORE_ALL_MACOS: | brew uninstall --force oclint - brew install libomp # Python build settings CIBW_BEFORE_BUILD: | diff --git a/.github/workflows/wheel_macos_x86_64.yml b/.github/workflows/wheel_macos_x86_64.yml index e267e78294..8215afec76 100644 --- a/.github/workflows/wheel_macos_x86_64.yml +++ b/.github/workflows/wheel_macos_x86_64.yml @@ -57,6 +57,7 @@ jobs: run: python -m cibuildwheel --output-dir wheelhouse env: CIBW_ARCHS_MACOS: ${{matrix.arch}} + USE_OMP: 1 - uses: actions/upload-artifact@v2 if: github.ref == 'refs/heads/master' diff --git a/setup.py b/setup.py index cc81e890e6..399e90a858 100644 --- a/setup.py +++ b/setup.py @@ -91,11 +91,16 @@ class BuildExt(build_ext): opts["unix"].remove("-fopenmp") opts["unix"].remove("-shared") - darwin_opts = [ - "-stdlib=libc++", - "-Xpreprocessor", - "-fopenmp", - ] + darwin_opts = ["-stdlib=libc++"] + + # Used to enable OpenMP only on Intel + # Macs due to CI available of M1 + if os.environ.get("USE_OMP"): + darwin_opts.extend([ + "-Xpreprocessor", + "-fopenmp", + ]) + darwin_opts.append("-mmacosx-version-min=10.14") c_opts["unix"] += darwin_opts From 2798d5b733983d1f635d95d13d2447bea9db91d4 Mon Sep 17 00:00:00 2001 From: Lee James O'Riordan Date: Mon, 8 Nov 2021 17:55:34 +0000 Subject: [PATCH 3/6] Fix CI builder release issues (#168) * Fix OMP issue on M1 macs * Update changelog * Fix CI builder --- .github/workflows/deploy.yml | 5 +++-- .github/workflows/wheel_linux_aarch64.yml | 2 ++ .github/workflows/wheel_linux_ppc64le.yml | 2 ++ .github/workflows/wheel_linux_x86_64.yml | 2 ++ .github/workflows/wheel_macos_arm64.yml | 2 ++ .github/workflows/wheel_macos_x86_64.yml | 2 ++ .github/workflows/wheel_win_x86_64.yml | 2 ++ 7 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f9d3fdc0ee..2e621b4bf8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,8 +10,7 @@ env: # MacOS specific build settings CIBW_BEFORE_ALL_MACOS: | - brew cask uninstall --force oclint - brew install clang libomp + brew install libomp # Python build settings CIBW_BEFORE_BUILD: | @@ -45,6 +44,7 @@ jobs: cibw_archs: ppc64le - os: macos-latest cibw_archs: arm64 + enable_omp: 0 steps: - name: Cancel Previous Runs @@ -72,6 +72,7 @@ jobs: python -m cibuildwheel --output-dir dist env: CIBW_ARCHS: ${{ matrix.cibw_archs }} + USE_OMP: ${{ matrix.enable_omp }} # Disabled for MacOS - uses: actions/upload-artifact@v2 with: diff --git a/.github/workflows/wheel_linux_aarch64.yml b/.github/workflows/wheel_linux_aarch64.yml index 46c1644876..9dc9fbe988 100644 --- a/.github/workflows/wheel_linux_aarch64.yml +++ b/.github/workflows/wheel_linux_aarch64.yml @@ -3,6 +3,8 @@ on: push: branches: - master + release: + types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_linux_ppc64le.yml b/.github/workflows/wheel_linux_ppc64le.yml index 10f2e7537a..d1e6b9f35d 100644 --- a/.github/workflows/wheel_linux_ppc64le.yml +++ b/.github/workflows/wheel_linux_ppc64le.yml @@ -3,6 +3,8 @@ on: push: branches: - master + release: + types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_linux_x86_64.yml b/.github/workflows/wheel_linux_x86_64.yml index 8925ce5096..26f280fe8c 100644 --- a/.github/workflows/wheel_linux_x86_64.yml +++ b/.github/workflows/wheel_linux_x86_64.yml @@ -4,6 +4,8 @@ on: branches: - master pull_request: + release: + types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_macos_arm64.yml b/.github/workflows/wheel_macos_arm64.yml index b743ccad1e..93f2d783bc 100644 --- a/.github/workflows/wheel_macos_arm64.yml +++ b/.github/workflows/wheel_macos_arm64.yml @@ -3,6 +3,8 @@ on: push: branches: - master + release: + types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_macos_x86_64.yml b/.github/workflows/wheel_macos_x86_64.yml index 8215afec76..de5cc26e23 100644 --- a/.github/workflows/wheel_macos_x86_64.yml +++ b/.github/workflows/wheel_macos_x86_64.yml @@ -4,6 +4,8 @@ on: branches: - master pull_request: + release: + types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_win_x86_64.yml b/.github/workflows/wheel_win_x86_64.yml index b9826b6afa..cdac3d0d1f 100644 --- a/.github/workflows/wheel_win_x86_64.yml +++ b/.github/workflows/wheel_win_x86_64.yml @@ -4,6 +4,8 @@ on: branches: - master pull_request: + release: + types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' From 983ed03c9fea89ea80229defef09e2da34ff957a Mon Sep 17 00:00:00 2001 From: "Lee J. O'Riordan" Date: Mon, 8 Nov 2021 18:06:35 +0000 Subject: [PATCH 4/6] Trigger CI on release creation --- .github/workflows/wheel_linux_ppc64le.yml | 2 +- .github/workflows/wheel_linux_x86_64.yml | 6 +++--- .github/workflows/wheel_macos_arm64.yml | 3 +-- .github/workflows/wheel_macos_x86_64.yml | 3 +-- .github/workflows/wheel_win_x86_64.yml | 3 +-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/wheel_linux_ppc64le.yml b/.github/workflows/wheel_linux_ppc64le.yml index d1e6b9f35d..cc414d716d 100644 --- a/.github/workflows/wheel_linux_ppc64le.yml +++ b/.github/workflows/wheel_linux_ppc64le.yml @@ -1,4 +1,4 @@ -name: Wheels +name: Wheel::Linux::PowerPC on: push: branches: diff --git a/.github/workflows/wheel_linux_x86_64.yml b/.github/workflows/wheel_linux_x86_64.yml index 26f280fe8c..003a3037ab 100644 --- a/.github/workflows/wheel_linux_x86_64.yml +++ b/.github/workflows/wheel_linux_x86_64.yml @@ -1,11 +1,11 @@ -name: Wheels +name: Wheel::Linux::x86_64 on: + release: push: branches: - master pull_request: - release: - types: [published] + env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_macos_arm64.yml b/.github/workflows/wheel_macos_arm64.yml index 93f2d783bc..7ec82d82c8 100644 --- a/.github/workflows/wheel_macos_arm64.yml +++ b/.github/workflows/wheel_macos_arm64.yml @@ -1,10 +1,9 @@ -name: Wheels +name: Wheel::MacOS::ARM on: push: branches: - master release: - types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_macos_x86_64.yml b/.github/workflows/wheel_macos_x86_64.yml index de5cc26e23..85163515ae 100644 --- a/.github/workflows/wheel_macos_x86_64.yml +++ b/.github/workflows/wheel_macos_x86_64.yml @@ -1,11 +1,10 @@ -name: Wheels +name: Wheel::MacOS::Intel on: push: branches: - master pull_request: release: - types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' diff --git a/.github/workflows/wheel_win_x86_64.yml b/.github/workflows/wheel_win_x86_64.yml index cdac3d0d1f..72c5c407ef 100644 --- a/.github/workflows/wheel_win_x86_64.yml +++ b/.github/workflows/wheel_win_x86_64.yml @@ -1,11 +1,10 @@ -name: Wheels +name: Wheel::Windows::x86_64 on: push: branches: - master pull_request: release: - types: [published] env: CIBW_BUILD: 'cp37-* cp38-* cp39-*' From 73a8f874d365359a5ca5055f9cd7b385651fd97d Mon Sep 17 00:00:00 2001 From: Lee James O'Riordan Date: Tue, 9 Nov 2021 10:21:57 +0000 Subject: [PATCH 5/6] CI wheelbuilder updates (#169) * Fix OMP with ARM MacOS * Ensure wheels uploaded to GH * Separate out noarch wheels --- .github/workflows/deploy.yml | 146 ---------------------- .github/workflows/wheel_linux_aarch64.yml | 4 +- .github/workflows/wheel_linux_ppc64le.yml | 2 +- .github/workflows/wheel_linux_x86_64.yml | 2 +- .github/workflows/wheel_macos_arm64.yml | 2 +- .github/workflows/wheel_macos_x86_64.yml | 2 +- .github/workflows/wheel_noarch.yml | 34 +++++ .github/workflows/wheel_win_x86_64.yml | 2 +- setup.py | 2 +- 9 files changed, 42 insertions(+), 154 deletions(-) delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/wheel_noarch.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 2e621b4bf8..0000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: Deploy -on: - release: - types: [published] - -env: - CIBW_BUILD: 'cp37-* cp38-* cp39-*' - CIBW_SKIP: "*-win32 *-manylinux_i686" - - # MacOS specific build settings - - CIBW_BEFORE_ALL_MACOS: | - brew install libomp - - # Python build settings - CIBW_BEFORE_BUILD: | - pip install pybind11 - - # Testing of built wheels - CIBW_TEST_REQUIRES: numpy==1.19.5 scipy pytest pytest-cov pytest-mock flaky - - CIBW_TEST_COMMAND: | - pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report - - # Skip ppc tests due to lack of scipy wheel - CIBW_TEST_SKIP: "*-manylinux_{ppc64le}" - - # Use Centos 7 wheel-builder for ARM - CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 - CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux2014 - -jobs: - build-compiled-wheels: - name: ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - cibw_archs: [auto64] - include: - - os: ubuntu-latest - cibw_archs: aarch64 - - os: ubuntu-latest - cibw_archs: ppc64le - - os: macos-latest - cibw_archs: arm64 - enable_omp: 0 - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 - with: - access_token: ${{ github.token }} - - - uses: actions/checkout@v2 - - - uses: docker/setup-qemu-action@v1 - name: Set up QEMU - if: ${{ matrix.cibw_archs == 'aarch64' || matrix.cibw_archs == 'ppc64le' }} - - - 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==2.1.1 - - - name: Build wheels - run: | - python -m cibuildwheel --output-dir dist - env: - CIBW_ARCHS: ${{ matrix.cibw_archs }} - USE_OMP: ${{ matrix.enable_omp }} # Disabled for MacOS - - - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.os }}-${{ matrix.cibw_archs }}-wheel - path: ./dist/*.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 - path: main/dist/*.whl - - upload-wheels: - runs-on: ubuntu-latest - needs: [build-compiled-wheels, build-pure-python-wheel] - steps: - - uses: actions/download-artifact@v2 - with: - path: dist/ - - - name: Extract wheels from zip - run: | - cd dist - 7z x *.zip - - - name: Publish - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI }} - - upload-source: - runs-on: ubuntu-latest - needs: [build-compiled-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 }} \ No newline at end of file diff --git a/.github/workflows/wheel_linux_aarch64.yml b/.github/workflows/wheel_linux_aarch64.yml index 9dc9fbe988..747c0af759 100644 --- a/.github/workflows/wheel_linux_aarch64.yml +++ b/.github/workflows/wheel_linux_aarch64.yml @@ -1,4 +1,4 @@ -name: Wheels +name: Wheel::Linux::ARM on: push: branches: @@ -57,7 +57,7 @@ jobs: CIBW_ARCHS_LINUX: ${{matrix.arch}} - uses: actions/upload-artifact@v2 - if: github.ref == 'refs/heads/master' + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} with: name: ${{ runner.os }}-wheels.zip path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/wheel_linux_ppc64le.yml b/.github/workflows/wheel_linux_ppc64le.yml index cc414d716d..0a5d77df01 100644 --- a/.github/workflows/wheel_linux_ppc64le.yml +++ b/.github/workflows/wheel_linux_ppc64le.yml @@ -54,7 +54,7 @@ jobs: CIBW_ARCHS_LINUX: ${{matrix.arch}} - uses: actions/upload-artifact@v2 - if: github.ref == 'refs/heads/master' + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} with: name: ${{ runner.os }}-wheels.zip path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/wheel_linux_x86_64.yml b/.github/workflows/wheel_linux_x86_64.yml index 003a3037ab..ce804edbf4 100644 --- a/.github/workflows/wheel_linux_x86_64.yml +++ b/.github/workflows/wheel_linux_x86_64.yml @@ -54,7 +54,7 @@ jobs: CIBW_ARCHS_LINUX: ${{matrix.arch}} - uses: actions/upload-artifact@v2 - if: github.ref == 'refs/heads/master' + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} with: name: ${{ runner.os }}-wheels.zip path: ./wheelhouse/*.whl diff --git a/.github/workflows/wheel_macos_arm64.yml b/.github/workflows/wheel_macos_arm64.yml index 7ec82d82c8..bd678bbc66 100644 --- a/.github/workflows/wheel_macos_arm64.yml +++ b/.github/workflows/wheel_macos_arm64.yml @@ -57,7 +57,7 @@ jobs: CIBW_ARCHS_MACOS: ${{ matrix.arch }} - uses: actions/upload-artifact@v2 - if: github.ref == 'refs/heads/master' + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} with: name: ${{ runner.os }}-wheels.zip path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/wheel_macos_x86_64.yml b/.github/workflows/wheel_macos_x86_64.yml index 85163515ae..ee0b9fb6ee 100644 --- a/.github/workflows/wheel_macos_x86_64.yml +++ b/.github/workflows/wheel_macos_x86_64.yml @@ -61,7 +61,7 @@ jobs: USE_OMP: 1 - uses: actions/upload-artifact@v2 - if: github.ref == 'refs/heads/master' + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} with: name: ${{ runner.os }}-wheels.zip path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/wheel_noarch.yml b/.github/workflows/wheel_noarch.yml new file mode 100644 index 0000000000..51a8912062 --- /dev/null +++ b/.github/workflows/wheel_noarch.yml @@ -0,0 +1,34 @@ +name: Wheel::Any::None +on: + push: + branches: + - master + pull_request: + release: + +jobs: + 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 + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} + with: + name: pure-python-wheels + path: main/dist/*.whl diff --git a/.github/workflows/wheel_win_x86_64.yml b/.github/workflows/wheel_win_x86_64.yml index 72c5c407ef..0a8b715643 100644 --- a/.github/workflows/wheel_win_x86_64.yml +++ b/.github/workflows/wheel_win_x86_64.yml @@ -45,7 +45,7 @@ jobs: uses: pypa/cibuildwheel@v1.12.0 - uses: actions/upload-artifact@v2 - if: github.ref == 'refs/heads/master' + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} with: name: ${{ runner.os }}-wheels.zip path: ./wheelhouse/*.whl diff --git a/setup.py b/setup.py index 399e90a858..6b630152a1 100644 --- a/setup.py +++ b/setup.py @@ -149,7 +149,7 @@ def build_extensions(self): libraries += ["openblas"] extra_link_args += ["-lopenblas"] - if platform.system() == "Darwin": + if platform.system() == "Darwin" and os.environ.get("USE_OMP"): include_dirs += ["/usr/local/opt/libomp/include"] library_dirs += ["/usr/local/opt/libomp/lib"] libraries += ["omp"] From 3a977d9d8f8ab23517c85bb408870260af09a278 Mon Sep 17 00:00:00 2001 From: antalszava Date: Wed, 10 Nov 2021 17:32:06 -0500 Subject: [PATCH 6/6] Update .github/CHANGELOG.md --- .github/CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index d37eb452e6..bfacc458f6 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -18,8 +18,6 @@ This release contains contributions from (in alphabetical order): # Release 0.19.0 -### New features since last release - ### Improvements * The performance of parametric gates has been improved.