Skip to content

Commit

Permalink
Added set_transpile_options
Browse files Browse the repository at this point in the history
  • Loading branch information
merav-aharoni committed Dec 4, 2023
1 parent a56063f commit 959445b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions qiskit_ibm_runtime/options/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def _get_program_inputs(options: dict) -> dict:
"""
sim_options = options.get("simulator", {})
inputs = {}

#do we need to keep the flat options as well, for passing to terra directly?
inputs["optimization_level"] = options["optimization_level"]
inputs["transpilation_settings"] = options.get("transpilation", {})
inputs["transpilation_settings"].update(
{
Expand Down
9 changes: 8 additions & 1 deletion qiskit_ibm_runtime/qiskit_runtime_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,14 @@ def run(
qrt_options = RuntimeOptions(**options)

qrt_options.validate(channel=self.channel)

print()
print("inputs ", inputs)
print()
sim_options = inputs["run_options"]
print("sim_options ",sim_options)

transpile_options = {}
transpile_options["optimization_level"] = inputs["optimization_level"] #do we need additional options

is_fake_backend = False
is_aer_backend = False
Expand All @@ -917,6 +923,7 @@ def run(
options=sim_options,
skip_transpilation=inputs["transpilation_settings"]["skip_transpilation"],
)
my_program.set_transpile_options(**transpile_options)
observables = inputs.get("observables", None)

primitive_job = my_program._run(
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/utils/fake_backends.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qiskit.providers.fake_provider.backends import (
from qiskit_ibm_runtime.fake_provider.backends import (
FakeAlmadenV2,
FakeArmonkV2,
FakeAthensV2,
Expand Down
1 change: 0 additions & 1 deletion test/unit/test_run_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ def test_basic_flow(self):
self.assertAlmostEqual(result.quasi_dists[0][0], 0.5, delta=0.2)
self.assertAlmostEqual(result.quasi_dists[0][3], 0.5, delta=0.2)

# currently not working correctly for FakeBackend
self.assertEqual(result.metadata[0]["shots"], shots)

0 comments on commit 959445b

Please sign in to comment.