| 7 | 
  | 
!! | 
| 8 | 
  | 
!! @author Charles F. Vardeman II | 
| 9 | 
  | 
!! @author Matthew Meineke | 
| 10 | 
< | 
!! @version $Id: mpiSimulation_module.F90,v 1.6 2003-08-13 21:20:20 chuckv Exp $, $Date: 2003-08-13 21:20:20 $, $Name: not supported by cvs2svn $, $Revision: 1.6 $ | 
| 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 $ | 
| 11 | 
  | 
 | 
| 12 | 
  | 
module mpiSimulation   | 
| 13 | 
  | 
  use definitions | 
| 14 | 
  | 
#ifdef IS_MPI | 
| 15 | 
< | 
  use mpi | 
| 15 | 
> | 
  use oopseMPI | 
| 16 | 
  | 
  implicit none | 
| 17 | 
  | 
  PRIVATE | 
| 18 | 
  | 
 | 
| 32 | 
  | 
!! PUBLIC  Subroutines contained in MPI module | 
| 33 | 
  | 
  public :: mpi_bcast | 
| 34 | 
  | 
  public :: mpi_allreduce | 
| 35 | 
< | 
  public :: mpi_reduce | 
| 35 | 
> | 
!  public :: mpi_reduce | 
| 36 | 
  | 
  public :: mpi_send | 
| 37 | 
  | 
  public :: mpi_recv | 
| 38 | 
  | 
  public :: mpi_get_processor_name | 
| 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 | 
  | 
#ifdef PROFILE | 
| 62 | 
  | 
  public :: printCommTime | 
| 63 | 
  | 
 | 
| 64 | 
< | 
  real(kind = dp ) :: commTime = 0.0_dp | 
| 64 | 
> | 
  real(kind = dp ), save :: commTime = 0.0_dp | 
| 65 | 
  | 
  real(kind = dp ) :: commTimeInitial,commTimeFinal | 
| 66 | 
  | 
#endif | 
| 67 | 
  | 
 | 
| 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 | 
| 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 | 
  | 
 | 
| 471 | 
  | 
 | 
| 472 | 
  | 
  subroutine gather_integer( sbuffer, rbuffer, this_plan, status) | 
| 473 | 
  | 
 | 
| 474 | 
< | 
    type (gs_plan), intent(in) :: this_plan | 
| 475 | 
< | 
    integer, dimension(:), intent(in) :: sbuffer | 
| 476 | 
< | 
    integer, dimension(:), intent(in) :: rbuffer | 
| 474 | 
> | 
    type (gs_plan), intent(inout) :: this_plan | 
| 475 | 
> | 
    integer, dimension(:), intent(inout) :: sbuffer | 
| 476 | 
> | 
    integer, dimension(:), intent(inout) :: rbuffer | 
| 477 | 
  | 
    integer :: noffset | 
| 478 | 
  | 
    integer, intent(out), optional :: status | 
| 479 | 
  | 
    integer :: i | 
| 503 | 
  | 
  subroutine gather_double( sbuffer, rbuffer, this_plan, status) | 
| 504 | 
  | 
 | 
| 505 | 
  | 
    type (gs_plan), intent(in) :: this_plan | 
| 506 | 
< | 
    real( kind = DP ), dimension(:), intent(in) :: sbuffer | 
| 507 | 
< | 
    real( kind = DP ), dimension(:), intent(in) :: rbuffer | 
| 506 | 
> | 
    real( kind = DP ), dimension(:), intent(inout) :: sbuffer | 
| 507 | 
> | 
    real( kind = DP ), dimension(:), intent(inout) :: rbuffer | 
| 508 | 
  | 
    integer :: noffset | 
| 509 | 
  | 
    integer, intent(out), optional :: status | 
| 510 | 
  | 
 | 
| 531 | 
  | 
  subroutine gather_double_2d( sbuffer, rbuffer, this_plan, status) | 
| 532 | 
  | 
 | 
| 533 | 
  | 
    type (gs_plan), intent(in) :: this_plan | 
| 534 | 
< | 
    real( kind = DP ), dimension(:,:), intent(in) :: sbuffer | 
| 535 | 
< | 
    real( kind = DP ), dimension(:,:), intent(in) :: rbuffer | 
| 534 | 
> | 
    real( kind = DP ), dimension(:,:), intent(inout) :: sbuffer | 
| 535 | 
> | 
    real( kind = DP ), dimension(:,:), intent(inout) :: rbuffer | 
| 536 | 
  | 
    integer :: noffset,i,ierror | 
| 537 | 
  | 
    integer, intent(out), optional :: status | 
| 538 | 
  | 
     | 
| 563 | 
  | 
  subroutine scatter_double( sbuffer, rbuffer, this_plan, status) | 
| 564 | 
  | 
 | 
| 565 | 
  | 
    type (gs_plan), intent(in) :: this_plan | 
| 566 | 
< | 
    real( kind = DP ), dimension(:), intent(in) :: sbuffer | 
| 567 | 
< | 
    real( kind = DP ), dimension(:), intent(in) :: rbuffer | 
| 566 | 
> | 
    real( kind = DP ), dimension(:), intent(inout) :: sbuffer | 
| 567 | 
> | 
    real( kind = DP ), dimension(:), intent(inout) :: rbuffer | 
| 568 | 
  | 
    integer, intent(out), optional :: status | 
| 569 | 
  | 
    external mpi_reduce_scatter | 
| 570 | 
  | 
 | 
| 589 | 
  | 
  subroutine scatter_double_2d( sbuffer, rbuffer, this_plan, status) | 
| 590 | 
  | 
 | 
| 591 | 
  | 
    type (gs_plan), intent(in) :: this_plan | 
| 592 | 
< | 
    real( kind = DP ), dimension(:,:), intent(in) :: sbuffer | 
| 593 | 
< | 
    real( kind = DP ), dimension(:,:), intent(in) :: rbuffer | 
| 592 | 
> | 
    real( kind = DP ), dimension(:,:), intent(inout) :: sbuffer | 
| 593 | 
> | 
    real( kind = DP ), dimension(:,:), intent(inout) :: rbuffer | 
| 594 | 
  | 
    integer, intent(out), optional :: status | 
| 595 | 
  | 
    external mpi_reduce_scatter | 
| 596 | 
  | 
  | 
| 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 |