ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/mpiSimulation_module.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/mpiSimulation_module.F90 (file contents):
Revision 631 by chuckv, Thu Jul 17 19:25:51 2003 UTC vs.
Revision 834 by gezelter, Tue Oct 28 20:09:45 2003 UTC

# Line 7 | Line 7
7   !!
8   !! @author Charles F. Vardeman II
9   !! @author Matthew Meineke
10 < !! @version $Id: mpiSimulation_module.F90,v 1.5 2003-07-17 19:25:51 chuckv Exp $, $Date: 2003-07-17 19:25:51 $, $Name: not supported by cvs2svn $, $Revision: 1.5 $
10 > !! @version $Id: mpiSimulation_module.F90,v 1.8 2003-10-28 20:09:38 gezelter Exp $, $Date: 2003-10-28 20:09:38 $, $Name: not supported by cvs2svn $, $Revision: 1.8 $
11  
12   module mpiSimulation  
13    use definitions
# Line 48 | Line 48 | module mpiSimulation  
48    public :: mpi_status_size
49    public :: mpi_any_source
50  
51 +
52 +
53   !! Safety logical to prevent access to ComponetPlan until
54   !! set by C++.
55 <  logical :: ComponentPlanSet = .false.
55 >  logical, save :: ComponentPlanSet = .false.
56  
57  
58   !! generic mpi error declaration.
59 <  integer,public  :: mpi_err
59 >  integer, public :: mpi_err
60  
61 <  
61 > #ifdef PROFILE
62 >  public :: printCommTime
63  
64 +  real(kind = dp ), save :: commTime = 0.0_dp
65 +  real(kind = dp ) :: commTimeInitial,commTimeFinal
66 + #endif
67 +
68   !! Include mpiComponentPlan type. mpiComponentPlan is a
69   !! dual header file for both c and fortran.
70   #define __FORTRAN90
# Line 71 | Line 78 | module mpiSimulation  
78    integer, public, allocatable, dimension(:) :: tagColumn
79  
80   !! Logical set true if mpiSimulation has been initialized
81 <  logical :: isSimSet = .false.
81 >  logical, save :: isSimSet = .false.
82  
83  
84 <  type (mpiComponentPlan) :: mpiSim
84 >  type (mpiComponentPlan), save :: mpiSim
85  
86   !! gs_plan contains plans for gather and scatter routines
87    type, public :: gs_plan
# Line 90 | Line 97 | module mpiSimulation  
97    end type gs_plan
98  
99   ! plans for different decompositions
100 <  type (gs_plan), public :: plan_row
101 <  type (gs_plan), public :: plan_row3d
102 <  type (gs_plan), public :: plan_col
103 <  type (gs_plan), public :: plan_col3d
104 <  type(gs_plan),  public :: plan_row_Rotation
105 <  type(gs_plan),  public :: plan_col_Rotation
100 >  type (gs_plan), public, save :: plan_row
101 >  type (gs_plan), public, save :: plan_row3d
102 >  type (gs_plan), public, save :: plan_col
103 >  type (gs_plan), public, save :: plan_col3d
104 >  type (gs_plan),  public, save :: plan_row_Rotation
105 >  type (gs_plan),  public, save :: plan_col_Rotation
106  
107    type (mpiComponentPlan), pointer :: simComponentPlan
108  
# Line 504 | Line 511 | contains
511  
512      if (present(status)) status = 0
513      noffset = this_plan%displs(this_plan%myPlanRank)
514 <
514 > #ifdef PROFILE
515 >    commTimeInitial = mpi_wtime()
516 > #endif
517      call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_double_precision, &
518           rbuffer,this_plan%counts,this_plan%displs,mpi_double_precision, &
519           this_plan%myPlanComm, mpi_err)
520 + #ifdef PROFILE
521 +    commTimeFinal = mpi_wtime()
522 +    commTime = commTime + commTimeFinal - commTimeInitial
523 + #endif
524  
525      if (mpi_err /= 0) then
526        if (present(status)) status  = -1
# Line 528 | Line 541 | contains
541     if (present(status)) status = 0
542  
543   !    noffset = this_plan%displs(this_plan%me)
544 <    
544 > #ifdef PROFILE
545 >   commTimeInitial = mpi_wtime()
546 > #endif
547 >
548      call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_double_precision, &
549          rbuffer,this_plan%counts,this_plan%displs,mpi_double_precision, &
550          this_plan%myPlanComm, mpi_err)
551  
552 + #ifdef PROFILE
553 +    commTimeFinal = mpi_wtime()
554 +    commTime = commTime + commTimeFinal - commTimeInitial
555 + #endif
556 +
557      if (mpi_err /= 0) then
558        if (present(status)) status = -1
559      endif
# Line 549 | Line 570 | contains
570  
571     if (present(status)) status = 0
572  
573 + #ifdef PROFILE
574 +   commTimeInitial = mpi_wtime()
575 + #endif
576      call mpi_reduce_scatter(sbuffer,rbuffer, this_plan%counts, &
577           mpi_double_precision, MPI_SUM, this_plan%myPlanComm, mpi_err)
578 + #ifdef PROFILE
579 +    commTimeFinal = mpi_wtime()
580 +    commTime = commTime + commTimeFinal - commTimeInitial
581 + #endif
582  
583      if (mpi_err /= 0) then
584       if (present(status))  status = -1
# Line 567 | Line 595 | contains
595      external mpi_reduce_scatter
596  
597     if (present(status)) status = 0
598 + #ifdef PROFILE
599 +   commTimeInitial = mpi_wtime()
600 + #endif
601 +
602      call mpi_reduce_scatter(sbuffer,rbuffer, this_plan%counts, &
603           mpi_double_precision, MPI_SUM, this_plan%myPlanComm, mpi_err)
604 + #ifdef PROFILE
605 +    commTimeFinal = mpi_wtime()
606 +    commTime = commTime + commTimeFinal - commTimeInitial
607 + #endif
608  
609      if (mpi_err /= 0) then
610        if (present(status)) status = -1
# Line 627 | Line 663 | contains
663  
664    end subroutine setTags
665  
666 <  pure function getNcol(thisplan) result(ncol)
666 > !  pure function getNcol(thisplan) result(ncol)
667 >  function getNcol(thisplan) result(ncol)
668      type (gs_plan), intent(in) :: thisplan
669      integer :: ncol
670      ncol = thisplan%gsComponentPlan%nComponentsColumn
671    end function getNcol
672  
673 <  pure function getNrow(thisplan) result(nrow)
673 > !  pure function getNrow(thisplan) result(nrow)
674 >  function getNrow(thisplan) result(nrow)
675      type (gs_plan), intent(in) :: thisplan
676      integer :: nrow
677      nrow = thisplan%gsComponentPlan%nComponentsRow
# Line 689 | Line 727 | contains
727      myNode = mpiSim%myNode
728    end function getMyNode
729  
730 + #ifdef PROFILE
731 +  subroutine printCommTime()
732 +
733 +    write(*,*) "MPI communication time is: ", commTime
734 +
735 +  end subroutine printCommTime
736 + #endif
737 +
738   #endif // is_mpi
739   end module mpiSimulation
740  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines