Skip to content

Cmake build#2

Merged
anton-seaice merged 4 commits into2025.02from
cmake_build
May 6, 2025
Merged

Cmake build#2
anton-seaice merged 4 commits into2025.02from
cmake_build

Conversation

@minghangli-uni
Copy link
Collaborator

@minghangli-uni minghangli-uni commented Dec 9, 2024

Open this PR to make some minor tweaks visible.

Closes #1

@minghangli-uni minghangli-uni self-assigned this Dec 9, 2024
@codecov
Copy link

codecov bot commented Dec 9, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@anton-seaice
Copy link
Collaborator

This is ready to review. This adds a CMake build for MOM6. The build supports building a library with access3 dependencies and building a standalone mom6.

If you have time to review @micaeljtoliveira that would be great.

@dougiesquire please review and confirm which is the right target branch for this PR?

@minghangli-uni - please reivew too :)

FYI @chrisb13

Copy link
Collaborator

@dougiesquire dougiesquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anton-seaice and @minghangli-uni. Looking great! One typo and a few questions, mostly about default settings.

Regarding which branch to use, I think it's probably best to use dev/access. There's an issue with the generic tracer changes that I need to resolve. We can still test most of our configs using dev/access, just not the WOMBAT one.

@anton-seaice
Copy link
Collaborator

Regarding which branch to use, I think it's probably best to use dev/access. There's an issue with the generic tracer changes that I need to resolve. We can still test most of our configs using dev/access, just not the WOMBAT one.

ok - we'd want to reset dev/access to the same as branch 'origin/PRcandidate-202502-gtracer-nuopc' first to avoid the unrelated changes being in this PR.

I thought dev/access needs to be in a state to be able to merge upstream in the future ? (which it wouldn't be with this change)

@dougiesquire
Copy link
Collaborator

ok - we'd want to reset dev/access to the same as branch 'origin/PRcandidate-202502-gtracer-nuopc' first to avoid the unrelated changes being in this PR.

I don't think we want to do this

I thought dev/access needs to be in a state to be able to merge upstream in the future ? (which it wouldn't be with this change)

I need to go and reread the new fork-management policy

Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
@anton-seaice
Copy link
Collaborator

Apologies for the git chaos.

Even though this change won't end up upstream (probably), we will merge into dev/access - as described in #7

I removed the generic tracers changes which are not in dev/access yet.

@anton-seaice
Copy link
Collaborator

I think I addressed all the comments. This is ready for re-review

New builds:

ACCESS-NRI/ACCESS-OM3#35 (comment)
ACCESS-NRI/ACCESS-OM3#64 (comment)

Copy link
Member

@micaeljtoliveira micaeljtoliveira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

dougiesquire
dougiesquire previously approved these changes Mar 27, 2025
Copy link
Collaborator

@dougiesquire dougiesquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@anton-seaice
Copy link
Collaborator

This is ready to merge, just holding off until we are tripley sure dev/access is the place for it

Copy link
Collaborator

@dougiesquire dougiesquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, another thought:

I wonder if we should put CMakeLists.txt in the cmake directory. This might be preferred if/when we try to get this upstream.

Copy link
Collaborator

@dougiesquire dougiesquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@anton-seaice anton-seaice merged commit 411281f into 2025.02 May 6, 2025
18 checks passed
anton-seaice added a commit that referenced this pull request May 6, 2025
* Add cmake build based on https://github.com/cOSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
@dougiesquire dougiesquire deleted the cmake_build branch May 6, 2025 06:18
@dougiesquire dougiesquire restored the cmake_build branch May 6, 2025 06:18
dougiesquire added a commit that referenced this pull request Jun 27, 2025
* Add cmake build based on https://github.com/cOSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jun 27, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jun 27, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jun 30, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jun 30, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jun 30, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jun 30, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
@dougiesquire dougiesquire deleted the cmake_build branch July 3, 2025 11:09
dougiesquire added a commit that referenced this pull request Jul 28, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jul 28, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Aug 4, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
dougiesquire added a commit that referenced this pull request Aug 4, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Aug 13, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Aug 21, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Aug 22, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire pushed a commit that referenced this pull request Nov 27, 2025
* Add MOM_ANN module

* Mesoscale momentum parameterization with ANN

- Computes subgrid stress using ANN in MOM_Zanna_Bolton
- Uses MOM_ANN module for ANN inference

Equivalent MOM_override for defaults
```
USE_ZB2020 = True
ZB2020_USE_ANN = True
USE_CIRCULATION_IN_HORVISC = True
ZB2020_ANN_FILE_TALL = /path/to/ocean3d/subfilter/FGR3/EXP1/model/Tall.nc
```

* Mesoscale momentum parameterization with ANN (#2)

Blank commit after squash/rebase was handled on command line

* Moved MOM_ANN.F90 to src/framework/

* Minor refactor of MOM_ANN

- Removed unused modules
- Removed unused MOM_memory.h
- Added input and output means which default to 0 and
  do not need to be present in the weights file
- Gave defaults to means, norms, tests so that they do
  no need to be present in file
- Added missing array notation "(:)"
- Minor formatting

* Adds unit tests and timing test to MOM_ANN

- Added ANN_allocate, set_layer, set_input_normalization, and
  set_output_normalization methods to allow reconfiguration during
  unit tests
- Added ANN_unit_tests with some simple constructed-by-code
  networks with known solutions
- Added config_src/drivers/unit_tests/test_MOM_ANN.F90 to drive
  unit tests
- Added  config_src/drivers/timing_tests/time_MOM_ANN.F90 as
  rudimentary for timing inference

* Adding multiple forms of inference

- Adds inference operating on array (instead of single vector of
  features)
- Implements several different versions of inference with various
  loop orders
  - Involves storing the transpose of A in the type
  - Tested by checking inference on same inputs is identical between
    variants
    - Added randomizers to assist in unit testing
- Adds timing of variants to config_src/drivers/timing/time_MOM_ANN.F90
- Adds an interface (MOM_apply) to select preferred version of
  inference subroutine
- Added command line args to time_MOM_ANN.F90 to allow more rapid
  evaluation of performance

Variants explored, timed with gfortran (13.2) -O3 on Xeon:
- vector_v1:
  - original inference from Pavel
- vector_v2:
  - allocate work arrays just once, using widest layer
  - loop over layers in 2's to avoid pointer calculations and copies
  - speed up, x0.8 relative to v1
- vector_v3:
  - transpose loops
  - slow down, x1.54 relative to v1
- vector_v4:
  - transpose weights with same loop order as v1
  - slow down, x1.03 relative to v1
- array_v1:
  - same structure as v2, working on x(space,feature) input/outputs
  - speed up, x0.41 relative to v1
- array_v2:
  - as for array_v1 but with transposed loop order
  - apply activation function on vector of first index while in cache
  - speed up, x0.35 relative to v1
- array_v3:
  - same structure as v2, working on x(feature,space) input/outputs
  - speed up, x0.58 relative to v1

* Renamed ANN variants and added some module documentation

- Added module dox
- Renamed _v1, _v2 etc to labels
- Added ANN_apply_array_sio to ANN_apply interface
- Replaced "flops" with "MBps" in timing output

* Removed alternative variants of ANN in favor of optimized

- Deleted variants of ANN that did not perform as well as the two
  versions that remain.

* Apply array_sio function in ANN inference for momentum fluxes (#5)

* Apply array_sio ANN inference for computation of momentum fluxes

* remove trailing space

* Initial commit

* address Robert Hallberg code review

* Restore deafult value of ZB_SCALING coefficient

---------

Co-authored-by: Alistair Adcroft <Alistair.Adcroft@noaa.gov>
Co-authored-by: Alistair Adcroft <adcroft@users.noreply.github.com>
dougiesquire added a commit that referenced this pull request Nov 27, 2025
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jan 12, 2026
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Jan 12, 2026
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Feb 10, 2026
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Feb 10, 2026
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
dougiesquire added a commit that referenced this pull request Feb 17, 2026
* Add cmake build based on https://github.com/COSIMA/access-om3

There are two variations, the default is to build the mom6 standalone executable, the alternative is to build a library for access3 models (with https://github.com/ACCESS-NRI/access3-share as a dependency).

Co-authored-by: Dougie Squire <dougie.squire@anu.edu.au>
Co-authored-by: minghangli-uni <minghang.li1@anu.edu.au>
Co-authored-by: Micael Oliveira <micael.oliveira@anu.edu.au>
Co-authored-by: Jorge Galvez Vallejo <jorge.galvezvallejo@anu.edu.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MOM6 cmake build

4 participants