Replace diagnosticsPool with module-level variables#611
Replace diagnosticsPool with module-level variables#611mattdturner wants to merge 5 commits intoMPAS-Dev:ocean/developfrom
Conversation
Merge the changes in PR#457 for mpas_ocn_diagnostics.F that remove scratch allocates and the calls to mpas_pool_get_config.
Replace the calls to mpas_pool_get_dimension on meshPool with the use of the ocn_mesh module
Remove all instances (where possible) of meshPool from the diagnostic routines, their argument list, and the argument lists of subroutines called by diagnostic routines.
Replace all of the instances of diagnosticsPool with module-level variables. diagnosticsPool is only during init now.
Update the edgeSignOnCell and edgeSignOnVertex allocatable arrays in ocn_init_routines_setup_sign_and_index_fields instead of pointers. Also change ocn_meshUpdateFields to update the pointers to match thew allocatables
|
This passes the nightly regression suite on Cori w/ Intel compiler. The results are bfb for performance test (where I did most of my testing), and should be bfb for the entire suite. |
philipwjones
left a comment
There was a problem hiding this comment.
Ran a quick test on Summit/PGI with same results. And by partial inspection (didn't look at all 59 files).
| /> | ||
| <var name="RediKappaData" type="real" dimensions="nCells" units="m^2 s^{-1}" | ||
| description="Redi isopycnal mixing Kappa value. This is the data field specified at init." | ||
| packages="gm" |
There was a problem hiding this comment.
@mark-petersen This was necessary to get a few of the tests in the regression suite to pass. I can revert this change if necessary.
| call ocn_init_routines_setup_sign_and_index_fields() | ||
| ! Update edgeSignOnCell and edgeSignOnVertex pionters in ocn_mesh. The ocn_mesh allocatables | ||
| ! are updated in ocn_init_routines_setup_sign_and_index_fields. This updates the pointers to | ||
| ! Registry to match the allocatable arrays | ||
| call mpas_pool_get_array(meshPool, 'edgeSignOnCell', edgeSignOnCellTmp) | ||
| call mpas_pool_get_array(meshPool, 'edgeSignOnVertex', edgeSignOnVertexTmp) | ||
| edgeSignOnCellTmp = int(edgeSignOnCell) | ||
| edgeSignOnVertexTmp = int(edgeSignOnVertex) | ||
|
|
There was a problem hiding this comment.
@philipwjones Can you check this to make sure there isn't an issue with the way I'm updating the Registry pointers for edgeSignOnCell and edgeSignOnVertex?
There was a problem hiding this comment.
Yes, this looks fine.
| ! Allocatable array was updated in ocn_init_routines_setup_sign_and_index_fields. Now the | ||
| ! pointer needs to be udpated. | ||
| do n = 1, nCellsAll+1 | ||
| do k = 1, maxEdges | ||
| edgeSignOnCell(k, n) = real(edgeSignOnCellTmp(k, n), RKIND) | ||
| edgeSignOnCellTmp(k, n) = int(edgeSignOnCell(k, n)) |
There was a problem hiding this comment.
@philipwjones I don't know if this is necessary anymore, since I updated the pointer in mpas_ocn_init_routines.F. Eventually, every routine should be using the arrays instead of pointers, correct?
There was a problem hiding this comment.
Might be good to keep the pointers updated in case someone still accesses via the meshPool. The current mesh module is back-compatible with pools just so we could do incremental development, but we will eventually get rid of all the pointers here (and Registry entries) in favor of just allocatable arrays in this module.
| nEdges = nCellsArray( size(nCellsArray) ) | ||
| nCells = nCellsAll | ||
| nVertices = nVerticesAll | ||
| nEdges = nCellsAll |
There was a problem hiding this comment.
@mark-petersen Should line 491 (previously 542) be nEdges = nEdgesAll instead of nEdges = nCellsAll? I based the current line on what was previously there, but it seems odd that we are setting nEdges to nCellsAll...
…to ocean/develop New module for ocean diagnostics variables #745 This PR add a new module to house the variables contained in diagnosticsPool in the ocean model. This also implements the use of the new module in the mpas_ocn_diagnostics.F file. This is the first of a handful of PRs that will replace #611 by breaking it up into smaller PRs.
This PR creates a new file
mpas_ocn_diagnostics_variables.Fthat houses all variables in thediagnosticsPool. Duringinit, there is a call tompas_pool_get_arrayfor each of the variables in the diagnosticsPool, and then other files use those variables via ause ocn_diagnostics_variablesstatement. This change makes it easier for these arrays to be copied to the GPUs. Note, though, that there is no code in this PR to copy arrays to the GPU.This PR also changes the diagnostics code to use the
ocn_meshmodule instead of themeshPool, based on #496.