Skip to main content

qprof plugin for qiskit framework.

Project description

qprof_qiskit is a plugin for qprof. This plugin adds the support for the qiskit library to qprof.

Installation

qprof_qiskit being a Python module, it is installable with pip.

From Gitlab

git clone https://gitlab.com/qcomputing/qprof/qprof_qiskit.git
pip install qprof_qiskit/

From PyPi

Usage

Profiling

Profiling is performed with the qprof.profile function.

The qprof.profile function needs a quantum routine implemented with one of the supported frameworks along with the “base” gate times provided as a dictionary.

Example of profiling:

# Import the qprof tools
from qprof import profile

# Import the framework tools to generate a quantum routine
from qiskit.aqua.algorithms import Grover
from qiskit.aqua.components.oracles import LogicalExpressionOracle


# Generate the routine to benchmark.
input_3sat = """
c example DIMACS-CNF 3-SAT
p cnf 3 5
-1 -2 -3 0
1 -2 3 0
1 2 -3 0
1 -2 -3 0
-1 2 3 0
"""

oracle = LogicalExpressionOracle(input_3sat)
grover = Grover(oracle)
circuit = grover.construct_circuit()

# Hard-coded gate times retrieved by hand
gate_times = {"U1": 0, "U2": 89, "U3": 178, "CX": 930, "BARRIER": 0}

# Profile the resulting quantum circuit and use the "gprof" exporter
qprof_out = profile(circuit, gate_times, "gprof")

# Print to stdout the analysis report
print(qprof_out)

Full profiling example

Requirements for the example

You should have the dot tool installed on your machine, along with the gprof2dot tool that can be installed with pip install gprof2dot.

Profile the code

Let save the code of the previous section in a file profile.py.

You can generate the following graph with the command

python3 profile.py | gprof2dot | dot -Tpng -o profiling_result.png
docs/images/profile_result.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qprof_qiskit-1.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

qprof_qiskit-1.0.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file qprof_qiskit-1.0.1.tar.gz.

File metadata

  • Download URL: qprof_qiskit-1.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for qprof_qiskit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9e453b238b9f470f9042418d5784127e149c79c2c0e7fa8b09c7780dcb08c0a8
MD5 88036af5510d921d289d73141511bc9d
BLAKE2b-256 95cdf44d8a103fb85a4cb0452833bef1deb7280980098ae15c83d0f2c94df950

See more details on using hashes here.

File details

Details for the file qprof_qiskit-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: qprof_qiskit-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for qprof_qiskit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92e9dfd49cf165a15b53785db7e3bcad24e4a214e0cd08c121d007c40004694f
MD5 5bdfb7626de0be8ef78ea9dbd1421e7e
BLAKE2b-256 e5921d7dcee054f8824db88666b8b9a6cf3ff003f33523e5156f2bc1d623367c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page