-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Slight speed up to notebook tests #4147
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
balopat
approved these changes
May 28, 2021
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.
Sweet! Thank you!!!
rht
pushed a commit
to rht/Cirq
that referenced
this pull request
May 1, 2023
Shaves a bit of time off notebook tests by 1. Fixing typos in two replacement filenames (so the replacements get applied) 2. Adding two flags to papermill: `--no-request-save-on-cell-execute` and `--autosave-cell-every 0`. From the [papermill docs](https://papermill.readthedocs.io/en/latest/usage-cli.html): ``` --request-save-on-cell-execute / --no-request-save-on-cell-execute Request save notebook after each cell execution --autosave-cell-every INTEGER How often in seconds to autosave the notebook during long cell executions (0 to disable) ``` Sample times and notebooks over 10s from `check/pytest -n auto -m slow dev_tools/notebooks/notebook_test.py --durations=0` on my computer are below. <details> <summary> On master: 144.78s </summary> ``` 89.85s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Cirq-to-Tensor-Networks.ipynb] 56.99s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/intro.ipynb] 37.92s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/quantum_walks.ipynb] 30.20s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/isolated_xeb.ipynb] 23.58s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_coherent_noise.ipynb] 22.69s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/parallel_xeb.ipynb] 20.16s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/textbook_algorithms.ipynb] 17.15s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/operators_and_observables.ipynb] 16.72s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb] 14.05s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/qaoa_ising.ipynb] 13.93s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/qaoa.ipynb] 13.91s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/hidden_linear_function.ipynb] 12.91s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/rabi_oscillations.ipynb] 12.10s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/noise.ipynb] 12.02s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_theory.ipynb] 11.75s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/interop.ipynb] 10.44s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/basics.ipynb] 10.42s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/examples/advanced/quantum_volume_errors.ipynb] 10.03s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/fourier_checking.ipynb] ``` </details> <details> <summary> With replacement file typo fixes: 127.23s </summary> ``` 57.27s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/intro.ipynb] 37.01s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/quantum_walks.ipynb] 30.10s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/isolated_xeb.ipynb] 22.76s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_coherent_noise.ipynb] 22.62s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/parallel_xeb.ipynb] 16.75s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb] 15.04s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/textbook_algorithms.ipynb] 14.99s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/operators_and_observables.ipynb] 14.92s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Cirq-to-Tensor-Networks.ipynb] 13.98s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/qaoa_ising.ipynb] 13.87s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/qaoa.ipynb] 12.60s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/examples/advanced/quantum_volume_errors.ipynb] 12.44s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/rabi_oscillations.ipynb] 11.88s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/hidden_linear_function.ipynb] 11.79s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/interop.ipynb] 11.69s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/noise.ipynb] 10.95s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_theory.ipynb] 10.47s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/shor.ipynb] ``` </details> <details> <summary> With replacement file typo fixes & papermill options: 98.97s </summary> ``` 34.08s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/quantum_walks.ipynb] 29.59s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/isolated_xeb.ipynb] 22.62s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_coherent_noise.ipynb] 21.39s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/parallel_xeb.ipynb] 13.76s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Cirq-to-Tensor-Networks.ipynb] 13.49s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb] 12.59s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/examples/advanced/quantum_volume_errors.ipynb] 12.29s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/qaoa.ipynb] 10.46s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/rabi_oscillations.ipynb] 10.05s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/interop.ipynb] ``` </details> I think I see a little speedup in CI...
harry-phasecraft
pushed a commit
to PhaseCraft/Cirq
that referenced
this pull request
Oct 31, 2024
Shaves a bit of time off notebook tests by 1. Fixing typos in two replacement filenames (so the replacements get applied) 2. Adding two flags to papermill: `--no-request-save-on-cell-execute` and `--autosave-cell-every 0`. From the [papermill docs](https://papermill.readthedocs.io/en/latest/usage-cli.html): ``` --request-save-on-cell-execute / --no-request-save-on-cell-execute Request save notebook after each cell execution --autosave-cell-every INTEGER How often in seconds to autosave the notebook during long cell executions (0 to disable) ``` Sample times and notebooks over 10s from `check/pytest -n auto -m slow dev_tools/notebooks/notebook_test.py --durations=0` on my computer are below. <details> <summary> On master: 144.78s </summary> ``` 89.85s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Cirq-to-Tensor-Networks.ipynb] 56.99s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/intro.ipynb] 37.92s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/quantum_walks.ipynb] 30.20s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/isolated_xeb.ipynb] 23.58s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_coherent_noise.ipynb] 22.69s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/parallel_xeb.ipynb] 20.16s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/textbook_algorithms.ipynb] 17.15s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/operators_and_observables.ipynb] 16.72s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb] 14.05s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/qaoa_ising.ipynb] 13.93s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/qaoa.ipynb] 13.91s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/hidden_linear_function.ipynb] 12.91s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/rabi_oscillations.ipynb] 12.10s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/noise.ipynb] 12.02s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_theory.ipynb] 11.75s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/interop.ipynb] 10.44s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/basics.ipynb] 10.42s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/examples/advanced/quantum_volume_errors.ipynb] 10.03s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/fourier_checking.ipynb] ``` </details> <details> <summary> With replacement file typo fixes: 127.23s </summary> ``` 57.27s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/intro.ipynb] 37.01s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/quantum_walks.ipynb] 30.10s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/isolated_xeb.ipynb] 22.76s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_coherent_noise.ipynb] 22.62s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/parallel_xeb.ipynb] 16.75s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb] 15.04s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/textbook_algorithms.ipynb] 14.99s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/operators_and_observables.ipynb] 14.92s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Cirq-to-Tensor-Networks.ipynb] 13.98s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/educators/qaoa_ising.ipynb] 13.87s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/qaoa.ipynb] 12.60s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/examples/advanced/quantum_volume_errors.ipynb] 12.44s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/rabi_oscillations.ipynb] 11.88s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/hidden_linear_function.ipynb] 11.79s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/interop.ipynb] 11.69s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/noise.ipynb] 10.95s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_theory.ipynb] 10.47s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/shor.ipynb] ``` </details> <details> <summary> With replacement file typo fixes & papermill options: 98.97s </summary> ``` 34.08s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/quantum_walks.ipynb] 29.59s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/isolated_xeb.ipynb] 22.62s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/xeb_coherent_noise.ipynb] 21.39s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/qcvv/parallel_xeb.ipynb] 13.76s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Cirq-to-Tensor-Networks.ipynb] 13.49s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/cirq-core/cirq/contrib/quimb/Contract-a-Grid-Circuit.ipynb] 12.59s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/examples/advanced/quantum_volume_errors.ipynb] 12.29s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/qaoa.ipynb] 10.46s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/tutorials/rabi_oscillations.ipynb] 10.05s call dev_tools/notebooks/notebook_test.py::test_notebooks_against_released_cirq[Cirq/docs/interop.ipynb] ``` </details> I think I see a little speedup in CI...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Shaves a bit of time off notebook tests by
--no-request-save-on-cell-execute
and--autosave-cell-every 0
.From the papermill docs:
Sample times and notebooks over 10s from
check/pytest -n auto -m slow dev_tools/notebooks/notebook_test.py --durations=0
on my computer are below.On master: 144.78s
With replacement file typo fixes: 127.23s
With replacement file typo fixes & papermill options: 98.97s
I think I see a little speedup in CI...