gammasim / simtools

Tools and applications for the Simulation System of the CTA Observatory.
https://gammasim.github.io/simtools
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link

Integration tests profiling #1083

Closed GernotMaier closed 2 weeks ago

GernotMaier commented 1 month ago

Integration tests are a bit slow (in github: 25-35 min) and we might want to tune a bit:

52.94s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_north]
38.61s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_south]
35.71s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_corsika_corsika7_particle_id]
26.25s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_pack_for_south_grid]
22.28s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_north_pack_for_grid]
21.77s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_north_for_trigger_rates0]
20.12s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_north_for_trigger_rates1]
18.16s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_corsika]
17.75s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-simulate-prod_gamma_20_deg_corsika_pdg_particle_id]
9.99s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-derive-mirror-rnda_psf_mean]
6.60s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-generate-corsika-histograms_1d_run_header]
6.09s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-validate-camera-efficiency_MSTS]
5.92s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-derive-mirror-rnda_psf_measurement]
5.75s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-generate-corsika-histograms_individual_telescopes_and_indices]
5.74s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-validate-optics_run]
5.73s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-validate-camera-efficiency_SSTS]
5.57s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-validate-camera-efficiency_MSTN]
5.48s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-derive-mirror-rnda_psf_random_flen]
5.24s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-generate-corsika-histograms_1d_and_2d_run_header]
5.13s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-generate-simtel-array-histograms_hist_file_list]
5.13s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-validate-cumulative-psf_run]
5.04s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-derive-mirror-rnda_psf_no_tuning]
4.90s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-generate-corsika-histograms_2d_run_header]
4.81s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-generate-simtel-array-histograms_hist_file_names_pdf_hdf5]
4.70s call     tests/integration_tests/test_applications_from_config.py::test_applications_from_config[simtools-generate-simtel-array-histograms_hist_file_names_pdf_no_name]

Dominated by the testing of the production tool:

(to be clear: we need to test as much as possible; but we won't learn from duplication)

GernotMaier commented 1 month ago

To make it clearer, this is the current test matrix:

Test Software Site ParticleID PackforGrid Primary
simulate_prod_gamma_20_deg_North corsika_simtel North simtools No gamma
simulate_prod_gamma_20_deg_North_corsika corsika North simtools No gamma
simulate_prod_gamma_20_deg_North_corsika_corsika_particle_id corsika North corsika No gamma
simulate_prod_gamma_20_deg_North_corsika_pdg_particle_id corsika North PDG No gamma
simulate_prod_gamma_20_deg_North_for_trigger_rates corsika_simtel North simtools No proton
simulate_prod_gamma_20_deg_North_pack_for_grid corsika_simtel North simtools Yes gamma
simulate_prod_gamma_20_deg_South corsika_simtel South simtools No gamma
simulate_prod_gamma_20_deg_South_for_trigger_rates corsika_simtel South simtools No proton
simulate_prod_gamma_20_deg_South_pack_for_grid corsika_simtel South simtools Yes gamma

I don't think this is necessary and my suggestion is to reduce it to:

Test Software Site ParticleID PackforGrid Primary
simulate_prod_gamma_20_deg_North corsika_simtel North simtools Yes gamma
simulate_prod_gamma_20_deg_North_corsika_corsika_particle_id corsika North corsika No gamma
simulate_prod_gamma_20_deg_South_pack_for_grid corsika_simtel South simtools Yes gamma
simulate_prod_gamma_20_deg_South_for_trigger_rates corsika_simtel South PDG No proton

This would cover enough a broad range of combinations without too much duplication.

Feedback?

GernotMaier commented 3 weeks ago

@tobiaskleiner / @orelgueta - could you have a quick look at above suggestion to reduce the number of long integration tests? These are duplicated tests in my opinion, and we could add a bit of speed to the tests (which I really think is important for the development)

tobiaskleiner commented 3 weeks ago

@GernotMaier looks safe to remove these tests.