[Dart-dev] DART/branches Revision: 11706

dart at ucar.edu dart at ucar.edu
Fri Jun 9 12:57:33 MDT 2017


hendric at ucar.edu
2017-06-09 12:57:31 -0600 (Fri, 09 Jun 2017)
152
single file write when using mpi_tasks > 1.  this
simply sends the state variables to processor 0 then
writes out the diagnostic files and restarts...




Modified: DART/branches/rma_par_single_file/assimilation_code/modules/io/single_file_io_mod.f90
===================================================================
--- DART/branches/rma_par_single_file/assimilation_code/modules/io/single_file_io_mod.f90	2017-06-09 16:43:06 UTC (rev 11705)
+++ DART/branches/rma_par_single_file/assimilation_code/modules/io/single_file_io_mod.f90	2017-06-09 18:57:31 UTC (rev 11706)
@@ -807,12 +807,13 @@
 !-----------------------------------------------------------
 !> several options for diagnostic files:
 !>  * model_mod writes the diagnostic file (all copies, all output time steps in one file)
-!>  * dart writes the diagnostic file (all copies, all output time steps in one file)
-!>  * dart writes the diagnostic files (one copy, all timesteps per file)
+!>  * dart writes the diagnostic file      (all copies, all output time steps in one file)
+!>  * dart writes the diagnostic files     (one copy, all timesteps per file)
 !>  * single timestep runs:
 !>       - If num_output_ens is 0, the prior ENS_MEAN_COPY, ENS_SD_COPY, INF_COPY, INF_SD_COPY
 !>         are saved until the end.  This is for large models to reduce IO (transpose time).
-
+!> 
+!> for single file IO only task 0 will write out diagnostic and restart files 
 subroutine write_singlefile(ens_handle, file_info)
 
 type(ensemble_type),         intent(inout) :: ens_handle
@@ -830,6 +831,10 @@
 integer                :: timeindex
 integer                :: is1, id1
 
+! Assumes that mean and spread have already been computed
+!if (.not. get_allow_transpose(ens_handle)) &
+!   allocate(ens_handle%vars(ens_handle%num_vars, ens_handle% my_num_copies))
+
 ! assumes that mean and spread have already been computed
 ! make sure vars is up-to-date
 call allocate_vars(ens_handle)
@@ -844,54 +849,61 @@
    allocate(temp_ens(1))
 endif
 
-curr_ens_time = ens_handle%current_time
-call get_netcdf_file_type(file_info, ncFileID) 
-
-timeindex = nc_get_tindex(ncFileID, curr_ens_time)
-
-if ( timeindex < 0 ) then
+if (my_task_id() == 0) then ! task 0 writes out all files
+  
+   curr_ens_time = ens_handle%current_time
+   call get_netcdf_file_type(file_info, ncFileID) 
+   
+   timeindex = nc_get_tindex(ncFileID, curr_ens_time)
+   
+   if ( timeindex < 0 ) then
+      call get_time(curr_ens_time,is1,id1)
+      write(msgstring,*)'model time (d,s)',id1,is1,' not in ',ncFileID%fname
+      write(msgstring,'(''model time (d,s) ('',i8,i5,'') is index '',i6, '' in ncFileID '',i10)') &
+             id1,is1,timeindex,ncFileID%ncid
+      call error_handler(E_ERR,'write_model_variables', msgstring, source, revision, revdate)
+   endif
+   
    call get_time(curr_ens_time,is1,id1)
-   write(msgstring,*)'model time (d,s)',id1,is1,' not in ',ncFileID%fname
    write(msgstring,'(''model time (d,s) ('',i8,i5,'') is index '',i6, '' in ncFileID '',i10)') &
           id1,is1,timeindex,ncFileID%ncid
-   call error_handler(E_ERR,'write_model_variables', msgstring, source, revision, revdate)
-endif
+   call error_handler(E_DBG,'write_model_variables', msgstring, source, revision, revdate)
+   
+   my_ncid        = ncFileID%ncid
+endif 
 
-call get_time(curr_ens_time,is1,id1)
-write(msgstring,'(''model time (d,s) ('',i8,i5,'') is index '',i6, '' in ncFileID '',i10)') &
-       id1,is1,timeindex,ncFileID%ncid
-call error_handler(E_DBG,'write_model_variables', msgstring, source, revision, revdate)
+   num_output_ens = noutput_state_variables(file_info)
 
-my_ncid        = ncFileID%ncid
-num_output_ens = noutput_state_variables(file_info)
-
-! Output ensemble members
-do member_index = 1, num_output_ens
-   call get_copy(map_task_to_pe(ens_handle, 0), ens_handle, member_index, temp_ens)
-   call write_model_variables(ncFileID,  temp_ens, member_index, curr_ens_time, timeindex)
-enddo
-
-! Output Extras
-ens_size = ens_handle%num_copies - ens_handle%num_extras
-
-do copy_index = ens_size+1, ens_handle%num_copies
-   if ( file_info%stage_metadata%io_flag(copy_index) == WRITE_COPY ) then
-      copyname = get_copy_name(file_info, copy_index)
-      call get_copy(map_task_to_pe(ens_handle, 0), ens_handle, copy_index, temp_ens)
-      if(my_task_id() == 0) then
-         call write_extra_variables(ncFileID, temp_ens, copyname, curr_ens_time, timeindex)
+   ! Output ensemble members
+   do member_index = 1, num_output_ens
+      call get_copy(map_task_to_pe(ens_handle, 0), ens_handle, member_index, temp_ens)
+      if(my_task_id() == 0) &
+         call write_model_variables(ncFileID,  temp_ens, member_index, curr_ens_time, timeindex)
+   enddo
+   
+   ! Output Extras
+   ens_size = ens_handle%num_copies - ens_handle%num_extras


More information about the Dart-dev mailing list