-
Notifications
You must be signed in to change notification settings - Fork 136
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
Implements reduction: min/max #1295
Implements reduction: min/max #1295
Conversation
…he routine fms_diag_do_reduction
…, fms_diag_reduction_methods.F90
BREAKING CHANGE: Any code using the global fms module (libFMS.F90) will break as this adds prefixes to all names in that module.
Public member _bounds3D_ of the fmsDiagBoundsHalos_type is changed to private and adds a getter function _get_bounds3D_ to access the memter.
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 is great progress. There are a few general comments:
- Please put as much description as possible into the error messages. There's nothing more frustrating for a user than encountering "Unsupported type". If you can put information about the actual field/file being worked on, that makes it even better.
- Name
if
statements. There is a lot of logic, and it's very difficult to follow. If you do something like this, it will make it much easier:
bigif: if (flag == maximum) then
...
nested: if (something) then
endif nested
else bigif
...
endif bigif
diag_manager/fms_diag_bbox.F90
Outdated
END TYPE fmsDiagIbounds_type | ||
|
||
!> @brief Data structure holding starting and ending indices in the I, J, and | ||
!! K dimensions. It also has extra members related to halo sizes and updated indices | ||
!! in I and J dimensions. | ||
type, public :: fmsDiagBoundsHalos_type | ||
private | ||
type(fmsDiagIbounds_type) :: bounds3D !< Holds starting and ending indices of | ||
type(fmsDiagIbounds_type), public :: bounds3D !< Holds starting and ending indices of |
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 should not be public. You can make a get_bounds3d function to get the indexes.
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.
Done.
diag_manager/fms_diag_object.F90
Outdated
@@ -37,6 +39,8 @@ module fms_diag_object_mod | |||
use fms_diag_output_buffer_mod | |||
use fms_mod, only: fms_error_handler | |||
use constants_mod, only: SECONDS_PER_DAY | |||
use fms_diag_bbox_mod, only: fmsDiagBoundsHalos_type, recondition_indices | |||
use fms_diag_reduction_methods_mod |
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.
Include the only
with the list of routines from the module.
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.
Added only: followed by fms_diag_update_extremum
|
||
!!TODO: Is check to bounds of current field necessary? | ||
!> Allocate buffers of this field variable | ||
!call this%allocate_diag_field_output_buffers(field_data, diag_field_id) |
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.
should this line be deleted?
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.
We need this line which is temporarily commented out.
!fms_diag_accept_data = this%fms_diag_do_reduction(field_data, diag_field_id, oor_mask, weight2, & | ||
!time, is_in, js_in, ks_in, ie_in, je_in, ke_in, err_msg) |
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 is commented out. Should it be deleted?
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.
No. We need this line.
diag_manager/fms_diag_object.F90
Outdated
oor_mask_4d => null() | ||
oor_mask_4d(1:size(oor_mask,1), 1:size(oor_mask,2), 1:size(oor_mask,3), 1:1) => oor_mask | ||
|
||
do i = 1, size(this%FMS_diag_fields(diag_field_id)%buffer_ids) |
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.
Can you label this loop?
buffer_id_loop: do i = 1, size(this%FMS_diag_fields(diag_field_id)%buffer_ids)
...
enddo buffer_id_loop
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.
done.
|
||
!> @brief Updates a chunk of buffer | ||
subroutine update_array_extremum(flag, field_data, buffer, mask, sample, recon_bounds, reduced_k_range) | ||
integer :: flag !< 0 for minimum; 1 for extremum |
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.
use a parameter instead of 0 and 1
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.
updated
|
||
!> @brief Updates a chunk of buffer | ||
subroutine update_array_extremum(flag, field_data, buffer, mask, sample, recon_bounds, reduced_k_range) | ||
integer :: flag !< 0 for minimum; 1 for extremum |
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.
use a parameter instead of 0 and 1
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.
updated
type is (real(kind=r4_kind)) | ||
select type (buffer) | ||
type is (real(kind=r4_kind)) | ||
if (flag .eq. 0) then |
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.
Please label some of these larger IF
statements in this routine. It would make it much easier to follow if they were labeled.
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.
done.
end select | ||
end subroutine update_scalar_extremum | ||
|
||
!> @brief Updates a chunk of buffer |
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 routine and the one above it need more documentation.
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.
Added more information.
end if | ||
end if | ||
class default | ||
call mpp_error( FATAL, "fms_diag_reduction_methods_mod::update_array_extremum type mismatch") |
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.
What is mismatched? Please provide more detail in these error messages.
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.
updated.
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 is great progress. There are a few general comments:
- Please put as much description as possible into the error messages. There's nothing more frustrating for a user than encountering "Unsupported type". If you can put information about the actual field/file being worked on, that makes it even better.
- Name
if
statements. There is a lot of logic, and it's very difficult to follow. If you do something like this, it will make it much easier:
bigif: if (flag == maximum) then
...
nested: if (something) then
endif nested
else bigif
...
endif bigif
f3 = recon_bounds%get_fjs() | ||
f4 = recon_bounds%get_fje() | ||
|
||
if (flag .ne. 3 .and. flag .ne. 4) then |
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.
These shouldn't be hard codded
This is included in #1367 |
Description
Fixes # (issue)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Please also note
any relevant details for your test configuration (e.g. compiler, OS). Include
enough information so someone can reproduce your tests.
Checklist:
make distcheck
passes