Commit 1cbebf2
ANN parameterization of horizontal momentum eddy fluxes (mom-ocean#944)
* 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>1 parent c412f0e commit 1cbebf2
5 files changed
Lines changed: 1132 additions & 16 deletions
File tree
- config_src/drivers
- timing_tests
- unit_tests
- src
- framework
- parameterizations/lateral
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments