devito icon indicating copy to clipboard operation
devito copied to clipboard

dsl: Introduce abstractions for multi-stage time integrators

Open fernanvr opened this issue 8 months ago • 3 comments

Implementation of the ideas of @mloubout, as discussed in the Slack channel #timestepping.

It were created two new classes:

  • MultiStage: Each instance represents a combination of a PDE and its associated time integrator.

  • RK: Instances encapsulate a Butcher Tableau. The class methods define specific Runge-Kutta schemes, and it includes logic to expand a single PDE into multiple stage equations according to the RK method. It only contains the classic RK44, of fourth order and four stages, as a prove of concept.

To integrate the MultiStage into Devito’s pipeline, we modified the _lower(...) function in operator.py by adding the line: expressions = cls._lower_multistage(expressions, **kwargs), and modified _sanitize_exprs(cls, expressions, **kwargs) to recognize MultiStage instances.

We also created a new function: _lower_multistage(), in the same file. This function handles the expansion of MultiStage instances into their corresponding stage equations.

fernanvr avatar May 05 '25 16:05 fernanvr

Thank you all for the comprehensive review comments. They have been incredibly helpful in improving my coding skills and deepening my understanding of some of Devito’s workflows. Overall, I believe I have incorporated most of the suggestions to enhance the code. However, there are still a few points where I could use some additional guidance.

fernanvr avatar Jun 13 '25 22:06 fernanvr

Codecov Report

:x: Patch coverage is 25.52632% with 283 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 45.80%. Comparing base (ed3585a) to head (ac1da7e). :warning: Report is 235 commits behind head on main.

Files with missing lines Patch % Lines
tests/test_multistage.py 10.09% 196 Missing :warning:
devito/types/multistage.py 40.27% 86 Missing :warning:
devito/ir/equations/algorithms.py 91.66% 1 Missing :warning:

:exclamation: There is a different number of reports uploaded between BASE (ed3585a) and HEAD (ac1da7e). Click for more details.

HEAD has 15 uploads less than BASE
Flag BASE (ed3585a) HEAD (ac1da7e)
17 4
pytest-gpu-nvc-nvidiaX 1 0
pytest-gpu-aomp-amdgpuX 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2599       +/-   ##
===========================================
- Coverage   92.00%   45.80%   -46.20%     
===========================================
  Files         245      250        +5     
  Lines       48727    50032     +1305     
  Branches     4294     4376       +82     
===========================================
- Hits        44830    22916    -21914     
- Misses       3209    26154    +22945     
- Partials      688      962      +274     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX ?
pytest-gpu-nvc-nvidiaX ?

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jul 10 '25 16:07 codecov[bot]

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB