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

ClimaCoupler interface #134

Closed
13 tasks done
juliasloan25 opened this issue Oct 17, 2022 · 3 comments · Fixed by #144
Closed
13 tasks done

ClimaCoupler interface #134

juliasloan25 opened this issue Oct 17, 2022 · 3 comments · Fixed by #144
Assignees
Labels
🏅 SDI Software Design Issue

Comments

@juliasloan25
Copy link
Member

juliasloan25 commented Oct 17, 2022

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

  • One module for each utility used by the driver
    • Regridding (masker.jl, regridder.jl)
    • Conservation checker (conservation_checker.jl)
    • Input file reader (bcfile_reader.jl)
    • Callback manager + calendar (calendar_timer.jl)
    • General utilities (general_helper.jl, flux_calculator.jl)
    • Diagnostics/visualization/output file generator (viz_explorer.jl, output_dumper.jl)
    • Information exchange (push_pull.jl, flux_calculator.jl)
  • Tests in ClimaCoupler/test/ for each new module
    • Move tests from coupler_utils/unit_tester.jl
  • Comparison between new and previous implementations in buildkite
    • Update/improve ClimaCoupler CI

Quality expectations

  • Unit tests for each module
  • Documentation for each module

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 )

  • Optimize, generalize existing coupler functions (6 Jan)
    • Discuss design
    • re-design exchange (punk! and pull) and surface_fluxes calls
    • Re-evaluate scope of global variables
    • Generalize time stepping (move from driver)

Proposed Delivery Date

10 January 2023

@tapios
Copy link

tapios commented Oct 18, 2022

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

@simonbyrne
Copy link
Member

To follow up on our call this morning:

  • work incrementally, moving items that are in examples or elsewhere to src, then importing those into the driver files.
  • this list seems like a good breakdown, and order of priority.
  • add docs and tests for each item as you go.
  • don't worry about moving things to other repos for now:
    • it's easier to move things to dependencies at a later date, especially once they are documented and tested

@juliasloan25 juliasloan25 mentioned this issue Oct 26, 2022
17 tasks
@juliasloan25 juliasloan25 linked a pull request Nov 17, 2022 that will close this issue
17 tasks
@bors bors bot closed this as completed in #144 Nov 30, 2022
@juliasloan25 juliasloan25 reopened this Nov 30, 2022
bors bot added a commit that referenced this issue Jan 3, 2023
175: Boundary Condition Reader interface r=juliasloan25 a=juliasloan25

For reviewers: This is a large PR, but the majority of the changes are in `src/BCReader.jl`, `test/bcreader_tests.jl`, and `test/mpi_tests/bcreader_mpi_tests.jl`. Also, I created the `src/CallbackManager.jl` file in this PR to simplify compatibility with BCReader, but that module will be documented and tested in a separate PR.

Move functions from `coupler_utils/bcfile_reader.jl` to `src/BCReader.jl` module, and ensure that they are thoroughly commented and tested.

#134 

## To-do
PHASE 1 - moving and documentation
- [x] Copy file(s) to module in `src/`
- [x] Add module to `ClimaCoupler.jl`
- [x] Docstring for each function
  - [x] Add input/output types in docstring if not type annotated
  - [x] Add docstring info to `docs/src`, `docs/make.jl`
- [x] Add exports for externally-used functions
- [x] Flag potentially-removable parts of code

PHASE 2 - testing
- [x] Create test file in `test/`, add to `test/runtests.jl`
- [x] Unit test for each exported function in module
- [x] Integration tests as needed
- [x] Add any tests that use MPI in `test/mpi_tests` and in buildkite pipeline

PHASE 3 - cleanup
- [x] Remove flagged parts of code
- [x] Check all imports are necessary
- [x] Formatting
- [x] Read through comments


Co-authored-by: Julia Sloan <[email protected]>
@LenkaNovak
Copy link
Collaborator

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏅 SDI Software Design Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants