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

Speed up assembling of noise model for circuits without delays #1410

Closed
wants to merge 1 commit into from

Conversation

itoko
Copy link
Contributor

@itoko itoko commented Dec 16, 2021

Summary

The commit fixes the remaining minor performance issue introduced at #1391 by skipping the run of noise pass manager for circuits without delays.

Fixes #1407 (performance regression) completely in addition to the major fix #1408.

@itoko
Copy link
Contributor Author

itoko commented Dec 16, 2021

I've confirmed that this PR significantly reduces the assemble time of noisy simulation of circuits without delays.

Without this PR:
TRANSPILE TIME TAKEN: 66.19
ASSEMBLE TIME TAKEN: 5.05
RUN QOBJ TIME TAKEN: 6.21

With this PR:
TRANSPILE TIME TAKEN: 63.55
ASSEMBLE TIME TAKEN: 1.17
RUN QOBJ TIME TAKEN: 6.41

Using the following code

import time
import numpy as np
from qiskit_experiments.library import StandardRB
from qiskit.providers.aer import AerSimulator
from qiskit.test.mock import FakeParis

backend = AerSimulator.from_backend(FakeParis())

start = time.time()
lengths = np.arange(1, 1000, 100)
num_samples = 10
seed = 1010
qubits = [0]

# Run an RB experiment on qubit 0
exp = StandardRB(qubits, lengths, num_samples=num_samples, seed=seed)

# Step by step
from qiskit import transpile

# Generate and transpile circuits
start = time.time()
circuits = transpile(exp.circuits(), backend)
stop = time.time()
print("TRANSPILE TIME TAKEN: {:.2f}".format(stop - start))

# Simulator Assemble
start = time.time()
qobj = backend._assemble(circuits)
stop = time.time()
print("ASSEMBLE TIME TAKEN: {:.2f}".format(stop - start))

# Simulator Run
start = time.time()
result = backend._run(qobj)
stop = time.time()
print("RUN QOBJ TIME TAKEN: {:.2f}".format(stop - start))

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, but #1409 also has the same optimisation, but with less data iteration due to a new data structure it introduces. I think #1409 likely supersedes this.

Copy link
Member

@chriseclectic chriseclectic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @jakelishman said this is already covered by #1409 which includes this fix along with a fixes for other unnecessary iteration from qasm3 compiling, qerror_loc insertion, and qobj splitting.

@itoko
Copy link
Contributor Author

itoko commented Dec 17, 2021

Close as it's already covered by #1409

@itoko itoko closed this Dec 17, 2021
@itoko itoko deleted the speedup-assemble-noise-model branch December 20, 2021 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance regression in noise model loading for Qiskit Aer 0.10.0
3 participants