-
Notifications
You must be signed in to change notification settings - Fork 3
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
first readme #2
Merged
Merged
first readme #2
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,85 @@ | ||
# qibojit-benchmarks | ||
# Benchmarking quantum simulation | ||
|
||
This repository contains benchmark scripts for quantum circuit simulation using | ||
[Qibo](https://github.com/qiboteam/qibo) and multiple simulation engines. | ||
|
||
## Installing prerequisites | ||
|
||
Before executing the simulation please: | ||
|
||
1. Install `Qibo >= 0.1.6rc1` from source or using: | ||
``` | ||
pip install qibo --pre | ||
``` | ||
|
||
2. Install qibojit simulation backends with: | ||
``` | ||
pip install qibojit | ||
``` | ||
Visit the [CuPy website](https://cupy.dev/) and install the binary/source code version that matches your CUDA version. | ||
|
||
3. (optional) Install qibotf simulation backend with: | ||
``` | ||
pip install qibotf | ||
``` | ||
This will install TensorFlow 2.5.0 automatically, please make sure you have the supported CUDA version. | ||
|
||
## Supported simulation backends | ||
|
||
- [qibojit](https://github.com/qiboteam/qibojit): uses numba on CPU and cupy on GPU for custom operations. | ||
- [qibotf](https://github.com/qiboteam/qibotf): uses tf primitives with custom operators on CPU and GPU. | ||
- [tensorflow](https://www.tensorflow.org/): uses tf default primitives. | ||
- [numpy](https://numpy.org/): single-threaded CPU implementation. | ||
|
||
For more details check the documentation [here](https://qibo.readthedocs.io/en/latest/installation.html). | ||
|
||
## Running the benchmarks | ||
|
||
The script in `benchmarks/main.py` executes the benchmark code following the supported configuration flags (check `python main.py -h`). | ||
|
||
``` | ||
$ python main.py -h | ||
|
||
usage: main.py [-h] [--nqubits NQUBITS] [--backend BACKEND] | ||
[--precision PRECISION] [--nreps NREPS] [--filename FILENAME] | ||
[--circuit CIRCUIT] [--params PARAMS] [--nshots NSHOTS] | ||
[--memory MEMORY] [--threading THREADING] [--transfer] | ||
|
||
optional arguments: | ||
-h, --help show this help message and exit | ||
--nqubits NQUBITS | ||
--backend BACKEND | ||
--precision PRECISION | ||
--nreps NREPS | ||
--filename FILENAME | ||
--circuit CIRCUIT | ||
--params PARAMS | ||
--nshots NSHOTS | ||
--memory MEMORY | ||
--threading THREADING | ||
--transfer | ||
``` | ||
|
||
Before executing the code keep in mind the following: | ||
- GPUs are the default devices for qibojit and qibotf. If you need CPU performance numbers do `export CUDA_VISIBLES_DEVICE=""` before executing the benchmark script. | ||
- CPU simulations by default use physical cores as number of threads with qibojit and qibotf. To control this behaviour without touching the code do `export OMP_NUM_THREADS=<threads>` (or `export NUMBA_NUM_THREADS=<threads>` for qibojit numba backend) before executing the benchmark script (note that ). | ||
- The benchmark script provides several options, including the possibility to modify the default numba threading pooling technology, see [docs](https://numba.pydata.org/numba-doc/latest/developer/threading_implementation.html#notes-on-numba-s-threading-implementation). | ||
|
||
## Benchmark output | ||
|
||
The benchmark script prints a summary of the circuit and user selected flags together with: | ||
- creation_time: time required to prepare the circuit for execution in seconds. | ||
- dry_run_execution_time: first execution performance, includes JIT timings in seconds. | ||
- dry_run_transfer_time: transfer time of results from GPU to CPU in seconds. | ||
- simulation_times: list of timings for simulation based on `nreps` in seconds. | ||
- transfer_times: list of timings for transfer of results form GPU to CPU in seconds. | ||
- simulation_time: average simulation time for `nreps` repetitions in seconds. | ||
- simulation_time_std: standard deviation of simulation_time in seconds. | ||
- transfer_time: average transfer time of results from GPU to CPU for `nreps` repetitions in seconds. | ||
- transfer_time_std: standard deviation of transfer_time in seconds. | ||
|
||
|
||
## Implemented circuits | ||
|
||
- `qft`: [quantum fourier transform](https://en.wikipedia.org/wiki/Quantum_Fourier_transform) | ||
- `variational_circuit`: variational quantum circuit layer as defined [in the docs]](https://qibo.readthedocs.io/en/latest/qibo.html#variational-layer) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not very important but the time to import qibo is also logged and in case the user performs measurements using the
--nshots
flag the measurement time is also logged.We should also mention somewhere that if the
--filename
flag is used these logs and times are also saved on disk in a json format.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.
Thanks, I think we should include that on the argparse help.