<p><b>dwj07@fsu.edu</b> 2011-12-08 15:32:29 -0700 (Thu, 08 Dec 2011)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding mpi sync to timers. Now each processor reports the same time for each timer.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/performance/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/performance/src/core_ocean/mpas_ocn_mpas_core.F        2011-12-08 19:00:16 UTC (rev 1247)
+++ branches/ocean_projects/performance/src/core_ocean/mpas_ocn_mpas_core.F        2011-12-08 22:32:29 UTC (rev 1248)
@@ -84,8 +84,10 @@
err = ior(err, err_tmp)
call ocn_tendency_init(err_tmp)
- err = err .or. err_tmp
+ err = ior(err,err_tmp)
+ call mpas_timer_init(domain)
+
if(err.eq.1) then
call mpas_dmpar_abort(dminfo)
endif
Modified: branches/ocean_projects/performance/src/framework/mpas_timer.F
===================================================================
--- branches/ocean_projects/performance/src/framework/mpas_timer.F        2011-12-08 19:00:16 UTC (rev 1247)
+++ branches/ocean_projects/performance/src/framework/mpas_timer.F        2011-12-08 22:32:29 UTC (rev 1248)
@@ -1,5 +1,8 @@
module mpas_timer
+ use mpas_grid_types
+ use mpas_dmpar
+
implicit none
save
! private
@@ -8,9 +11,9 @@
include 'f90papi.h'
#endif
-#ifdef _MPI
- include 'mpif.h'
-#endif
+!#ifdef _MPI
+! include 'mpif.h'
+!#endif
type timer_node
character (len=72) :: timer_name
@@ -24,9 +27,12 @@
type (timer_node), pointer :: all_timers
integer :: levels
+ type (dm_info), pointer :: domain_info
+
public :: mpas_timer_start, &
mpas_timer_stop, &
- mpas_timer_write
+ mpas_timer_write, &
+ mpas_timer_init
contains
@@ -230,6 +236,10 @@
total_found = .false.
+ if(associated(domain_info)) then
+ call mpas_timer_sync()
+ endif
+
if(present(timer_ptr) .and. (.not.present(total_ptr))) then
print *,'timer_write :: timer_ptr valid, but total_ptr is not assigned.'
stop
@@ -290,6 +300,41 @@
end subroutine mpas_timer_write!}}}
+ subroutine mpas_timer_init(domain)!{{{
+ type (domain_type), intent(in), optional :: domain
+
+ if( present(domain) ) then
+ domain_info => domain % dminfo
+ endif
+
+ end subroutine mpas_timer_init!}}}
+
+ subroutine mpas_timer_sync()!{{{
+ type (timer_node), pointer :: current
+ real (kind=RKIND) :: all_total_time, all_max_time, all_min_time, all_ave_time
+
+ current => all_timers
+
+ sync_timers: do while(associated(current))
+ all_total_time = 0.0
+ all_max_time = 0.0
+ all_min_time = 0.0
+
+ call mpas_dmpar_max_real(domain_info, current % total_time, all_total_time)
+ current % total_time = all_total_time
+ current % avg_time = current % total_time / current % calls
+
+ call mpas_dmpar_max_real(domain_info, current % max_time, all_max_time)
+ current % max_time = all_max_time
+
+ call mpas_dmpar_min_real(domain_info, current % min_time, all_min_time)
+ current % min_time = all_min_time
+
+ current => current % next
+ end do sync_timers
+
+ end subroutine mpas_timer_sync!}}}
+
end module mpas_timer
! vim: foldmethod=marker et ts=2
</font>
</pre>