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

Results collection #964

Merged
merged 14 commits into from
Sep 3, 2024
Merged

Results collection #964

merged 14 commits into from
Sep 3, 2024

Conversation

alecandido
Copy link
Member

Closes #809

@alecandido alecandido added this to the Qibolab 0.2.0 milestone Aug 7, 2024
@alecandido alecandido linked an issue Aug 7, 2024 that may be closed by this pull request
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.63%. Comparing base (9ad9c1a) to head (a7ef4ec).
Report is 15 commits behind head on 0.2.

Additional details and impacted files
@@            Coverage Diff             @@
##              0.2     #964      +/-   ##
==========================================
+ Coverage   51.45%   51.63%   +0.17%     
==========================================
  Files          57       57              
  Lines        2740     2750      +10     
==========================================
+ Hits         1410     1420      +10     
  Misses       1330     1330              
Flag Coverage Δ
unittests 51.63% <100.00%> (+0.17%) ⬆️

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.

@alecandido
Copy link
Member Author

Most of the work was of course done in #940, but here I'd like to discuss another possible breaking change, i.e.

results = defaultdict(list)
for b in batch(sequences, self._controller.bounds):
result = self._execute(b, options, configs, integration_setup, sweepers)
for serial, data in result.items():
results[serial].append(data)

we are now creating lists for each pulse, but in principle pulses may be unique, and we could just keep the results flatter (replacing the dict[PulseId, list[Result]] with dict[PulseId, Result]).

Of course, this is only relevant for unrolling, since in all the other cases there is a single pulse with the given id, and if there are many results associated (e.g. as in sweepers) the structure is internal to the Results array.

The drawback of the proposed scenario is that we lift to the user the burden of generating unique acquisition pulses (of course, we can validate the sequence to check for duplicates) making copies while generating the sequences (instead of reusing the same pulse - but a .copy() or copy.copy() call is sufficient), while those of the current situation are that you're almost always receiving lists of one element, and that you need to explicitly avoid copies, if you want to keep the results together.

Base automatically changed from drop-pulse-type to 0.2 August 9, 2024 09:07
@alecandido alecandido changed the base branch from 0.2 to channel-native-decoupling August 15, 2024 15:11
@alecandido alecandido force-pushed the channel-native-decoupling branch from 9ac2d23 to f9d4daf Compare August 16, 2024 14:59
@alecandido alecandido force-pushed the channel-native-decoupling branch from f9d4daf to 2171caa Compare August 16, 2024 15:02
Base automatically changed from channel-native-decoupling to serialization-interface August 16, 2024 16:55
Base automatically changed from serialization-interface to 0.2 August 17, 2024 22:59
alecandido added a commit that referenced this pull request Aug 20, 2024
Mostly redundant, it should be replaced with a test on the exact type returned by Platform.execute, in #964
@alecandido alecandido mentioned this pull request Aug 20, 2024
3 tasks
alecandido added a commit that referenced this pull request Aug 22, 2024
Mostly redundant, it should be replaced with a test on the exact type returned by Platform.execute, in #964
stavros11 pushed a commit that referenced this pull request Aug 28, 2024
Mostly redundant, it should be replaced with a test on the exact type returned by Platform.execute, in #964
@alecandido alecandido mentioned this pull request Aug 28, 2024
2 tasks
@stavros11
Copy link
Member

The drawback of the proposed scenario is that we lift to the user the burden of generating unique acquisition pulses (of course, we can validate the sequence to check for duplicates) making copies while generating the sequences (instead of reusing the same pulse - but a .copy() or copy.copy() call is sufficient), while those of the current situation are that you're almost always receiving lists of one element, and that you need to explicitly avoid copies, if you want to keep the results together.

I would say this solution is acceptable. We just need to validate in platform.execute that every pulse appears at most once in the given list of sequences (not even in different sequences that are given in the same list). I don't see any serious issue with that limitation, but if there is we could even relax it by checking only acquisition pulses (and allow reusing drive or other types), as only acquisition is relevant for results.

@alecandido
Copy link
Member Author

I don't see any serious issue with that limitation, but if there is we could even relax it by checking only acquisition pulses (and allow reusing drive or other types), as only acquisition is relevant for results.

Then, I will rebase, provide the check (and a couple of tests), and then ask for a review.

@alecandido
Copy link
Member Author

alecandido commented Sep 3, 2024

@stavros11 now this PR should be feature-complete, I'm just missing suitable tests (and fixing the other ones), and we are done.

@alecandido alecandido requested a review from stavros11 September 3, 2024 13:55
@alecandido alecandido marked this pull request as ready for review September 3, 2024 13:55
Copy link
Member

@stavros11 stavros11 left a comment

Choose a reason for hiding this comment

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

Thanks @alecandido, looks good to me. I also tested the single shot routine with and without unrolling and some quick circuit executions and they all seem to work.

@alecandido
Copy link
Member Author

Since it has already been approved, I'll merge as soon as the CI passes

@alecandido alecandido merged commit a6249aa into 0.2 Sep 3, 2024
28 checks passed
@alecandido alecandido deleted the results-layout branch September 3, 2024 15:23
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.

Define qubit results
2 participants