-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add diag_manager testing for openmp #1281
Conversation
* fix - gnu and pgi issue with class(*) in send_data3d (NOAA-GFDL#1149) * feat: extend `string` interface in `fms_string_utils_mod` (NOAA-GFDL#1142) * fix: add omp directives for race condition in tridiagonal (NOAA-GFDL#1109) * fix: missing if statement in PR NOAA-GFDL#1149 (NOAA-GFDL#1155) * fix: time_manager missing changes from year to yr, month to mo, day to dy (NOAA-GFDL#1169) * chore: update changelog and version numbers for release (NOAA-GFDL#1167) * chore: append dev to version number post-release (NOAA-GFDL#1179) --------- Co-authored-by: Niki Zadeh <[email protected]> Co-authored-by: Jesse Lentz <[email protected]> Co-authored-by: ganganoaa <[email protected]> Co-authored-by: MiKyung Lee <[email protected]> Co-authored-by: Ryan Mulhall <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… old diag manager, fix possible race condition
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.
Some changes may be required but not critical to code function.
@@ -484,7 +477,6 @@ logical function allocate_data_buffer(this, input_data, diag_axis) | |||
call mpp_error ("allocate_data_buffer","The data input to set_data_buffer for "//& | |||
trim(this%varname)//" is not a supported type", FATAL) | |||
end select | |||
!$omp end single | |||
allocate_data_buffer = allocated(this%data_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.
Is it good to add the following statement here?
this%set_data_buffer_is_allocated(allocated(this%data_buffer))
class (fmsDiagField_type) , intent(inout) :: this !< The field object | ||
logical, intent (in) :: data_buffer_is_allocated !< Flag saying that the math | ||
!! functions need to be done | ||
|
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.
Comment for data_buffer_is_allocated is misleading.
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.
@uramirez8707 you can tell us the .true. means the data buffer is allocated. it seems obvious but not all of the variables are always obvious
diag_manager/fms_diag_object.F90
Outdated
call this%FMS_diag_fields(diag_field_id)%set_data_buffer(field_data, FMS_diag_object%diag_axis,& | ||
is, js, ks, ie, je, ke) | ||
|
||
!> Only 1 thread allocates the output buffer amd sets set_math_needs_to_be_done |
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.
typo amd
diag_manager/fms_diag_object.F90
Outdated
!> Only 1 thread allocates the output buffer amd sets set_math_needs_to_be_done | ||
!$omp single | ||
data_buffer_is_allocated = & | ||
this%FMS_diag_fields(diag_field_id)%allocate_data_buffer(field_data, FMS_diag_object%diag_axis) |
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 to avoid use of global variables/objects as much as we can. There could be multiple global instances of fmsDiagObject_type. Here, diag_axis is associated to an instance this but not to any other instance. Every time we change the global instance of the fmsDiagObject_type we have to come back here and change accordingly which is not good. So, FMS_diag_object%diag_axis should be replaced by this%diag_axis.
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.
yes! Good catch! Thanks.
this%data_buffer_allocated = allocate_data_buffer(this, input_data, diag_axis) | ||
if (.not.this%data_buffer_allocated) & | ||
integer :: is, js, ks !< Starting indicies of the field_data relative to the global domain | ||
integer :: ie, je, ke !< Ending indicied of the field_data relative to the global domain |
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.
typo indicied
class (fmsDiagField_type) , intent(inout):: this !< The field object | ||
class(*), dimension(:,:,:,:), intent(in) :: input_data !< The input array | ||
class(fmsDiagAxisContainer_type),intent(in) :: diag_axis(:) !< Array of diag_axis | ||
integer :: is, js, ks !< Starting indicies of the field_data | ||
integer :: ie, je, ke !< Ending indicied of the field_data |
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.
typo indicied
class (fmsDiagField_type) , intent(inout) :: this !< The field object | ||
logical, intent (in) :: data_buffer_is_allocated !< Flag saying that the math | ||
!! functions need to be done | ||
|
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.
@uramirez8707 you can tell us the .true. means the data buffer is allocated. it seems obvious but not all of the variables are always obvious
is, js, ks, ie, je, ke) | ||
|
||
!> Only 1 thread allocates the output buffer and sets set_math_needs_to_be_done | ||
!$omp critical |
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.
urg but agreed
axis_loop: do a = 1,naxes | ||
axis_id => this%axis_ids(a) | ||
select type (axis => diag_axis(axis_id)%axis) | ||
type is (fmsDiagFullAxis_type) | ||
length(a) = axis%axis_length() | ||
end select | ||
enddo axis_loop | ||
!> On a single thread, allocate the data buffer to the correct kind and size | ||
!$omp single | ||
|
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 doesnt need to be in a single/critical section?
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 function is called in a critical section, so there is no need for it here.
Description
Fixes # (issue)
How Has This Been Tested?
CI
Checklist:
make distcheck
passes