--- trunk/OOPSE/libmdtools/do_Forces.F90 2003/08/08 21:22:37 673 +++ trunk/OOPSE/libmdtools/do_Forces.F90 2003/08/13 21:20:20 694 @@ -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.29 2003-08-13 21:20:20 chuckv Exp $, $Date: 2003-08-13 21:20:20 $, $Name: not supported by cvs2svn $, $Revision: 1.29 $ 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 ) @@ -206,6 +214,7 @@ contains real( kind = DP ) :: pot_local integer :: nrow integer :: ncol + integer :: nprocs #endif integer :: nlocal integer :: natoms @@ -263,6 +272,12 @@ contains call gather(A,A_Col,plan_col_rotation) endif +#endif + +!! Begin force loop timing: +#ifdef PROFILE + call cpu_time(forceTimeInitial) + nloops = nloops + 1 #endif if (FF_RequiresPrepairCalc() .and. SimRequiresPrepairCalc()) then @@ -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,39 @@ 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)