Skip to content

Commit

Permalink
Merge branch 'master' into v0.22.1_master
Browse files Browse the repository at this point in the history
  • Loading branch information
mlxd committed Mar 29, 2022
2 parents e3d0ec9 + e32fead commit e33a3f2
Show file tree
Hide file tree
Showing 75 changed files with 4,605 additions and 1,021 deletions.
44 changes: 44 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
# Release 0.23.0-dev

### New features since last release

* Add Lightning GBenchmark Suite.
[(#249)](https://github.com/PennyLaneAI/pennylane-lightning/pull/249)

* Add run-time and compile information in binary.
[(#253)](https://github.com/PennyLaneAI/pennylane-lightning/pull/253)

### Improvements

* Add `ENABLE_BLAS` build to CI checks.
[(#249)](https://github.com/PennyLaneAI/pennylane-lightning/pull/249)

* Add more `clang-tidy` checks and kernel tests.
[(#253)](https://github.com/PennyLaneAI/pennylane-lightning/pull/253)

* Skip over identity operations in `"lightning.qubit"`.
[(#268)](https://github.com/PennyLaneAI/pennylane-lightning/pull/268)

### Documentation

### Bug fixes

* Update tests to remove `JacobianTape`.
[(#260)](https://github.com/PennyLaneAI/pennylane-lightning/pull/260)

* Fix tests for MSVC.
[(#264)](https://github.com/PennyLaneAI/pennylane-lightning/pull/264)

* Fix `#include <cpuid.h>` for PPC and AArch64 in Linux.
[(#266)](https://github.com/PennyLaneAI/pennylane-lightning/pull/266)

* Remove deprecated tape execution methods.
[(#270)](https://github.com/PennyLaneAI/pennylane-lightning/pull/270)

### Contributors

This release contains contributions from (in alphabetical order):
Ali Asadi, Chae-Yeun Park, and Lee James O'Riordan

---

# Release 0.22.1

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
python-version: 3.7

- name: Install dependencies
run: sudo apt update && sudo apt -y install clang-tidy-12 cmake g++
run: sudo apt update && sudo apt -y install clang-tidy-12 cmake g++ libomp-12-dev
env:
DEBIAN_FRONTEND: noninteractive

Expand Down
89 changes: 84 additions & 5 deletions .github/workflows/tests.yml → .github/workflows/tests_linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing
name: Testing (Linux)
on:
push:
branches:
Expand All @@ -13,7 +13,7 @@ env:

jobs:
cpptests:
name: C++ tests
name: C++ tests (Linux)
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -30,13 +30,75 @@ jobs:
python-version: '3.7'

- uses: actions/checkout@v2
with:
fetch-depth: 2 # for codecov

- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc g++
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc g++ gcovr lcov

- name: Build and run unit tests
run: |
cmake . -BBuild -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON
cmake --build ./Build
mkdir -p ./Build/tests/results
./Build/pennylane_lightning/src/tests/runner --order lex --reporter junit --out ./Build/tests/results/report.xml
- name: Upload test results
uses: actions/upload-artifact@v2
if: always()
with:
name: ubuntu-test-report
path: Build/tests/results/report.xml

- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
check_name: Test Report (C++) on Ubuntu
files: Build/tests/results/report.xml

- name: Build and run unit tests for code Coverage
run: |
cmake pennylane_lightning/src -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON
cmake --build ./BuildCov
cd ./BuildCov
./tests/runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.1.0
with:
file: ./BuildCov/coverage.info
fail_ci_if_error: true

cpptestswithblas:
name: C++ tests (Linux, OpenBLAS)
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 }}

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'

- uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc g++ libopenblas-dev gcovr lcov

- name: Build and run unit tests
run: |
cmake . -BBuild -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=1
cmake . -BBuild -DCMAKE_BUILD_TYPE=Release -DENABLE_BLAS=ON -DBUILD_TESTS=1
cmake --build ./Build
mkdir -p ./Build/tests/results
./Build/pennylane_lightning/src/tests/runner --order lex --reporter junit --out ./Build/tests/results/report.xml
Expand All @@ -55,6 +117,21 @@ jobs:
check_name: Test Report (C++) on Ubuntu
files: Build/tests/results/report.xml

- name: Build and run unit tests for code coverage
run: |
cmake pennylane_lightning/src -BBuildCov -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON -DENABLE_COVERAGE=ON -DENABLE_BLAS=ON
cmake --build ./BuildCov
cd ./BuildCov
./tests/runner
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.0.1
with:
file: ./BuildCov/coverage.info
fail_ci_if_error: true

pythontests:
name: Python tests
runs-on: ${{ matrix.os }}
Expand All @@ -67,6 +144,7 @@ jobs:
uses: actions/checkout@v2
with:
path: main
fetch-depth: 2

- uses: actions/setup-python@v2
name: Install Python
Expand Down Expand Up @@ -103,6 +181,7 @@ jobs:
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
uses: codecov/codecov-action@v2.0.1
with:
file: coverage.xml
fail_ci_if_error: true
53 changes: 53 additions & 0 deletions .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Testing (Windows)
on:
push:
branches:
- master
pull_request:

jobs:
cpptests:
name: C++ tests (Windows)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Configure MSVC for amd64 # Use cl.exe as a default compiler
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

- name: Setup OpenCppCoverage and add to PATH
run: |
choco install OpenCppCoverage -y
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Build and run unit tests for code coverage
run: |
cmake ./pennylane_lightning/src -BBuild -DBUILD_TESTS=ON -DENABLE_OPENMP=OFF -DENABLE_WARNINGS=OFF
cmake --build ./Build --config Debug
mkdir -p ./Build/tests/results
.\Build\tests\Debug\runner.exe --order lex --reporter junit --out .\Build\tests\results\report.xml
OpenCppCoverage --sources pennylane_lightning\src --export_type cobertura:coverage.xml Build\tests\Debug\runner.exe
- name: Upload test results
uses: actions/upload-artifact@v2
if: always()
with:
name: windows-test-report
path: .\Build\tests\results\report.xml

- name: Upload Report to Codecov
uses: codecov/codecov-action@v2.0.1
with:
files: ./coverage.xml
fail_ci_if_error: true
3 changes: 2 additions & 1 deletion .github/workflows/tests_without_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
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
uses: codecov/codecov-action@v2.0.1
with:
file: coverage.xml
fail_ci_if_error: true
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
cmake_minimum_required(VERSION 3.14)

set(LOGO "
set(LOGO [=[
░█░░░▀█▀░█▀▀░█░█░▀█▀░█▀█░▀█▀░█▀█░█▀▀░░░░▄▀▄░█░█░█▀▄░▀█▀░▀█▀
░█░░░░█░░█░█░█▀█░░█░░█░█░░█░░█░█░█░█░░░░█\█░█░█░█▀▄░░█░░░█░
░▀▀▀░▀▀▀░▀▀▀░▀░▀░░▀░░▀░▀░▀▀▀░▀░▀░▀▀▀░▀░░░▀\░▀▀▀░▀▀░░▀▀▀░░▀░
")
]=])
message(${LOGO})

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version")

project(pennylane_lightning)

project(pennylane_lightning
DESCRIPTION "C++ stavector simulator bindings for PennyLane. "

DESCRIPTION "C++ state-vector simulator bindings for PennyLane. "
LANGUAGES CXX
)

Expand Down Expand Up @@ -44,6 +45,7 @@ endif()
option(ENABLE_CLANG_TIDY "Enable clang-tidy build checks" OFF)

# Compile options
option(ENABLE_COVERAGE "Enable code coverage" OFF)
option(ENABLE_WARNINGS "Enable warnings" ON)
option(ENABLE_NATIVE "Enable native CPU build tuning" OFF)
option(ENABLE_AVX "Enable AVX support" OFF)
Expand All @@ -53,7 +55,7 @@ option(ENABLE_BLAS "Enable BLAS" OFF)
# Other build options
option(BUILD_TESTS "Build cpp tests" OFF)
option(BUILD_EXAMPLES "Build cpp examples" OFF)

option(BUILD_BENCHMARKS "Enable cpp benchmarks" OFF)

# Process compile options
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/process_options.cmake")
Expand All @@ -67,6 +69,7 @@ FetchContent_Declare(pybind11
)
FetchContent_MakeAvailable(pybind11)


# All CMakeLists.txt in subdirectories use pennylane_lightning_compile_options and pennylane_lightning_external_libs
add_subdirectory(pennylane_lightning/src)

Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ clean:
find . -type d -name '__pycache__' -exec rm -r {} \+
rm -rf dist
rm -rf build
rm -rf BuildTests BuildBench
rm -rf BuildTests BuildBench BuildGBench
rm -rf .coverage coverage_html_report/
rm -rf tmp
rm -rf *.dat
Expand Down Expand Up @@ -120,3 +120,9 @@ check-tidy:
rm -rf ./Build
cmake . -BBuild -DENABLE_CLANG_TIDY=ON -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON
cmake --build ./Build

.PHONY: gbenchmark
gbenchmark:
rm -rf ./BuildGBench
cmake $(LIGHTNING_CPP_DIR) -BBuildGBench -DBUILD_BENCHMARKS=ON -DENABLE_OPENMP=ON -DENABLE_BLAS=ON -DCMAKE_BUILD_TYPE=Release
cmake --build ./BuildGBench --target utils apply_operations apply_multirz
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ and install the compilied library with
GPU support
-----------

For GPU support, `PennyLane-Lightning-GPU <https://github.com/PennyLaneAI/pennylane-lightning-gpu.git>`_ can be be installed by providing the optional ``[gpu]`` tag:
For GPU support, `PennyLane-Lightning-GPU <https://github.com/PennyLaneAI/pennylane-lightning-gpu>`_ can be installed by providing the optional ``[gpu]`` tag:

.. code-block:: console
Expand Down
7 changes: 5 additions & 2 deletions bin/cpp-files
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Output C/C++ files in json list"
)
parser.add_argument(
"--header-only", action='store_true', dest='header_only', help="whether only include header files"
)
parser.add_argument(
"paths", nargs="+", metavar="DIR", help="paths to the root source directories"
)
Expand All @@ -23,9 +26,9 @@ if __name__ == '__main__':

args = parser.parse_args()

files = set(get_cpp_files(args.paths))
files = set(get_cpp_files(args.paths, header_only = args.header_only))
if args.exclude_dirs:
files_excludes = set(get_cpp_files(args.exclude_dirs))
files_excludes = set(get_cpp_files(args.exclude_dirs, header_only = args.header_only))
files -= files_excludes

json.dump(list(files), sys.stdout)
Loading

0 comments on commit e33a3f2

Please sign in to comment.