Skip to content
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

Quantum volume updates #1146

Merged
merged 7 commits into from
Jul 4, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions demonstrations/quantum_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

*Author: Olivia Di Matteo — Posted: 15 December 2020. Last updated: 15 April 2021.*

.. warning::
The data in this demo was originally generated using system calibration data from the ``ibmq_lima`` device,
which has since been retired. While the code now uses a fake version of the Lima device, the noise and calibration
may have shifted since the data was generated.
albi3ro marked this conversation as resolved.
Show resolved Hide resolved

Twice per year, a project called the TOP500 [#top500]_ releases a list of the
500 most powerful supercomputing systems in the world. However, there is a large
amount of variation in how supercomputers are built. They may run different
Expand Down Expand Up @@ -544,29 +549,22 @@ def heavy_output_set(m, probs):
#
# A token can be generated by logging into your IBM Q account `here <https://quantum-computing.ibm.com/login>`_ .
#
#
# .. note::
#
# Users can get a list of available IBM Q backends by importing IBM Q,
# specifying their provider and then calling: ``provider.backends()``
#
dev_lima = qml.device("qiskit.ibmq", wires=5, backend="ibmq_lima")


##############################################################################
#
# First, we can take a look at the arrangement of the qubits on the processor
# by plotting its hardware graph.

import matplotlib.pyplot as plt
import networkx as nx
from rustworkx.visualization import mpl_draw
from qiskit_ibm_runtime.fake_provider import FakeLimaV2

lima_hardware_graph = nx.Graph(dev_lima.backend.configuration().coupling_map)

nx.draw_networkx(
lima_hardware_graph,
node_color="cyan",
labels={x: x for x in range(dev_lima.num_wires)},
)
mpl_draw(FakeLimaV2().coupling_map.graph)


##############################################################################
Expand All @@ -586,13 +584,7 @@ def heavy_output_set(m, probs):
# we'll set up a local device to simulate its behaviour.
#

from qiskit.providers.aer import noise

noise_model = noise.NoiseModel.from_backend(dev_lima.backend)

dev_noisy = qml.device(
"qiskit.aer", wires=dev_lima.num_wires, shots=1000, noise_model=noise_model
)
dev_noisy = qml.device("qiskit.remote", wires=5, shots=1000, backend=FakeLimaV2())

##############################################################################
#
Expand All @@ -602,12 +594,10 @@ def heavy_output_set(m, probs):
# qubit placement and routing techniques [#sabre]_ in order to fit the circuits
# on the hardware graph in the best way possible.

coupling_map = dev_lima.backend.configuration().to_dict()["coupling_map"]

dev_noisy.set_transpile_args(
albi3ro marked this conversation as resolved.
Show resolved Hide resolved
**{
"optimization_level": 3,
"coupling_map": coupling_map,
"coupling_map": FakeLimaV2().coupling_map,
"layout_method": "sabre",
"routing_method": "sabre",
}
Expand Down Expand Up @@ -741,6 +731,7 @@ def heavy_output_set(m, probs):
# :math:`2\sigma` away from the threshold!
#

from matplotlib import pyplot as plt
fig, ax = plt.subplots(2, 2, sharex=True, sharey=True, figsize=(9, 6))
ax = ax.ravel()

Expand All @@ -761,6 +752,7 @@ def heavy_output_set(m, probs):
fig.suptitle("Heavy output distributions for (simulated) Lima QPU", fontsize=18)
plt.legend(fontsize=14)
plt.tight_layout()
plt.show()


##############################################################################
Expand Down
Loading