-
Notifications
You must be signed in to change notification settings - Fork 321
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
[IO] Adding functions to estimate max byte size of all fields in a pool #1217
base: master
Are you sure you want to change the base?
Conversation
src/framework/mpas_stream_manager.F
Outdated
character :: tmp_char | ||
integer(kind=I8KIND) :: max_field_bytes, field_bytes | ||
integer(kind=I8KIND), parameter :: int_size = c_sizeof(tmp_int) | ||
integer(kind=I8KIND), parameter :: real_size = c_sizeof(tmp_real) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be possible to avoid creating temporary variables only to check their size. I think it might work, for example, to write
integer(kind=I8KIND), parameter :: real_size = c_sizeof(1.0_RKIND)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work for RKIND, but I wasn't sure about how it works for character and int. Got some build errors.
call mpas_pool_get_field(allFields, itr % memberName, real5d, timeLevel) | ||
field_size = global_dim_size(real5d % block, real5d % dimNames, real5d % dimSizes, info % nDims) | ||
end select | ||
field_bytes = int(field_size, kind=I8KIND) * real_size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps field_size
should be declared as an I8KIND
, and this type conversion should be eliminated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a type conversion involved whether it's in this function or inside global_dim_size
. Not sure if mpas_pool_get_dimension
can work with I8KIND int pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now changed this. The only type conversion happens in global_dim_size
, due to mpas_pool_get_dimension
forcing a regular int. And I've changed to mpas_dmpar_sum_int8
now
This PR introduces two functions to
src/framework/mpas_stream_manager.F
to help compute the max byte size given a field pool from an output stream. This information can be used to decide whether to use CDF2 or CDF5 as the output file format. See #1219function
stream_max_var_size
accepts a field pool and iterates through each field callingglobal_dim_size
to obtain the dimension size of the current field over the entire domain, then computes the number of bytes occupied and the max bytes size over all the fields in the poolfunction
global_dim_size
iterates over all the dimensions in a given field to compute the overall field size, obtaining the global dimension size if the dimension is decomposed. IfisVarArray=.true.
, it skips over the left-most dim, which tracks the size of the variable list, and is not present in the output file.