Skip to content

Improve example runtime #1379

@mattwthompson

Description

@mattwthompson

Description
The examples currently take anywhere between 11 and 40 (!) minutes to run in GitHub Actions. When I run them locally and give it 10 workers, its runtime it also less than desirable:

$ python -m pytest -x -c pyproject.toml --nbval-lax --dist loadscope -n logical --durations=20 examples/ \
          --ignore=examples/deprecated/ \
          --ignore=examples/experimental/ \
          --ignore=examples/lammps/
============================================================== test session starts ===============================================================
platform darwin -- Python 3.12.0, pytest-8.4.2, pluggy-1.6.0
rootdir: /Users/mattthompson/software/openff-interchange
configfile: pyproject.toml
plugins: anyio-4.11.0, xdist-3.8.0, nbval-0.11.0, cov-7.0.0
10 workers [127 items]
......................................................................................s.......^R
 .^R
..s.....................s.......            [100%]
================================================================ warnings summary ================================================================
examples/host-guest/host_guest.ipynb: 1 warning
examples/openmm-import/protein-ligand.ipynb: 1 warning
examples/vectorized_representations/vectorized_representations.ipynb: 1 warning
examples/conformer_energies/conformer_energies.ipynb: 1 warning
examples/packed_box/packed_box.ipynb: 1 warning
examples/protein_ligand/protein_ligand.ipynb: 1 warning
examples/ligand_in_water/ligand_in_water.ipynb: 1 warning
examples/virtual_sites/virtual_sites.ipynb: 1 warning
examples/amber/amber.ipynb: 1 warning
examples/openmm/openmm.ipynb: 1 warning
  /Users/mattthompson/mamba/envs/interchange-examples-env/lib/python3.12/site-packages/coverage/control.py:946: CoverageWarning: No data was collected. (no-data-collected); see https://coverage.readthedocs.io/en/7.11.0/messages.html#warning-no-data-collected
    self._warn("No data was collected.", slug="no-data-collected")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================= tests coverage =================================================================
________________________________________________ coverage: platform darwin, python 3.12.0-final-0 ________________________________________________

Coverage XML written to file coverage.xml
============================================================== slowest 20 durations ==============================================================
172.74s call     examples/ligand_in_water/ligand_in_water.ipynb::Cell 19
83.56s call     examples/protein_ligand/protein_ligand.ipynb::Cell 7
76.32s call     examples/protein_ligand/protein_ligand.ipynb::Cell 23
64.77s call     examples/openmm/openmm.ipynb::Cell 0
61.66s call     examples/amber/amber.ipynb::Cell 0
55.80s call     examples/protein_ligand/protein_ligand.ipynb::Cell 19
52.56s call     examples/packed_box/packed_box.ipynb::Cell 6
51.52s call     examples/packed_box/packed_box.ipynb::Cell 7
46.62s call     examples/ligand_in_water/ligand_in_water.ipynb::Cell 14
40.82s call     examples/ligand_in_water/ligand_in_water.ipynb::Cell 18
39.28s call     examples/virtual_sites/virtual_sites.ipynb::Cell 0
38.34s call     examples/ligand_in_water/ligand_in_water.ipynb::Cell 0
36.89s call     examples/protein_ligand/protein_ligand.ipynb::Cell 27
35.01s call     examples/protein_ligand/protein_ligand.ipynb::Cell 2
34.37s call     examples/packed_box/packed_box.ipynb::Cell 0
34.34s call     examples/protein_ligand/protein_ligand.ipynb::Cell 0
33.76s call     examples/conformer_energies/conformer_energies.ipynb::Cell 0
33.65s call     examples/vectorized_representations/vectorized_representations.ipynb::Cell 0
33.56s call     examples/openmm-import/protein-ligand.ipynb::Cell 0
33.52s call     examples/ligand_in_water/ligand_in_water.ipynb::Cell 6
============================================ 124 passed, 3 skipped, 10 warnings in 446.27s (0:07:26) =============================================

From a quick pass, the slowest cells appear to be (roughly in descending order):

  • Running a ligand in TIP4P in GROMACS
  • Getting the protein-ligand single-point energies in all three supported engines
  • Getting the protein single-point energies in all three supported engines
  • Assigning partial charges to large ligands
  • Running short (5-10 ps) simulations
  • Writing to Amber files
  • Loading a PDB file file with a protein and other components
  • Loading a PDB file file with a protein
  • Creating openmm.app.Simulation objects
  • Energy-minimizing condensed-phase systems

Some of these can be worked around by updating the examples themselves, others are probably sore spots for users.

Metadata

Metadata

Assignees

Labels

amberRelating to files or programs in the Amber suitedocumentationImprovements or additions to documentationgromacsrelating to GROMACSopenmmpolymer-performance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions