Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using custom dummy platform #1101

Merged
merged 13 commits into from
Mar 5, 2025
Merged

Using custom dummy platform #1101

merged 13 commits into from
Mar 5, 2025

Conversation

andrea-pasquale
Copy link
Contributor

@andrea-pasquale andrea-pasquale commented Feb 25, 2025

In this PR I'm attempting to define a custom "dummy" platform in Qibocal (which is currently called fake but if there are better proposal I'm happy to change the name). The motivation started from #1099 where I've noticed that the dummy was missing a local oscillator making it impossible to run the integration weights protocol with the dummy available in Qibolab.

In general I believe that this could be beneficial to further remove some nested dependencies between Qibolab and Qibocal.
For example currently the calibration parameters for dummy where stored in Qibocal while the parameters.json is currently in Qibolab.
The new fake platform only has 2 qubits with a coupler, since I don't believe that for testing purposes we need more than that.

Currently the new platform is added at import time by adding the corresponding directly to QIBOLAB_PLAFORMS.

  • update documentation

EDIT: after some internal discussions we have decided to rename fake to mock

Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.77%. Comparing base (fc89963) to head (e7b2996).
Report is 2184 commits behind head on kernels.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           kernels    #1101      +/-   ##
===========================================
+ Coverage    96.05%   97.77%   +1.71%     
===========================================
  Files          107       99       -8     
  Lines         7432     8088     +656     
===========================================
+ Hits          7139     7908     +769     
+ Misses         293      180     -113     
Flag Coverage Δ
unittests 97.77% <100.00%> (+1.71%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/qibocal/__init__.py 100.00% <100.00%> (ø)
src/qibocal/auto/execute.py 95.38% <100.00%> (-3.37%) ⬇️
src/qibocal/auto/runcard.py 97.50% <100.00%> (-0.50%) ⬇️
src/qibocal/calibration/platform.py 100.00% <100.00%> (ø)

... and 34 files with indirect coverage changes

@andrea-pasquale
Copy link
Contributor Author

With the latest changes I've defined the mockplatform which generate random numbers only in tests.
For this reason I had to drop the DEFAULT_EXECUTOR which was using dummy as discussed in #926.
Similarly to what is already happening in #1103 I've added a platforms folder in qibocal where I've added a symlink to mock.

Copy link
Member

@alecandido alecandido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andrea-pasquale, everything looks good.

I'm only providing minor suggestions.

Comment on lines +42 to +45
def create() -> Platform:
"""Create a dummy platform using the dummy instrument."""
hardware = create_mock_hardware()
return Platform.load(path=FOLDER, **vars(hardware))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only needed for dummy, to avoid breaking the API (since we introduced it in Qibolab after v0.2.0). However, you can just drop this function, and rename the former create(), unless you import this file directly. create_platform() will detect it and provide the Platform.load() call on its own.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do exactly as you said but when running test I'm getting an error RuntimeError: Cannot establish connection to instrument dummy. Error captured: ''dict' object has no attribute 'connect''.
Given that, if I am not wrong, this feature is only available in qibolab main and is not available in a release I suggest to open an issue and skip this comment for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that, if I am not wrong, this feature is only available in qibolab main and is not available in a release I suggest to open an issue and skip this comment for now.

Actually, it should be available in v0.2.3, since qiboteam/qibolab#1123 was introduced in that release.
However, I fixed something after that release in qiboteam/qibolab#1151, and I was trying to remember whether it was needed sometimes or always...

andrea-pasquale and others added 2 commits March 5, 2025 09:17
Co-authored-by: Edoardo Pedicillo <edoardo.pedicillo@gmail.com>
andrea-pasquale and others added 2 commits March 5, 2025 10:04
Co-authored-by: Alessandro Candido <candido.ale@gmail.com>
@andrea-pasquale andrea-pasquale merged commit 5137c85 into kernels Mar 5, 2025
21 checks passed
@andrea-pasquale andrea-pasquale deleted the dummy branch March 5, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alleviate or document environment dependence
3 participants