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 858 by chuckv, Fri Nov 7 21:46:56 2003 UTC vs.
Revision 883 by chuckv, Thu Dec 18 20:46: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.9 2003-11-07 21:46:56 chuckv Exp $, $Date: 2003-11-07 21:46:56 $, $Name: not supported by cvs2svn $, $Revision: 1.9 $
10 > !! @version $Id: mpiSimulation_module.F90,v 1.11 2003-12-18 20:46:45 chuckv Exp $, $Date: 2003-12-18 20:46:45 $, $Name: not supported by cvs2svn $, $Revision: 1.11 $
11  
12   module mpiSimulation  
13    use definitions
# Line 60 | Line 60 | module mpiSimulation  
60  
61   #ifdef PROFILE
62    public :: printCommTime
63 <
64 <  real(kind = dp ), save :: commTime = 0.0_dp
65 <  real(kind = dp ) :: commTimeInitial,commTimeFinal
63 >  public :: getCommTime
64 >  real,save   :: commTime = 0.0
65 >  real   :: commTimeInitial,commTimeFinal
66   #endif
67  
68   !! Include mpiComponentPlan type. mpiComponentPlan is a
# Line 73 | Line 73 | module mpiSimulation  
73  
74  
75   !! Tags used during force loop for parallel simulation
76 <  integer, allocatable, dimension(:) :: tagLocal
76 >  integer, public, allocatable, dimension(:) :: tagLocal
77    integer, public, allocatable, dimension(:) :: tagRow
78    integer, public, allocatable, dimension(:) :: tagColumn
79  
# Line 512 | Line 512 | contains
512      if (present(status)) status = 0
513      noffset = this_plan%displs(this_plan%myPlanRank)
514   #ifdef PROFILE
515 <    commTimeInitial = mpi_wtime()
515 >    call cpu_time(commTimeInitial)
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()
521 >    call cpu_time(commTimeFinal)
522      commTime = commTime + commTimeFinal - commTimeInitial
523   #endif
524  
# Line 542 | Line 542 | contains
542  
543   !    noffset = this_plan%displs(this_plan%me)
544   #ifdef PROFILE
545 <   commTimeInitial = mpi_wtime()
545 >   call cpu_time(commTimeInitial)
546   #endif
547  
548      call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_double_precision, &
# Line 550 | Line 550 | contains
550          this_plan%myPlanComm, mpi_err)
551  
552   #ifdef PROFILE
553 <    commTimeFinal = mpi_wtime()
553 >    call cpu_time(commTimeFinal)
554      commTime = commTime + commTimeFinal - commTimeInitial
555   #endif
556  
# Line 571 | Line 571 | contains
571     if (present(status)) status = 0
572  
573   #ifdef PROFILE
574 <   commTimeInitial = mpi_wtime()
574 >   call cpu_time(commTimeInitial)
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()
579 >    call cpu_time(commTimeFinal)
580      commTime = commTime + commTimeFinal - commTimeInitial
581   #endif
582  
# Line 596 | Line 596 | contains
596  
597     if (present(status)) status = 0
598   #ifdef PROFILE
599 <   commTimeInitial = mpi_wtime()
599 >   call cpu_time(commTimeInitial)
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()
605 >    call cpu_time(commTimeFinal)
606      commTime = commTime + commTimeFinal - commTimeInitial
607   #endif
608  
# Line 626 | Line 626 | contains
626   ! allocate row arrays
627      nrow = getNrow(plan_row)
628      ncol = getNcol(plan_col)
629 +    
630 +    if(.not. allocated(tagLocal)) then
631 +       allocate(tagLocal(size(tags)),STAT=alloc_stat)
632 +        if (alloc_stat /= 0 ) then
633 +          status = -1
634 +          return
635 +       endif
636 +    else
637 +       deallocate(tagLocal)
638 +       allocate(tagLocal(size(tags)),STAT=alloc_stat)
639 +       if (alloc_stat /= 0 ) then
640 +          status = -1
641 +          return
642 +       endif
643  
644 +    endif
645 +
646 +    tagLocal = tags
647 +
648 +    
649      if (.not. allocated(tagRow)) then
650         allocate(tagRow(nrow),STAT=alloc_stat)
651         if (alloc_stat /= 0 ) then
# Line 661 | Line 680 | contains
680      call gather(tags,tagRow,plan_row)
681      call gather(tags,tagColumn,plan_col)
682  
683 +  
684    end subroutine setTags
685  
686   !  pure function getNcol(thisplan) result(ncol)
# Line 729 | Line 749 | contains
749  
750   #ifdef PROFILE
751    subroutine printCommTime()
732
752      write(*,*) "MPI communication time is: ", commTime
734
753    end subroutine printCommTime
754 +
755 +  function getCommTime() result(comm_time)
756 +    real :: comm_time
757 +    comm_time = commTime
758 +  end function getCommTime
759 +
760   #endif
761  
762   #endif // is_mpi

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines