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

Improve performance of unittests #229

Open
thomas-rocke opened this issue Jan 24, 2024 · 0 comments
Open

Improve performance of unittests #229

thomas-rocke opened this issue Jan 24, 2024 · 0 comments

Comments

@thomas-rocke
Copy link
Contributor

The tests CI can take a while to run. Whilst a large number of tests is fine and probably good practice, some of these tests individually can take a while to run.

From the output of Run Tests # 225 (225th execution of the Run Tests CI, which ran for the PR #206 ):

--- generated xml file: /home/runner/work/matscipy/matscipy/tests/report.xml ---
============================= slowest 20 durations =============================
243.42s call test_eam_calculator_forces_and_hessian.py::TestEAMForcesHessian::test_hessian_monoatomic
153.02s call test_eam_calculator_forces_and_hessian.py::TestEAMForcesHessian::test_hessian_amorphous_alloy
121.91s call test_eam_calculator_forces_and_hessian.py::TestEAMForcesHessian::test_hessian_crystalline_alloy
97.37s call test_bop.py::test_amorphous[par2]
90.65s call test_dislocation.py::TestCubicCrystalDissociatedDislocationQuadrupole::test_single_kink_quadrupole[disloc=FCCEdge110Dislocation]
75.97s call test_dislocation.py::TestCubicCrystalDissociatedDislocationQuadrupole::test_glide_configs[disloc=FCCEdge110Dislocation]
73.79s call test_hessian_precon.py::TestHessianPrecon::test_precon_neb
45.63s call test_bop.py::test_crystal_elastic_constants[par2-a0=5.2]
39.32s call test_dislocation.py::TestCubicCrystalDissociatedDislocationQuadrupole::test_quadrupole_struct[disloc=FCCEdge110Dislocation]
38.11s call test_dislocation.py::TestCubicCrystalDissociatedDislocationQuadrupole::test_glide_configs[disloc=FCCEdge110Dislocation]
38.05s call test_spatial_correlation_function.py::TestSpatialCorrelationFunction::test_radial_distribution_function
37.84s call test_dislocation.py::TestCubicCrystalDissociatedDislocationQuadrupole::test_glide_configs[disloc=FCCEdge110Dislocation]
36.21s call test_bop.py::test_crystal_elastic_constants[par2-a0=5.3]
35.12s call test_bop.py::test_crystal_forces_and_hessian[par2-a0=5.3]
34.86s call test_bop.py::test_crystal_forces_and_hessian[par2-a0=5.2]
34.49s call test_bop.py::test_crystal_elastic_constants[par2-a0=5.0]
33.20s call test_bop.py::test_amorphous[par0]
30.73s call test_bop.py::test_amorphous[par1]
29.08s call test_ewald.py::test_non_affine_elastic_beta_cristobalite[beta_cristobalite_bks=6]
23.50s call test_dislocation.py::TestCubicCrystalDissociatedDislocationQuadrupole::test_single_kink_quadrupole[disloc=FCCScrew110Dislocation]
= 715 passed, 4 skipped, 55 xfailed, 28 xpassed, 878 warnings, 84 subtests passed in 1924.05s (0:32:04) =

I can definitely improve the TestCubicCrystalDissociatedDislocationQuadrupole entries. We should ideally also look at test_bop.py and the EAM tests, to see whether the tests could be scaled down to be more performant.

Additionally, I noticed some files like test_bop.py make extensive use of Pytest parametrize, which can greatly magnify the number of tests which need to be run. Some time may also be saved here by reevaluating whether all of the parametrize lists need to be so long. As an example, testing elastic constants for absolutely every bop model might not be strictly needed, when each of those models is already covered through other, faster checks.

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

No branches or pull requests

1 participant