5
$\begingroup$

I'm currently trying to specify an initial_layout for a circuit on a IBM Q device.

enter image description here

Looking at the device's topology I would like to use the less noisy qubits in order to have the best performance.

Thus, I looked at how the circuit is transformed to fit the device topology by drawing the circuit returned by transpile :enter image description here

It seems that the compiler is using q0,q1 and q2 to run the circuit. So my first question is : How does the compiler chose which virtual qubits are mapped to which qubits ? I heard that it try to minimize the depth and the number of cnot used by choosing the most connected qubits in the graph but I've never found any info about that in the qiskit documentation. I then tried to specify a initial_layout to use q10,q9 and q8 to see if it improves performance:enter image description here

However the drawing still show q0,q1 and q2 being used. What am I missing ?

$\endgroup$

1 Answer 1

2
$\begingroup$

transpile has a parameter called optimization_level, which can be set to either 0, 1, 2, or 3. Depending on what optimization_level is set to, the transpiler will apply a list of passes which alter or analyze the circuit in some way. By default, the optimization_level is set to 1. You can view all of the passes that are applied to a circuit depending on that level here.

As for the initial_layout, I would try setting the layout to include the entire list of qubits in the device, and not just the ones that you will be changing. I believe this should make the circuit use the qubits you want.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.