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

Circuit widths should be checked before compiling for backend #1949

Closed
nonhermitian opened this issue Mar 10, 2019 · 4 comments · Fixed by #2534
Closed

Circuit widths should be checked before compiling for backend #1949

nonhermitian opened this issue Mar 10, 2019 · 4 comments · Fixed by #2534
Labels
good first issue Good for newcomers type: enhancement It's working, but needs polishing

Comments

@nonhermitian
Copy link
Contributor

What is the expected enhancement?

Since we allow fior different width circuits in compile / transpile the width of the circuits should be validated to fit on the backend that they are being compiled for BEFORE actually being compiled. This prevents compiling many circuits only to have an exception thrown because a later one is not compatible with the backend.

@nonhermitian nonhermitian added the type: enhancement It's working, but needs polishing label Mar 11, 2019
@ajavadia ajavadia added the good first issue Good for newcomers label Apr 4, 2019
@Styps
Copy link

Styps commented Apr 19, 2019

Hi, I'm interested in taking on this issue. Just a few questions to clarify some things. It looks like with the 0.9 Qiskit release the new way to create your qobj will be with qiskit.compiler.transpile(), and then qiskit.tools.compile() will eventually be removed. Am I safe to assume that this would mainly just be an addition to transpile()? It also looks like the code in transpile() will be changed, as noted by the comment stating the current code "is a hack while we are still using the old transpiler", so should I hold off on any additions until the code is updated?

@ajavadia
Copy link
Member

ajavadia commented Apr 22, 2019

Hi @mstypulk, great!

I would say wait until #2166 is merged, as it extensively touches the same files you would be working with.

Yes, you should modify the transpile() function. In #2166 this function moves under qiskit.compiler.transpile().

Iniside this function, you have a list of circuits that are being transpiled, and a list of coupling_maps that are targeted (after some parsing is done -- this is a list of either CouplingMap objects, or None). The former determines the width (number of virtual qubits), the latter the number of physical qubits. You can do a simple compatibility check there.

Basically the circuits list and the coupling_map list must be element-wise compatible.

@Matt-Stypulkoski
Copy link
Contributor

Hi @ajavadia,

I've been working on this, and just had a quick question. After the parsing is done, if the elements of the list of coupling_maps are None, are we still carrying out a check of virtual vs physical qubits? If so, would we do so by checking the number of virtual qubits from circuits against the number of physical qubits which can be retrieved from backend.configuration().n_qubits?

Would this be an acceptable way of doing this?

@ajavadia
Copy link
Member

ajavadia commented Jun 1, 2019

@Matt-Stypulkoski sorry did not see this, but I think the way you have done it in the PR is right. If coupling_map is None, then this check is irrelevant and does not need to be done.

@kdk kdk closed this as completed in #2534 Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: enhancement It's working, but needs polishing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants