Skip to content

Commit

Permalink
execute(..., backend=..., passmanager=...) has not conflicting args (#…
Browse files Browse the repository at this point in the history
…5051)

* exclude backend from _check_conflicting_argument

* test

* reno

Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
  • Loading branch information
Luciano Bello and kdk authored Sep 10, 2020
1 parent 2a2b504 commit 4542aea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 1 addition & 2 deletions qiskit/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ def execute(experiments, backend,
coupling_map=coupling_map,
seed_transpiler=seed_transpiler,
backend_properties=backend_properties,
initial_layout=initial_layout,
backend=backend)
initial_layout=initial_layout)
experiments = pass_manager.run(experiments)
else:
# transpiling the circuits using given transpile options
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/5037-e73ce50c4ae23445.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
The parameters `backend` and `passmanager` in :func:`qiskit.execute.execute`
are not conflicting and they are simultaneously allowed now.
12 changes: 12 additions & 0 deletions test/python/compiler/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ def test_parallel_compile(self):
qobj = assemble(transpile(qlist, backend=backend))
self.assertEqual(len(qobj.experiments), 10)

def test_no_conflict_backend_passmanager(self):
"""execute(qc, backend=..., passmanager=...)
See: https://github.com/Qiskit/qiskit-terra/issues/5037
"""
backend = BasicAer.get_backend('qasm_simulator')
qc = QuantumCircuit(2)
qc.u1(0, 0)
qc.measure_all()
job = execute(qc, backend=backend, pass_manager=PassManager())
result = job.result().get_counts()
self.assertEqual(result, {'00': 1024})

def test_compile_single_qubit(self):
""" Compile a single-qubit circuit in a non-trivial layout
"""
Expand Down

0 comments on commit 4542aea

Please sign in to comment.