Skip to content

Commit

Permalink
Allow estimate for processing time bigger than backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Gistbatch committed Feb 12, 2024
1 parent 2e9af4e commit 5eca64b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/provider/accelerator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Wrapper for IBMs backend simulator."""

from uuid import UUID, uuid4

from qiskit import QuantumCircuit, transpile
from qiskit.providers.fake_provider import FakeSherbrooke
from qiskit_aer import AerSimulator

from src.common import IBMQBackend
Expand Down Expand Up @@ -68,7 +70,11 @@ def compute_processing_time(self, circuit: QuantumCircuit) -> float:
# TODO: doing a full hardware-aware compilation just to get the processing
# time is not efficient. An approximation would be better.
be = self._backend.value()
transpiled_circuit = transpile(circuit, be, scheduling_method="alap")
if circuit.num_qubits > self._qubits:
# Workaround to get time estiamte for circuits bigger then the backend
transpiled_circuit = transpile(circuit, FakeSherbrooke(), scheduling_method="alap")
else:
transpiled_circuit = transpile(circuit, be, scheduling_method="alap")
return Accelerator._time_conversion(
transpiled_circuit.duration, transpiled_circuit.unit, dt=be.dt
)
Expand Down
4 changes: 2 additions & 2 deletions tests/scheduling/heuristics/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ def test_generate_heuristic_info_schedule():
schedule, makespan = generate_heuristic_info_schedule(
circuits, accelerators, num_iterations=2, partition_size=3
)
assert 8 < len(schedule) < 12
assert 50 < makespan < 100
assert 5 < len(schedule) < 13
assert 45 < makespan < 100

0 comments on commit 5eca64b

Please sign in to comment.