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

Unrolling bounds as instrument settings #832

Merged
merged 4 commits into from
Mar 20, 2024
Merged

Unrolling bounds as instrument settings #832

merged 4 commits into from
Mar 20, 2024

Conversation

stavros11
Copy link
Member

Implements what is described in #817 (comment).

@stavros11 stavros11 requested a review from alecandido March 8, 2024 21:05
Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.35%. Comparing base (926104e) to head (4946322).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #832      +/-   ##
==========================================
- Coverage   66.44%   66.35%   -0.09%     
==========================================
  Files          50       50              
  Lines        6079     6063      -16     
==========================================
- Hits         4039     4023      -16     
  Misses       2040     2040              
Flag Coverage Δ
unittests 66.35% <100.00%> (-0.09%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +326 to +329
self.bounds = Bounds(
waveforms=int(4e4),
readout=250,
instructions=int(1e6),
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do these numbers come from. I believe ZI limitations are much larger than these numbers.

Additionally, different ZI instruments have different limitations. Our Zurich class does not represent a single instrument, but a collection of ZI instruments. So the concept of bounds is not straightforwardly applicable to this class. The best we can do for now is for each property take the minimum across all possible ZI instruments.

Copy link
Member

Choose a reason for hiding this comment

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

In principle, we should be able to serialize the configuration for every instrument in the platform. They should just live in nested sections.

Copy link
Member

Choose a reason for hiding this comment

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

for name, instrument in instruments.items():

Copy link
Contributor

Choose a reason for hiding this comment

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

I ran some quick experiments until they crashed for the waveforms and readouts, I don't claim them to be the best but I needed something for the code. They should get updated with the feedback from people running stuff I hope.

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 @stavros11 for having propagated this to all drivers.

Copy link
Member

Choose a reason for hiding this comment

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

I would set a random one also here, with a # TODO: marker. At least, whoever will try to use sweepers on the rfsoc will notice that there is something to be done here, and doesn't have to look too much around.

I would just set something like (1000, 1000, 1000), to fully prevent batching. It will make it fail for memory, but it is better than completely prevent unrolling, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am actually not sure how qibosoq (and QICK) would behave regarding unrolling. I remember some issues when sending long sequences (not necessarily unrolled ones, just a long sequence with a single measurement) in which case there was no error but the results were wrong. If that is the case, it may be actually better to prevent unrolling.

I believe now Bounds(0, 0, 0) is inherited from the abstract instrument, so every sequence should be batched individually.

Comment on lines +178 to +181
settings = instrument.dump()
if len(settings) > 0:
data[name] = settings
except AttributeError:
Copy link
Member

Choose a reason for hiding this comment

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

Is there anyone still missing .dump(), but with .settings?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I believe the qblox modules, not the controller itself but QrmRf, QcmRf, etc. And in the platforms we need to pass settings to each module seperately.

@stavros11 stavros11 mentioned this pull request Mar 18, 2024
4 tasks
Copy link
Contributor

@Jacfomg Jacfomg left a comment

Choose a reason for hiding this comment

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

Looks good, should we open another PR in qibolab platforms as well ?

@alecandido alecandido changed the base branch from pulse_batching to main March 18, 2024 13:07
@stavros11
Copy link
Member Author

Looks good, should we open another PR in qibolab platforms as well ?

I believe this is not necessary. If no bounds are given in parameters.json it will use the defaults hardcoded for the used instrument. These are the values from your PR which I believe are good estimates for what we know so far. If someone finds better values then they can put them in the platform. The only confusion may be that platforms dumped by qibocal will now contain the default bounds (even when not specified in the original platform), but that shouldn't be an issue.

@alecandido I fixed the conflict and responded to your comments. If you have no objection, feel free to merge. Regarding instrument.dump(), maybe we should migrate all instruments to that approach, but certainly not here.

@alecandido
Copy link
Member

I manually changed base branch to the PR. @scarrazza is it possible to enable to automated rebase in the settings?

@alecandido
Copy link
Member

The only confusion may be that platforms dumped by qibocal will now contain the default bounds (even when not specified in the original platform), but that shouldn't be an issue.

For this we should decide a consistent scheme, since those platforms are becoming lock files, but they should not be recommitted as is to the platforms' repo (otherwise it would not make use of the defaults any longer).
It would be nice if we could generate both fully detailed platforms (for reproducibility) and minimal updates (to recommit them back).

@stavros11 stavros11 merged commit aa1d165 into main Mar 20, 2024
24 checks passed
@stavros11 stavros11 deleted the bounds_settings branch March 20, 2024 08:10
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.

4 participants