Skip to content

Commit

Permalink
add in optimization_level
Browse files Browse the repository at this point in the history
  • Loading branch information
abbycross committed Feb 22, 2024
1 parent bc63e26 commit e2fcee0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/run/configure-runtime-compilation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ psi = RealAmplitudes(num_qubits=2, reps=2)
H = SparsePauliOp.from_list([("II", 1), ("IZ", 2), ("XI", 3)])
theta = [0, 1, 1, 2, 3, 5]

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
psi = pm.run(psi)
H = H.apply_layout(psi.layout)

Expand Down
2 changes: 1 addition & 1 deletion docs/run/estimate-job-run-time.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ qc.measure(1, 1)
backend = service.least_busy(simulator=False,operational=True)

# Generate ISA circuits
pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(qc)

# Create a Sampler object
Expand Down
16 changes: 8 additions & 8 deletions docs/run/primitives-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mat = np.real(random_hermitian(n_qubits, seed=1234))
circuit = IQP(mat)
observable = SparsePauliOp("Z" * n_qubits)

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)
isa_observable = observable.apply_layout(isa_circuit.layout)

Expand Down Expand Up @@ -81,7 +81,7 @@ observables = [
SparsePauliOp("Z" * n_qubits),
]

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuits = pm.run(circuits)
isa_observables = [ob.apply_layout(isa_circuits[0].layout) for ob in observables]

Expand Down Expand Up @@ -115,7 +115,7 @@ parameter_values = [
]
observable = SparsePauliOp("Z" * 127)

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)
isa_observable = observable.apply_layout(isa_circuit.layout)

Expand Down Expand Up @@ -146,7 +146,7 @@ another_circuit = IQP(mat)
observable = SparsePauliOp("X" * n_qubits)
another_observable = SparsePauliOp("Y" * n_qubits)

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)
another_isa_circuit = pm.run(another_circuit)
isa_observable = observable.apply_layout(isa_circuit.layout)
Expand Down Expand Up @@ -199,7 +199,7 @@ mat = np.real(random_hermitian(n_qubits, seed=1234))
circuit = IQP(mat)
circuit.measure_all()

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)

sampler = Sampler(backend)
Expand Down Expand Up @@ -233,7 +233,7 @@ circuits = [IQP(mat) for mat in mats]
for circuit in circuits:
circuit.measure_all()

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuits = pm.run(circuits)

sampler = Sampler(backend)
Expand All @@ -260,7 +260,7 @@ backend = service.get_backend("ibm_brisbane")
circuit = RealAmplitudes(num_qubits=127, reps=2)
circuit.measure_all()

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)

# Define three sets of parameters for the circuit
Expand Down Expand Up @@ -297,7 +297,7 @@ mat = np.real(random_hermitian(n_qubits, seed=rng))
another_circuit = IQP(mat)
another_circuit.measure_all()

pm = generate_preset_pass_manager(backend=backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)
another_isa_circuit = pm.run(another_circuit)

Expand Down
10 changes: 8 additions & 2 deletions docs/start/hello-world.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
"In a quantum program, *quantum circuits* are the native format in which to represent quantum instructions, and *operators* represent the observables to be measured. When creating a circuit, you'll usually create a new [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit#quantumcircuit) object, then add instructions to it in sequence."
]
},
{
"cell_type": "markdown",
"id": "a109ece0",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"id": "21f7a26c",
Expand Down Expand Up @@ -137,7 +143,7 @@
"source": [
"from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\n",
"\n",
"pm = generate_preset_pass_manager(backend=backend)\n",
"pm = generate_preset_pass_manager(backend=backend, optimization_level=1)\n",
"isa_circuit = pm.run(qc)\n",
"ZZ = ZZ.apply_layout(isa_circuit.layout)\n",
"ZI = ZI.apply_layout(isa_circuit.layout)\n",
Expand Down Expand Up @@ -321,7 +327,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3"
"version": "3.12.0"
},
"title": "Hello world"
},
Expand Down

0 comments on commit e2fcee0

Please sign in to comment.