[Dart-dev] DART/branches Revision: 11950

dart at ucar.edu dart at ucar.edu
Thu Sep 21 16:36:50 MDT 2017


nancy at ucar.edu
2017-09-21 16:36:49 -0600 (Thu, 21 Sep 2017)
770
bug fix:  

don't call convert_vertical_obs() on tasks which don't have obs.
model_mod code might not be expecting a size of 0 (and better not
to assume it would.)  do the same with state even though currently
we don't allow #tasks to be larger than the state vector size.

fixes for other things:

- increase integer format width in count_close messages
- add timer around count_close() based on brian's comment that
   the all_reduce is slow on large task counts
- combine 2 missing_in_state vars into one
- add comment in spread_restoration about the fix craig proposed
   for the case of 0 spread in the obs prior variance.  not part
   of the code yet because it might not be sufficient
- remove old debug section in code that "can't happen" to avoid
   confusion




Modified: DART/branches/rma_trunk/assimilation_code/modules/assimilation/assim_tools_mod.f90
===================================================================
--- DART/branches/rma_trunk/assimilation_code/modules/assimilation/assim_tools_mod.f90	2017-09-21 22:24:09 UTC (rev 11949)
+++ DART/branches/rma_trunk/assimilation_code/modules/assimilation/assim_tools_mod.f90	2017-09-21 22:36:49 UTC (rev 11950)
@@ -18,9 +18,7 @@
                                  find_namelist_in_file, register_module, error_handler,   &
                                  E_ERR, E_MSG, nmlfileunit, do_nml_file, do_nml_term,     &
                                  open_file, close_file, timestamp
-
 use       sort_mod,       only : index_sort 
-
 use random_seq_mod,       only : random_seq_type, random_gaussian, init_random_seq,       &
                                  random_uniform
 
@@ -373,7 +371,7 @@
 integer  :: num_close_obs_calls_made, num_close_states_calls_made
 ! GSR add new count for only the 'assimilate' type close obs in the tile
 integer  :: localization_unit, secs, days, rev_num_close_obs
-character(len = 102)  :: base_loc_text   ! longest location formatting possible
+character(len = 200)  :: base_loc_text   ! longer than longest location formatting possible
 
 type(location_type)  :: my_obs_loc(obs_ens_handle%my_num_vars)
 type(location_type)  :: base_obs_loc, last_base_obs_loc, last_base_states_loc
@@ -384,7 +382,7 @@
 type(time_type)      :: obs_time, this_obs_time
 
 logical :: do_adapt_inf_update
-logical :: missing_in_state, allow_missing_in_state
+logical :: allow_missing_in_state
 ! for performance, local copies 
 logical :: local_single_ss_inflate
 logical :: local_varying_ss_inflate
@@ -407,6 +405,7 @@
 integer :: istatus 
 integer :: vstatus(obs_ens_handle%my_num_vars) !< for vertical conversion status.
 
+
 ! we are going to read/write the copies array
 call prepare_to_update_copies(ens_handle)
 call prepare_to_update_copies(obs_ens_handle)
@@ -501,14 +500,16 @@
    ! convert the vertical of all my observations to the localization coordinate
    ! this may not be bitwise with Lanai because of a different number of set_location calls
    if (timing) call start_mpi_timer(base)
-   call convert_vertical_obs(ens_handle, obs_ens_handle%my_num_vars, my_obs_loc, &
-                             my_obs_kind, my_obs_type, get_vertical_localization_coord(), vstatus)
-   do i = 1, obs_ens_handle%my_num_vars
-      if (good_dart_qc(nint(obs_ens_handle%copies(OBS_GLOBAL_QC_COPY, i)))) then
-         !> @todo Can I just use the OBS_GLOBAL_QC_COPY? Is it ok to skip the loop?
-         if (vstatus(i) /= 0) obs_ens_handle%copies(OBS_GLOBAL_QC_COPY, i) = DARTQC_FAILED_VERT_CONVERT
-      endif
-   enddo
+   if (obs_ens_handle%my_num_vars > 0) then
+      call convert_vertical_obs(ens_handle, obs_ens_handle%my_num_vars, my_obs_loc, &
+                                my_obs_kind, my_obs_type, get_vertical_localization_coord(), vstatus)
+      do i = 1, obs_ens_handle%my_num_vars
+         if (good_dart_qc(nint(obs_ens_handle%copies(OBS_GLOBAL_QC_COPY, i)))) then
+            !> @todo Can I just use the OBS_GLOBAL_QC_COPY? Is it ok to skip the loop?
+            if (vstatus(i) /= 0) obs_ens_handle%copies(OBS_GLOBAL_QC_COPY, i) = DARTQC_FAILED_VERT_CONVERT
+         endif
+      enddo
+   endif 
    if (timing) then
       elapsed = read_mpi_timer(base)
       print*, 'convert_vertical_obs time :', elapsed, 'rank ', my_task_id()
@@ -534,8 +535,10 @@
 !> optionally convert all state location verticals
 if (convert_all_state_verticals_first .and. is_doing_vertical_conversion) then
    if (timing) call start_mpi_timer(base)
-   call convert_vertical_state(ens_handle, ens_handle%my_num_vars, my_state_loc, my_state_kind,  &
-                                            my_state_indx, get_vertical_localization_coord(), istatus)
+   if (ens_handle%my_num_vars > 0) then
+      call convert_vertical_state(ens_handle, ens_handle%my_num_vars, my_state_loc, my_state_kind,  &
+                                  my_state_indx, get_vertical_localization_coord(), istatus)
+   endif
    if (timing) then
       elapsed = read_mpi_timer(base)
       print*, 'convert_vertical_state time :', elapsed, 'rank ', my_task_id()
@@ -862,10 +865,17 @@
    ! For adaptive localization, need number of other obs close to the chosen observation
    if(adaptive_localization_threshold > 0) then
 
+      if (timing) call start_mpi_timer(base)
+
       ! this does a cross-task sum, so all tasks must make this call.
       total_num_close_obs = count_close(num_close_obs, close_obs_ind, my_obs_type, &
                                         close_obs_dist, cutoff_rev*2.0_r8)
+      if (timing) then
+         elapsed = read_mpi_timer(base)
+         print*, 'count_close time :', elapsed, 'rank ', my_task_id()
+      endif
 
+
       ! Want expected number of close observations to be reduced to some threshold;
       ! accomplish this by cutting the size of the cutoff distance.
       if(total_num_close_obs > adaptive_localization_threshold) then
@@ -901,7 +911,7 @@
                call get_time(this_obs_time,secs,days)
                call write_location(-1, base_obs_loc, charstring=base_loc_text)
 
-               write(localization_unit,'(i8,1x,i5,1x,i8,1x,A,2(f14.5,1x,i10))') i, secs, days, &


More information about the Dart-dev mailing list