Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out) | :: | List(:) | |||
integer, | intent(in) | :: | nNodes | |||
integer, | intent(in), | optional | :: | Root | ||
logical, | intent(in), | optional | :: | UseFirstRank | ||
integer, | intent(out), | optional | :: | FirstRank | ||
integer, | intent(out), | optional | :: | RC |
subroutine MAPL_RoundRobinPEList(List,nNodes,Root,UseFirstRank,FirstRank,RC) integer, intent( OUT) :: List(:) integer, intent(IN ) :: nNodes integer, optional, intent(IN ) :: Root logical, optional, intent(IN ) :: UseFirstRank integer, optional, intent(out ) :: FirstRank integer, optional, intent( OUT) :: RC integer :: status integer, allocatable :: filled(:),nPerNode(:) integer :: i,n,nlist,locRoot logical :: gotFirstRank,lUseFirstRank if (present(Root)) then locRoot = Root else locRoot = 1 endif if (present(UseFirstRank)) then lUseFirstRank=UseFirstRank else lUseFirstRank=.true. end if gotFirstRank = .false. if (present(UseFirstRank)) then lUseFirstRank=UseFirstRank else lUseFirstRank=.true. end if allocate(filled(nNodes),nPerNode(nNodes),stat=status) _VERIFY(STATUS) do i=1,nNodes nPerNode(i) = size(MAPL_NodeRankList(locRoot+i-1)%rank) if (lUseFirstRank) then filled(i)=0 else filled(i)=MAPL_GetNewRank(locRoot+i-1,rc=status)-1 _VERIFY(status) end if enddo nlist = size(list) n=0 do do i=1,nNodes if (filled(i) < size(MAPL_NodeRankList(locRoot+i-1)%rank)) then filled(i) = filled(i) + 1 n=n+1 list(n) = MAPL_NodeRankList(locRoot+i-1)%rank(filled(i)) if (.not.gotFirstRank .and. present(FirstRank)) then gotFirstRank=.true. FirstRank = list(n) end if end if if (n == nlist) exit enddo if (n == nlist) exit if (All(filled == nPerNode)) filled = 0 enddo deallocate(filled,nPerNode) _RETURN(ESMF_SUCCESS) end subroutine MAPL_RoundRobinPEList