Skip to content
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

Remove calls to no-op routines in ensemble manager #632

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 4 additions & 12 deletions assimilation_code/modules/assimilation/filter_mod.dopplerfold.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ module filter_mod
compute_copy_mean, compute_copy_mean_sd, &
compute_copy_mean_var, duplicate_ens, get_copy_owner_index, &
get_ensemble_time, set_ensemble_time, broadcast_copy, &
map_pe_to_task, prepare_to_update_copies, &
copies_in_window, set_num_extra_copies, get_allow_transpose, &
all_copies_to_all_vars, allocate_single_copy, allocate_vars, &
get_single_copy, put_single_copy, deallocate_single_copy, &
print_ens_handle
map_pe_to_task, copies_in_window, set_num_extra_copies, &
get_allow_transpose, all_copies_to_all_vars, &
allocate_single_copy, allocate_vars, get_single_copy, &
put_single_copy, deallocate_single_copy, print_ens_handle

use adaptive_inflate_mod, only : do_ss_inflate, mean_from_restart, sd_from_restart, &
inflate_ens, adaptive_inflate_init, &
Expand Down Expand Up @@ -806,7 +805,6 @@ subroutine filter_main()
call trace_message('Before prior inflation damping and prep')

if (inf_damping(PRIOR_INF) /= 1.0_r8) then
call prepare_to_update_copies(state_ens_handle)
state_ens_handle%copies(PRIOR_INF_COPY, :) = 1.0_r8 + &
inf_damping(PRIOR_INF) * (state_ens_handle%copies(PRIOR_INF_COPY, :) - 1.0_r8)
endif
Expand Down Expand Up @@ -907,7 +905,6 @@ subroutine filter_main()
call trace_message('Before posterior inflation damping')

if (inf_damping(POSTERIOR_INF) /= 1.0_r8) then
call prepare_to_update_copies(state_ens_handle)
state_ens_handle%copies(POST_INF_COPY, :) = 1.0_r8 + &
inf_damping(POSTERIOR_INF) * (state_ens_handle%copies(POST_INF_COPY, :) - 1.0_r8)
endif
Expand Down Expand Up @@ -1549,9 +1546,6 @@ subroutine filter_ensemble_inflate(ens_handle, inflate_copy, inflate, ENS_MEAN_C

integer :: j, group, grp_bot, grp_top, grp_size

! Assumes that the ensemble is copy complete
call prepare_to_update_copies(ens_handle)

! Inflate each group separately; Divide ensemble into num_groups groups
grp_size = ens_size / num_groups

Expand Down Expand Up @@ -2827,8 +2821,6 @@ subroutine update_observations_radar(obs_ens_handle, ens_size, seq, keys, prior_
! for quiet execution, set it to false.
verbose = .true.

call prepare_to_update_copies(obs_ens_handle)

do j = 1, obs_ens_handle%my_num_vars
! get the key number associated with each of my subset of obs
! then get the obs and extract info from it.
Expand Down
92 changes: 1 addition & 91 deletions assimilation_code/modules/utilities/ensemble_manager_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ module ensemble_manager_mod
get_copy, put_copy, all_vars_to_all_copies, &
all_copies_to_all_vars, allocate_vars, deallocate_vars, &
compute_copy_mean_var, get_copy_owner_index, set_ensemble_time, &
broadcast_copy, prepare_to_write_to_vars, prepare_to_write_to_copies, &
prepare_to_read_from_vars, prepare_to_read_from_copies, prepare_to_update_vars, &
prepare_to_update_copies, print_ens_handle, set_current_time, &
broadcast_copy, print_ens_handle, set_current_time, &
map_task_to_pe, map_pe_to_task, get_current_time, &
allocate_single_copy, put_single_copy, get_single_copy, &
deallocate_single_copy
Expand Down Expand Up @@ -442,94 +440,6 @@ end subroutine broadcast_copy

!-----------------------------------------------------------------

subroutine prepare_to_write_to_vars(ens_handle)

! Warn ens manager that we're going to directly update the %vars array

type(ensemble_type), intent(inout) :: ens_handle

!ens_handle%valid = VALID_VARS

end subroutine prepare_to_write_to_vars

!-----------------------------------------------------------------

subroutine prepare_to_write_to_copies(ens_handle)

! Warn ens manager that we're going to directly update the %copies array

type(ensemble_type), intent(inout) :: ens_handle

!ens_handle%valid = VALID_COPIES

end subroutine prepare_to_write_to_copies

!-----------------------------------------------------------------

subroutine prepare_to_read_from_vars(ens_handle)

! Check to be sure that the vars array is current

type(ensemble_type), intent(in) :: ens_handle

!if (ens_handle%valid /= VALID_VARS .and. ens_handle%valid /= VALID_BOTH) then
! call error_handler(E_ERR, 'prepare_to_read_from_vars', &
! 'last access not var-complete', source)
!endif

end subroutine prepare_to_read_from_vars

!-----------------------------------------------------------------

subroutine prepare_to_read_from_copies(ens_handle)

! Check to be sure that the copies array is current

type(ensemble_type), intent(in) :: ens_handle

!if (ens_handle%valid /= VALID_COPIES .and. ens_handle%valid /= VALID_BOTH) then
! call error_handler(E_ERR, 'prepare_to_read_from_copies', &
! 'last access not copy-complete', source)
!endif

end subroutine prepare_to_read_from_copies

!-----------------------------------------------------------------

subroutine prepare_to_update_vars(ens_handle)

! We need read/write access, so it has to start valid for vars or both,
! and then is going to be vars only going out.

type(ensemble_type), intent(inout) :: ens_handle

!if (ens_handle%valid /= VALID_VARS .and. ens_handle%valid /= VALID_BOTH) then
! call error_handler(E_ERR, 'prepare_to_update_vars', &
! 'last access not var-complete', source)
!endif
!ens_handle%valid = VALID_VARS

end subroutine prepare_to_update_vars

!-----------------------------------------------------------------

subroutine prepare_to_update_copies(ens_handle)

! We need read/write access, so it has to start valid for copies or both,
! and then is going to be copies only going out.

type(ensemble_type), intent(inout) :: ens_handle

!if (ens_handle%valid /= VALID_COPIES .and. ens_handle%valid /= VALID_BOTH) then
! call error_handler(E_ERR, 'prepare_to_update_copies', &
! 'last access not copy-complete', source)
!endif
!ens_handle%valid = VALID_COPIES

end subroutine prepare_to_update_copies

!-----------------------------------------------------------------

subroutine set_ensemble_time(ens_handle, indx, mtime)

! Sets the time of an ensemble member indexed by local storage on this pe.
Expand Down
182 changes: 0 additions & 182 deletions assimilation_code/modules/utilities/ensemble_manager_mod.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ Public interfaces
\ compute_copy_mean
\ compute_copy_mean_sd
\ compute_copy_mean_var
\ prepare_to_write_to_vars
\ prepare_to_write_to_copies
\ prepare_to_read_from_vars
\ prepare_to_read_from_copies
\ prepare_to_update_vars
\ prepare_to_update_copies
\ print_ens_handle
\ map_pe_to_task
\ map_task_to_pe
Expand Down Expand Up @@ -796,182 +790,6 @@ A note about documentation style. Optional arguments are enclosed in brackets *[

|

.. container:: routine

*call prepare_to_update_vars(ens_handle)*
::

type(ensemble_type), intent(inout) :: ens_handle

.. container:: indent1

Call this routine before directly accessing the ``ens_handle%vars`` array when the data is going to be updated, and
the incoming vars array should have the most current data representation.

Internally the ensemble manager tracks which of the copies or vars arrays, or both, have the most recently updated
representation of the data. For example, before a transpose (``all_vars_to_all_copies()`` or
``all_copies_to_all_vars()``) the code checks to be sure the source array has the most recently updated
representation before it does the operation. After a transpose both representations have the same update time and are
both valid.

For efficiency reasons we allow the copies and vars arrays to be accessed directly from other code without going
through a routine in the ensemble manager. The "prepare" routines verify that the desired array has the most recently
updated representation of the data, and if needed marks which one has been updated so the internal consistency checks
have an accurate accounting of the representations.

============== ================================================
``ens_handle`` Handle for the ensemble being accessed directly.
============== ================================================

|

.. container:: routine

*call prepare_to_update_copies(ens_handle)*
::

type(ensemble_type), intent(inout) :: ens_handle

.. container:: indent1

Call this routine before directly accessing the ``ens_handle%copies`` array when the data is going to be updated, and
the incoming copies array should have the most current data representation.

Internally the ensemble manager tracks which of the copies or vars arrays, or both, have the most recently updated
representation of the data. For example, before a transpose (``all_vars_to_all_copies()`` or
``all_copies_to_all_vars()``) the code checks to be sure the source array has the most recently updated
representation before it does the operation. After a transpose both representations have the same update time and are
both valid.

For efficiency reasons we allow the copies and vars arrays to be accessed directly from other code without going
through a routine in the ensemble manager. The "prepare" routines verify that the desired array has the most recently
updated representation of the data, and if needed marks which one has been updated so the internal consistency checks
have an accurate accounting of the representations.

============== ================================================
``ens_handle`` Handle for the ensemble being accessed directly.
============== ================================================

|

.. container:: routine

*call prepare_to_read_from_vars(ens_handle)*
::

type(ensemble_type), intent(inout) :: ens_handle

.. container:: indent1

Call this routine before directly accessing the ``ens_handle%vars`` array for reading only, when the incoming vars
array should have the most current data representation.

Internally the ensemble manager tracks which of the copies or vars arrays, or both, have the most recently updated
representation of the data. For example, before a transpose (``all_vars_to_all_copies()`` or
``all_copies_to_all_vars()``) the code checks to be sure the source array has the most recently updated
representation before it does the operation. After a transpose both representations have the same update time and are
both valid.

For efficiency reasons we allow the copies and vars arrays to be accessed directly from other code without going
through a routine in the ensemble manager. The "prepare" routines verify that the desired array has the most recently
updated representation of the data, and if needed marks which one has been updated so the internal consistency checks
have an accurate accounting of the representations.

============== ================================================
``ens_handle`` Handle for the ensemble being accessed directly.
============== ================================================

|

.. container:: routine

*call prepare_to_read_from_copies(ens_handle)*
::

type(ensemble_type), intent(inout) :: ens_handle

.. container:: indent1

Call this routine before directly accessing the ``ens_handle%copies`` array for reading only, when the incoming
copies array should have the most current data representation.

Internally the ensemble manager tracks which of the copies or vars arrays, or both, have the most recently updated
representation of the data. For example, before a transpose (``all_vars_to_all_copies()`` or
``all_copies_to_all_vars()``) the code checks to be sure the source array has the most recently updated
representation before it does the operation. After a transpose both representations have the same update time and are
both valid.

For efficiency reasons we allow the copies and vars arrays to be accessed directly from other code without going
through a routine in the ensemble manager. The "prepare" routines verify that the desired array has the most recently
updated representation of the data, and if needed marks which one has been updated so the internal consistency checks
have an accurate accounting of the representations.

============== ================================================
``ens_handle`` Handle for the ensemble being accessed directly.
============== ================================================

|

.. container:: routine

*call prepare_to_write_to_vars(ens_handle)*
::

type(ensemble_type), intent(inout) :: ens_handle

.. container:: indent1

Call this routine before directly accessing the ``ens_handle%vars`` array for writing. This routine differs from the
'update' version in that it doesn't care what the original data state is. This routine might be used in the case
where an array is being filled for the first time and consistency with the data in the copies array is not an issue.

Internally the ensemble manager tracks which of the copies or vars arrays, or both, have the most recently updated
representation of the data. For example, before a transpose (``all_vars_to_all_copies()`` or
``all_copies_to_all_vars()``) the code checks to be sure the source array has the most recently updated
representation before it does the operation. After a transpose both representations have the same update time and are
both valid.

For efficiency reasons we allow the copies and vars arrays to be accessed directly from other code without going
through a routine in the ensemble manager. The "prepare" routines verify that the desired array has the most recently
updated representation of the data, and if needed marks which one has been updated so the internal consistency checks
have an accurate accounting of the representations.

============== ================================================
``ens_handle`` Handle for the ensemble being accessed directly.
============== ================================================

|

.. container:: routine

*call prepare_to_write_to_copies(ens_handle)*
::

type(ensemble_type), intent(inout) :: ens_handle

.. container:: indent1

Call this routine before directly accessing the ``ens_handle%copies`` array for writing. This routine differs from
the 'update' version in that it doesn't care what the original data state is. This routine might be used in the case
where an array is being filled for the first time and consistency with the data in the vars array is not an issue.

Internally the ensemble manager tracks which of the copies or vars arrays, or both, have the most recently updated
representation of the data. For example, before a transpose (``all_vars_to_all_copies()`` or
``all_copies_to_all_vars()``) the code checks to be sure the source array has the most recently updated
representation before it does the operation. After a transpose both representations have the same update time and are
both valid.

For efficiency reasons we allow the copies and vars arrays to be accessed directly from other code without going
through a routine in the ensemble manager. The "prepare" routines verify that the desired array has the most recently
updated representation of the data, and if needed marks which one has been updated so the internal consistency checks
have an accurate accounting of the representations.

============== ================================================
``ens_handle`` Handle for the ensemble being accessed directly.
============== ================================================

|

Private interfaces
------------------

Expand Down