MAPL_CollectiveGather3D Subroutine

public subroutine MAPL_CollectiveGather3D(Grid, LocArray, GlobArray, CoresPerNode, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(inout) :: Grid
real, intent(in) :: LocArray(:,:,:)
real, pointer :: GlobArray(:,:,:)
integer, intent(in), optional :: CoresPerNode
integer, intent(out), optional :: rc

Calls

proc~~mapl_collectivegather3d~~CallsGraph proc~mapl_collectivegather3d MAPL_CollectiveGather3D ESMF_VMGet ESMF_VMGet proc~mapl_collectivegather3d->ESMF_VMGet ESMF_VMGetCurrent ESMF_VMGetCurrent proc~mapl_collectivegather3d->ESMF_VMGetCurrent interface~mapl_arrayigather MAPL_ArrayIGather proc~mapl_collectivegather3d->interface~mapl_arrayigather interface~mapl_assert MAPL_Assert proc~mapl_collectivegather3d->interface~mapl_assert proc~mapl_collectivewait MAPL_CollectiveWait proc~mapl_collectivegather3d->proc~mapl_collectivewait proc~mapl_createrequest MAPL_CreateRequest proc~mapl_collectivegather3d->proc~mapl_createrequest proc~mapl_gridget MAPL_GridGet proc~mapl_collectivegather3d->proc~mapl_gridget proc~mapl_return MAPL_Return proc~mapl_collectivegather3d->proc~mapl_return proc~mapl_roundrobinpelist MAPL_RoundRobinPEList proc~mapl_collectivegather3d->proc~mapl_roundrobinpelist proc~mapl_verify MAPL_Verify proc~mapl_collectivegather3d->proc~mapl_verify proc~mapl_collectivewait->proc~mapl_return proc~mapl_collectivewait->proc~mapl_verify mpi_recv mpi_recv proc~mapl_collectivewait->mpi_recv mpi_wait mpi_wait proc~mapl_collectivewait->mpi_wait proc~mapl_createrequest->ESMF_VMGet proc~mapl_createrequest->ESMF_VMGetCurrent proc~mapl_createrequest->interface~mapl_assert proc~mapl_createrequest->proc~mapl_return proc~mapl_createrequest->proc~mapl_verify ESMF_GridGet ESMF_GridGet proc~mapl_createrequest->ESMF_GridGet mpi_irecv mpi_irecv proc~mapl_createrequest->mpi_irecv proc~mapl_distgridget MAPL_DistGridGet proc~mapl_createrequest->proc~mapl_distgridget proc~mapl_gridget->proc~mapl_return proc~mapl_gridget->proc~mapl_verify ESMF_AttributeGet ESMF_AttributeGet proc~mapl_gridget->ESMF_AttributeGet ESMF_DistGridGet ESMF_DistGridGet proc~mapl_gridget->ESMF_DistGridGet proc~mapl_gridget->ESMF_GridGet proc~mapl_gridget->proc~mapl_distgridget proc~mapl_getimsjms MAPL_GetImsJms proc~mapl_gridget->proc~mapl_getimsjms proc~mapl_gridhasde MAPL_GridHasDE proc~mapl_gridget->proc~mapl_gridhasde at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_roundrobinpelist->proc~mapl_return proc~mapl_roundrobinpelist->proc~mapl_verify interface~mapl_getnewrank MAPL_GetNewRank proc~mapl_roundrobinpelist->interface~mapl_getnewrank proc~mapl_verify->proc~mapl_throw_exception proc~mapl_distgridget->proc~mapl_verify proc~mapl_distgridget->ESMF_DistGridGet proc~mapl_getimsjms->interface~mapl_assert proc~mapl_getimsjms->proc~mapl_return proc~mapl_getimsjms->proc~mapl_verify interface~mapl_sort MAPL_Sort proc~mapl_getimsjms->interface~mapl_sort proc~mapl_gridhasde->proc~mapl_return proc~mapl_gridhasde->proc~mapl_verify proc~mapl_gridhasde->ESMF_DistGridGet proc~mapl_gridhasde->ESMF_GridGet ESMF_DELayoutGet ESMF_DELayoutGet proc~mapl_gridhasde->ESMF_DELayoutGet

Source Code

  subroutine MAPL_CollectiveGather3D(Grid, LocArray, GlobArray, &
                                     CoresPerNode, rc)

    type (ESMF_Grid),        intent(INout) :: Grid
    real,                    intent(IN   ) :: LocArray(:,:,:)
    real, pointer                          :: GlobArray(:,:,:)
    integer, optional,       intent(In   ) :: CoresPerNode
    integer, optional,       intent(  OUT) :: rc

! Locals
!-------

    integer                       :: status


    type (MAPL_CommRequest)       :: reqs(size(LocArray,3))
    integer                       :: root(size(LocArray,3))
    integer                       :: Nnodes
    integer                       :: nn
    integer                       :: LM, L, nc, npes, mype, dims(5)
    type(ESMF_VM)                 :: VM
    integer                       :: comm

! Begin
!------

    _ASSERT(.not.associated(GlobArray), 'GlobalArray already associated')

    call ESMF_VMGetCurrent(VM,         RC=STATUS)
    _VERIFY(STATUS)
    call ESMF_VMGet(VM, petcount=npes, localpet=MYPE, mpiCommunicator=comm, RC=STATUS)
    _VERIFY(STATUS)


    LM     = size(LocArray,3)

    nNodes = size(MAPL_NodeRankList)
    call MAPL_RoundRobinPEList(Root, nNodes, RC=STATUS)
    _VERIFY(STATUS)

    if(any(root==mype)) then
       call MAPL_GridGet ( grid, globalCellCountPerDim=DIMS, RC=STATUS)
       _VERIFY(STATUS)
       nc = count(Root==mype)
       allocate(GlobArray(dims(1),dims(2),nc),stat=STATUS)
       _VERIFY(STATUS)
    else
       allocate(GlobArray(1,1,1)             ,stat=STATUS)
       _VERIFY(STATUS)
    endif

    nn = 0

    do L=1,LM
       if(root(L) == mype) then
          nn = nn + 1
          call MAPL_CreateRequest(GRID, Root(L), reqs(L), tag=L,    &
                               RequestType=MAPL_IsGather,           &
                               DstArray=GlobArray(:,:,nn),          &
                               PrePost=.true.,             RC=STATUS)
          _VERIFY(STATUS)
       else
          call MAPL_CreateRequest(GRID, Root(L), reqs(L), tag=L,    &
                               RequestType=MAPL_IsGather,           &
                               DstArray=GlobArray(:,:,1),           &
                               PrePost=.true.,             RC=STATUS)
          _VERIFY(STATUS)
       end if
    enddo  ! Do not fuse with next

    do L=1,LM
       call MAPL_ArrayIGather (LocArray(:,:,L), reqs(L),  RC=STATUS)
       _VERIFY(STATUS)
    enddo  ! Do not fuse with next

    do L=1,LM
       call MAPL_CollectiveWait(reqs(L), rc=status)
       _VERIFY(STATUS)
    end do

    _RETURN(ESMF_SUCCESS)
     _UNUSED_DUMMY(corespernode)
 end subroutine MAPL_CollectiveGather3D