-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
2024 reduce documentation build time after classical shadows added #2058
2024 reduce documentation build time after classical shadows added #2058
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2058 +/- ##
=======================================
Coverage 98.30% 98.30%
=======================================
Files 87 87
Lines 4118 4125 +7
=======================================
+ Hits 4048 4055 +7
Misses 70 70 ☔ View full report in Codecov by Sentry. |
@purva-thakre I think you are correct with your comments on the issue. It makes much more sense that quantum processing of the circuits is taking the significant amount of time resulting. |
The new branch that I used included commits for a different issue/PR. I did a hard reset on the branch and to clean it up. Also, I put the saved output into a repository on my github account. If/when we see the appropriate reduced time, then we can determine if there is a better place to put the files. On my own system when building the docs locally, I found that after pulling the saved content for shadow_quantum_processing the time was reduced significantly. After those calls, the two remaining calls that take up the majority of the time are:
and
If we wanted to reduce the time for the Classical Shadows guide further, we could look to reduce num_total_measurements_calibration |
7701681
to
306d115
Compare
By saving the shadow_quantum_processing results off and pulling them from github, the build time for guide/rshadows-1-intro.md dropped from the average of 6.62 minutes to 3.94 minutes. examples/rshadows_tutorial.md already uses the saved results, but this call is also taking the majority of the time:
This is called in a for loop for a total of 3 times with k_callibration = 10 and locality = 3. Then, the function is called again with k_callibration = 5 and locality = 2. Would we want to look into saving the results of the pauli_twirling_callibrate to a file for guide/shadows-1-intro.md and exmaples/rshadows_tutorial.md? Does it matter if we use pre-calculated results as long as we provide the method for generating the results along with it? Is there a specific timing that we want to stay under for the different examples and guides when it comes to the builds? Pinging @Misty-W @natestemen @andreamari for thoughts |
@bdg221 thanks! In my opinion, any action which reduces the build time is good. So for me it's ok to: a) Check if it is possible to reduce the b) Move the pickle files that you have in your repo in the c) For me it's ok to also load the output of We know that points b) and c) are not optimal for at least two reasons: they require saving data in the source code making the Mitiq repository a bit heavier and in practice we don't test some code of the docs by skipping it's execution. |
I changed @natestemen @Misty-W I won't be able to make the Community Call tomorrow, but I would appreciate it if you could discuss this PR. I agree with @andreamari that loading the pauli_twirling_calibrate from a file would be beneficial. Does everybody agree on this approach? Also, as was brought up, where should we put these files so that we know they will exist in the future (rather than in somebody's personal github repo)? Should an existing directory be used or a new directory be created for them (ie. resources)? Also, the Robust Shadow Estimation example uses the following explanation of using saved results. Are we okay with this language or would we want to provide more details? (Obviously changing the wording for pauli_twirling_calibrate.) Whether to run the quantum measurement or directly use the results from the previous run. If True, the measurement will be run again. If False, the results from the previous run will be used. Finally, I wanted to step back and check the doc build to see how long the whole process took and how long the examples and guides took to build. In the last build of this PR, the build/docs(pull_request) took ~66 minutes with ~61 minutes coming from just the examples and guides code execution. Below are the top 10 culprits of the examples and guides which account for over 48 minutes: |
thanks @bdg221! I propose creating a folder within the examples folder for approaches (b) and (c). Since you already implemented (a), that should result in smaller files, which should mitigate the size concern somewhat. |
…ation of rshadows_tutorial.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @bdg221 for the nice speed up!
Fixes #2024
I am starting with the examples/rshadows_tutorial.md which takes on average over 7 minutes to run during the Sphinx documentation build.
Next, I will look to address the guide/shadows-1-intro.md which takes on average over 6.5 minutes to run.
To start with I will be taking any files that need to be remote pulled from a github repository and place those files locally under docs/source/resources.
If this still does not provide enough of a speed up, then I will look at other areas that could benefit the build time.
This PR will be used in testing the build times, so I do expect there to be a number of commits after the PR is opened.
License
Before opening the PR, please ensure you have completed the following where appropriate.