Skip to main content

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

Metadata

Release files for qprof-qiskit 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qprof-qiskit 1.0.1
File Size Uploaded
qprof_qiskit-1.0.1.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qprof-qiskit 1.0.1
File Interpreter ABI Platform
qprof_qiskit-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.2 kB

Release files / qprof_qiskit-1.0.1.tar.gz

Download URL qprof_qiskit-1.0.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9e453b238b9f470f9042418d5784127e149c79c2c0e7fa8b09c7780dcb08c0a8
BLAKE2b-256 checksum
How to use checksums
95cdf44d8a103fb85a4cb0452833bef1deb7280980098ae15c83d0f2c94df950
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / qprof_qiskit-1.0.1-py3-none-any.whl

Download URL qprof_qiskit-1.0.1-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92e9dfd49cf165a15b53785db7e3bcad24e4a214e0cd08c121d007c40004694f
BLAKE2b-256 checksum
How to use checksums
e5921d7dcee054f8824db88666b8b9a6cf3ff003f33523e5156f2bc1d623367c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page