Skip to content

Commit

Permalink
Create benchmark stage in the pipeline
Browse files Browse the repository at this point in the history
- Unfortunatelly the pennylane [benchmark](https://github.com/PennyLaneAI/pennylane/tree/master/benchmark) folder is not available in the pip install version of pennylane. Therefore [pennylane](https://github.com/PennyLaneAI/pennylane) is added as submodule to the project.
- Created benchmark stage, the result of the benchmark can be downloaded from the pipeline.
- More info in the [README](README.md#benchmarking)
  • Loading branch information
CzBalti committed Aug 3, 2020
1 parent c19850d commit 5149e8e
Show file tree
Hide file tree
Showing 6 changed files with 580 additions and 31 deletions.
23 changes: 21 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
image: python:3.6

variables:
GIT_SUBMODULE_STRATEGY: normal #to use submodule

before_script:
- pip install poetry

stages:
- test
- build
Expand All @@ -8,16 +14,29 @@ unittest:
stage: test
script:
- pip install tox
- pip install poetry
- tox

benchmark:
stage: test
script:
- apt update
- apt-get install libeigen3-dev
- poetry install
- cd pennylane/benchmark/
- poetry run python benchmark.py -d default.qubit time bm_entangling_layers > ./output.txt
artifacts:
paths:
- pennylane/benchmark/output.txt
expire_in: 15 days


buildpackage:
stage: build
only:
- merge_requests
script:
- pip install poetry
- poetry config repositories.gitlab https://gitlab.inf.elte.hu/api/v4/projects/73/packages/pypi
- poetry config pypi-token.gitlab 1z5AF-A6zsitDWpwGP91
- poetry build
- poetry publish -r gitlab

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pennylane"]
path = pennylane
url = https://github.com/XanaduAI/pennylane.git
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on a machine running Fedora/CentOS (the rpm package is named `eigen3-devel`).
sudo apt install python3-venv
```

Additionally, this project uses `tox` to manage virtualenvs, install it with
Additionally, this project uses `tox` to manage virtualenvs, install it with:
```
pip install tox
```
Expand Down Expand Up @@ -100,3 +100,19 @@ https://python-poetry.org/docs/libraries/#publishing-to-a-private-repository
```
poetry publish -r gitlab
```
## Benchmarking
We can run benckmarks with various pennylane devices, for more details see:
https://github.com/XanaduAI/pennylane/blob/master/benchmark/README.rst
For instance:
```
cd pennylane/benchmark/
poetry run python benchmark.py -d default.qubit time bm_entangling_layers
```
### Notes:
Unfortunatelly running `benchmark.py` with `bm_mutable_rotations` or
`bm_mutable_complicated_params` will not work. There is a bug in both of these
in their `__init__()` function: they are expected to accept a named parameter
`qnode_type` but they don't. If you add the parameter by hand it will work
fine.

**The benchmarks, as of now, only work for qubit operations!**
1 change: 1 addition & 0 deletions pennylane
Submodule pennylane added at 968963
Loading

0 comments on commit 5149e8e

Please sign in to comment.