Skip to content

Adding execution tutorial #998

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Alexandre-Classiq
Copy link
Collaborator

This is the first part of the execution tutorial.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Alexandre-Classiq Alexandre-Classiq marked this pull request as draft May 14, 2025 14:42
Copy link
Member

@GazitLior1 GazitLior1 left a comment

Choose a reason for hiding this comment

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

@Alexandre-Classiq I think the tutorial should introduce execution_session and not execute
If we do want to show both - so execute is only relevant for simple use cases where es supports much more complex operation that we can teach.

The goal is that users will use es. in general

@Alexandre-Classiq Alexandre-Classiq marked this pull request as ready for review May 31, 2025 18:35
@@ -0,0 +1,432 @@
{
Copy link
Member

@matanvax2 matanvax2 Jun 26, 2025

Choose a reason for hiding this comment

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

Line #15.    )

These 15 lines should be replaced with from classiq import *.


Reply via ReviewNB

@@ -0,0 +1,432 @@
{
Copy link
Member

@matanvax2 matanvax2 Jun 26, 2025

Choose a reason for hiding this comment

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

Line #6.    )

This is a question of taste, but to me these long lines are hard to read. I think the following yields a more convenient printout -

for state, count in results.counts.items():
    print(f"state={state}, count={count}")

for pc in results.parsed_counts:
    print(pc)

I would actually consider leaving out the counts (the bit strings are hard to interpret), and only keeping parsed_counts. Instead, I would add -

print(results.dataframe)

Reply via ReviewNB

@@ -0,0 +1,432 @@
{
Copy link
Member

@matanvax2 matanvax2 Jun 26, 2025

Choose a reason for hiding this comment

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

IMO the term "classical hardware" to refer to simulators is confusing (it's software simulating the behavior of quantum hardware)

I don't think 'Backend Preferences' should be capitalized - it's a generic noun..

I think a much better (and shorter way) to determine the execution preference is just passing it as a parameter to ExecutionSession constructor (as opposed to set_quantum_program_execution_preferences).


Reply via ReviewNB

@@ -0,0 +1,432 @@
{
Copy link
Member

@matanvax2 matanvax2 Jun 26, 2025

Choose a reason for hiding this comment

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

Line #11.    set_quantum_program_execution_preferences(qprog, execution_preferences)

Again, I think this API should not be used. And surely the output here is a huge pile of junk..


Reply via ReviewNB

@@ -0,0 +1,432 @@
{
Copy link
Member

@matanvax2 matanvax2 Jun 26, 2025

Choose a reason for hiding this comment

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

Line #9.    )

IMO these massive printouts are cluttering the notebook and making it harder to grasp. I think much shorter and more structured printouts would be better.


Reply via ReviewNB

@@ -0,0 +1,432 @@
{
Copy link
Member

@matanvax2 matanvax2 Jun 26, 2025

Choose a reason for hiding this comment

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

I'm not sure this description is very clear. You wait while your job is pending also when you use the regular sample method. It's only when you don't want your Python script to be blocked while waiting, or maybe when you want to store the job ID on some secondary storage to be able to retrieve it in at a different time, with a different process/machine that you must use the submit_sample variant.


Reply via ReviewNB

@@ -0,0 +1,432 @@
{
Copy link
Member

@matanvax2 matanvax2 Jun 26, 2025

Choose a reason for hiding this comment

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

Line #12.    )

Same here.


Reply via ReviewNB

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.

3 participants