quantumlib / Qualtran

Qᴜᴀʟᴛʀᴀɴ is a Python library for expressing and analyzing Fault Tolerant Quantum algorithms.
https://qualtran.readthedocs.io/en/latest/
Apache License 2.0
147 stars 39 forks source link

Unit tests are slow again #711

Closed fdmalone closed 1 month ago

fdmalone commented 6 months ago

Seems to be taking around 17 minutes vs 10 minutes a few days ago.

cc @mpharrigan

fdmalone commented 6 months ago

Should we put a time limit so at least PRs greatly increasing the test time delta cause a failure.

tanujkhattar commented 6 months ago

Is excluding the slow tests? Running pytest on my machine gives:

=============================================================================================================== slowest 20 durations ================================================================================================================
44.36s call     qualtran/bloqs/chemistry/chem_tutorials_test.py::test_resource_estimation_notebook
41.22s call     qualtran/bloqs/hubbard_model_test.py::test_hubbard_model_notebook
11.77s call     qualtran/cirq_interop/_bloq_to_cirq_test.py::test_notebook
11.47s call     qualtran/bloqs/rotations/phase_gradient_test.py::test_add_scaled_val_into_phase_reg[bloq2]
11.35s call     qualtran/bloqs/unary_iteration_bloq_test.py::test_notebook
11.19s call     qualtran/bloqs/arithmetic/multiplication_test.py::test_multiplication_notebook
10.05s call     qualtran/bloqs/generalized_qsp_test.py::test_real_polynomial_has_real_complementary_polynomial[100]
9.96s call     qualtran/_infra/composite_bloq_test.py::test_notebook
9.79s call     qualtran/bloqs/chemistry/thc/prepare_test.py::test_notebook
9.59s call     qualtran/bloqs/chemistry/trotter/trotter_test.py::test_notebook
9.54s call     qualtran/bloqs/arithmetic/addition_test.py::test_notebook
9.37s call     qualtran/bloqs/chemistry/pbc/first_quantization/select_and_prepare_test.py::test_notebook
9.33s call     qualtran/bloqs/swap_network_test.py::test_notebook
9.23s call     qualtran/bloqs/chemistry/trotter/trotter_test.py::test_costing_notebook
9.20s call     qualtran/_infra/bloq_test.py::test_notebook
8.31s call     qualtran/bloqs/reflection_test.py::test_notebook
8.18s call     qualtran/bloqs/util_bloqs_test.py::test_notebook
8.17s call     qualtran/bloqs/apply_gate_to_lth_target_test.py::test_notebook
8.17s call     qualtran/_infra/adjoint_test.py::test_notebook
8.14s call     qualtran/bloqs/basic_gates_test.py::test_notebook
============================================================================================= 1473 passed, 267 skipped, 63 warnings in 69.70s (0:01:09) =============================================================================================

For the slow tests, I think I'm the culprit here with some recently added slow tests to verify the assumptions and error propagation in phasing via cost function infrastructure.