CliMA / ClimaCoupler.jl

ClimaCoupler: bringing atmosphere, land, and ocean together
Apache License 2.0
25 stars 4 forks source link

ClimaCoupler interface #134

Closed juliasloan25 closed 1 year ago

juliasloan25 commented 1 year ago

Purpose

We want to refactor the ClimaCoupler to make a more modular interface.

Benefits

This will remove global-scope objects, making performance tracking faster and increasing usability of the interface. Code will be more generalized and therefore able to be used by different modules more easily.

Risks

We will develop an interface that will conflict with the current main stream of the model. To minimize this risk, we are developing this interface in parallel with development of the rest of the model. Eventually we will change over the rest of the code to align with this new interface design.

People and Personnel

Components

  1. Modularize utilities used by the coupler driver a. Check unit test coverage
  2. Move functions from the coupler driver to an external module a. Check unit test coverage
  3. Optimize and generalize modules used by driver a. Re-evaluate scope of global variables and make them local if possible b. Add coupler-specific abstractions which are consistent with other CliMA model abstractions c. Optimize, generalize existing coupler functions

Module Conversion Task Breakdown

For each module: PHASE 1 - moving and documentation

  1. Copy file(s) to module in src/
  2. Add module to src/ClimaCoupler.jl
  3. Docstring for each function a. Add input/output types in docstring if not type annotated b. Add docstring info to docs/src, docs/make.jl
  4. Add exports for externally-used functions
  5. Flag potentially-removable parts of code

PHASE 2 - testing

  1. Create test file in test/, add to test/runtests.jl
  2. Unit test for each exported function in module a. Test simplest functions first
  3. Integration tests as needed
  4. Add any tests that use MPI in test/mpi_tests and in buildkite pipeline a. Add file to run_mpi_tests.jl

PHASE 3 - cleanup

  1. Remove flagged parts of code a. Test after each one
  2. Check all imports are necessary
  3. Formatting
  4. Read through comments

Results and deliverables

Quality expectations

Performance metrics

Throughout development, we will track performance changes as we update modules. During the optimization stage (after translation to modules) flame graphs will be used to assess performance of the entire driver.

Task Breakdown And Tentative Due Dates

Next steps (partly addressed in issue #205 )

Proposed Delivery Date

10 January 2023

tapios commented 1 year ago

Looking good! Do you think you could add rough estimates of timelines, @juliasloan25?

simonbyrne commented 1 year ago

To follow up on our call this morning:

LenkaNovak commented 1 year ago

Completed. 🎉

Next steps are to restructure experiments folder (#232), make the modular interface more performant (#205 and subsequent issues) and redesign the exchange (pull and push!) component (#211).