--- trunk/OOPSE/libmdtools/do_Forces.F90 2003/08/08 21:22:37 673 +++ trunk/OOPSE/libmdtools/do_Forces.F90 2003/10/30 18:59:20 845 @@ -4,7 +4,7 @@ !! @author Charles F. Vardeman II !! @author Matthew Meineke -!! @version $Id: do_Forces.F90,v 1.28 2003-08-08 21:22:37 chuckv Exp $, $Date: 2003-08-08 21:22:37 $, $Name: not supported by cvs2svn $, $Revision: 1.28 $ +!! @version $Id: do_Forces.F90,v 1.36 2003-10-30 18:59:20 gezelter Exp $, $Date: 2003-10-30 18:59:20 $, $Name: not supported by cvs2svn $, $Revision: 1.36 $ module do_Forces use force_globals @@ -45,6 +45,14 @@ contains public :: do_force_loop public :: setRlistDF +#ifdef PROFILE + real(kind = dp) :: forceTime + real(kind = dp) :: forceTimeInitial, forceTimeFinal + real(kind = dp) :: globalForceTime + real(kind = dp) :: maxForceTime + integer, save :: nloops = 0 +#endif + contains subroutine setRlistDF( this_rlist ) @@ -146,8 +154,9 @@ contains if (FF_uses_EAM) then - call init_EAM_FF(my_status) + call init_EAM_FF(my_status) if (my_status /= 0) then + write(*,*) "init_EAM_FF returned a bad status" thisStat = -1 return end if @@ -206,6 +215,7 @@ contains real( kind = DP ) :: pot_local integer :: nrow integer :: ncol + integer :: nprocs #endif integer :: nlocal integer :: natoms @@ -221,8 +231,7 @@ contains integer :: listerror, error integer :: localError - real(kind=dp) :: listSkin = 1.0 - + real(kind=dp) :: listSkin = 1.0 !! initialize local variables @@ -264,6 +273,12 @@ contains endif #endif + +!! Begin force loop timing: +#ifdef PROFILE + call cpu_time(forceTimeInitial) + nloops = nloops + 1 +#endif if (FF_RequiresPrepairCalc() .and. SimRequiresPrepairCalc()) then !! See if we need to update neighbor lists @@ -563,7 +578,14 @@ contains #endif ! phew, done with main loop. - + +!! Do timing +#ifdef PROFILE + call cpu_time(forceTimeFinal) + forceTime = forceTime + forceTimeFinal - forceTimeInitial +#endif + + #ifdef IS_MPI !!distribute forces @@ -677,7 +699,37 @@ contains endif #endif - + +#ifdef PROFILE + if (do_pot) then + +#ifdef IS_MPI + + + call printCommTime() + + call mpi_allreduce(forceTime,globalForceTime,1,MPI_DOUBLE_PRECISION, & + mpi_sum,mpi_comm_world,mpi_err) + + call mpi_allreduce(forceTime,maxForceTime,1,MPI_DOUBLE_PRECISION, & + MPI_MAX,mpi_comm_world,mpi_err) + + call mpi_comm_size( MPI_COMM_WORLD, nprocs,mpi_err) + + if (getMyNode() == 0) then + write(*,*) "Total processor time spent in force calculations is: ", globalForceTime + write(*,*) "Total Time spent in force loop per processor is: ", globalforceTime/nprocs + write(*,*) "Maximum force time on any processor is: ", maxForceTime + end if +#else + write(*,*) "Time spent in force loop is: ", forceTime +#endif + + + endif + +#endif + end subroutine do_force_loop subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot) @@ -730,7 +782,6 @@ contains call getElementProperty(atypes, me_j, "is_DP", is_DP_j) if ( is_DP_i .and. is_DP_j ) then - call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, & do_pot, do_stress) if (FF_uses_RF .and. SimUsesRF()) then @@ -755,6 +806,7 @@ contains if (FF_uses_GB .and. SimUsesGB()) then + call getElementProperty(atypes, me_i, "is_GB", is_GB_i) call getElementProperty(atypes, me_j, "is_GB", is_GB_j)