Skip to content

Commit

Permalink
Merge pull request #147 from iqm-finland/active-reset-cycles-in-circu…
Browse files Browse the repository at this point in the history
…it-comp-options

active_reset_cycles needs to be in circuit compilation options as well
  • Loading branch information
tuukka-hiltunen authored Nov 18, 2024
2 parents 89fb779 + 50e698e commit 487d6ca
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

Version 20.4
============
* ``active_reset_cycles`` added to ``CircuitCompilationOptions`` (in 20.2 it was only added to ``RunRequest`` making it
difficult to use).

Version 20.3
============

Expand Down
2 changes: 1 addition & 1 deletion src/iqm/iqm_client/iqm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ def create_run_request(
self._validate_circuit_instructions(
architecture, circuits, qubit_mapping, validate_moves=options.move_gate_validation
)

return RunRequest(
qubit_mapping=serialized_qubit_mapping,
circuits=circuits,
Expand All @@ -252,6 +251,7 @@ def create_run_request(
heralding_mode=options.heralding_mode,
move_validation_mode=options.move_gate_validation,
move_gate_frame_tracking_mode=options.move_gate_frame_tracking,
active_reset_cycles=options.active_reset_cycles,
)

def submit_run_request(self, run_request: RunRequest) -> UUID:
Expand Down
5 changes: 5 additions & 0 deletions src/iqm/iqm_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,11 @@ class CircuitCompilationOptions:
move_gate_frame_tracking: MoveGateFrameTrackingMode = MoveGateFrameTrackingMode.FULL
"""MOVE gate frame tracking mode for circuit compilation. This options is ignored on devices that do not support
MOVE and for circuits that do not contain MOVE gates."""
active_reset_cycles: Optional[int] = None
"""Number of active ``reset`` operations inserted at the beginning of each circuit for each active qubit.
``None`` means active reset is not used but instead reset is done by waiting (relaxation). Integer values smaller
than 1 result in neither active nor reset by wait being used, in which case any reset operations must be explicitly
added in the circuit."""

def __post_init__(self):
"""Validate the options."""
Expand Down
5 changes: 3 additions & 2 deletions tests/test_iqm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def test_abort_job_failed(status_code, sample_client, existing_job_url, existing
'params',
[
{},
{'options': CircuitCompilationOptions(heralding_mode=HeraldingMode.ZEROS)},
{'options': CircuitCompilationOptions(heralding_mode=HeraldingMode.ZEROS, active_reset_cycles=1)},
{'custom_settings': {'some_setting': 1}},
{'calibration_set_id': uuid.uuid4()},
{'options': CircuitCompilationOptions(max_circuit_duration_over_t2=0.0)},
Expand Down Expand Up @@ -859,7 +859,8 @@ def test_create_and_submit_run_request(
when(requests).get(dynamic_architecture_url, ...).thenReturn(dynamic_architecture_success)

run_request = sample_client.create_run_request([sample_circuit], **params)

if 'options' in params:
assert run_request.active_reset_cycles == params['options'].active_reset_cycles
expect(requests, times=2).post(jobs_url, **post_jobs_args(run_request)).thenReturn(submit_success)
assert sample_client.submit_run_request(run_request) == existing_run_id
assert sample_client.submit_circuits([sample_circuit], **params) == existing_run_id
Expand Down

0 comments on commit 487d6ca

Please sign in to comment.