TABLE OF CONTENTS


RPN_COMM/RPN_COMM_limit [ Functions ]

[ Top ] [ Functions ]

SYNOPSIS

      integer function RPN_COMM_limit(my_id, npe, gmin, gmax, lmini,&
     &     lmaxi,count, offset)

ARGUMENTS

      integer, intent(IN) ::  my_id, npe, gmin, gmax       
      integer, intent(OUT) :: lmini,lmaxi                  
      integer, intent(OUT) :: count(npe),offset(npe)       

Notes

     old function, calls newer RPN_COMM_limit_2 forcing STRICT decomposition mode
     kept for compatibility with older versions of this library

RPN_COMM/RPN_COMM_limit_2 [ Functions ]

[ Top ] [ Functions ]

SYNOPSIS

      integer function RPN_COMM_limit_2(my_id, npe, gmin, gmax, &
     &     lmini,lmaxi,count, offset,relax)

ARGUMENTS

!  IN   my_id   "tile" ordinal along decomposition axis (0 -> npe-1)
!  IN   npe    number of "tiles" (PEs) along this dimension
!  IN   gmin,gmax
!              global index space along this dimension is gmin:gmax (usually 1:n)
!  OUT  lmini,lmaxi
!              this "tile" will cover index range lmini:lmaxi in global space
!  OUT  count(1:npe)
!              count(i) = number of points along this dimension for PE with ordinal I-1
!  OUT  offset(1:npe)
!              offset(i) = offset from gmin for PE with ordinal I-1
!  IN   relax  decomposition mode
!          0 : strict mode, all tiles but last one must have same dimension, 
!              last tile may be shorter but may not have zero dimension
!          1 : some tiles at end may be 1 shorter than tiles at beginning, 
!              zero size not allowed for these shorter tiles
!          2 : same as relax=1 but zero dimension tiles at end are allowed 
!              (useful only if more PEs than points)
!          3 : tiles with same length possibly followed by ONE shorter tile 
!              possibly followed by ONE or MORE zero size tiles

AUTHOR

  M.Valin Recherche en Prevision Numerique 2015

Notes

     this function is totally stand alone and could eventually be moved into the rmnlib library
     mode 2 only makes sense when one has more PEs than points

RPN_COMM/Use Example [ Functions ]

[ Top ] [ Functions ]

EXAMPLE

      implicit none
      integer, intent(IN) :: NPE
!      integer, parameter :: NPE=6
      integer, dimension(NPE) :: count, offset
      integer :: my_id, gmin, gmax, lmini, lmaxi, status
      integer :: RPN_COMM_limit_2
      external :: RPN_COMM_limit_2

      gmin = 1
      gmax = 13
      print 101,'NPE, gmin, gmax :',NPE,gmin,gmax
      print 101,'relax =',0
      status = RPN_COMM_limit_2(0, npe, gmin, gmax,lmini,lmaxi,count, offset,0)
      print 102, '      ','   ID',' mini',' maxi',' gmin',' gmax',' stat'
      print 101, 'pe_me=',0, lmini,lmaxi, gmin, gmax, status
      print 101, 'count=',count
      print 101, 'offst=',offset
      print *, '---------------------------'
      print 101,'NPE, gmin, gmax :',NPE,gmin,gmax
      print 101,'relax =',1
      status = RPN_COMM_limit_2(0, npe, gmin, gmax,lmini,lmaxi,count, offset,1)
      print 102, '      ','   ID',' mini',' maxi',' gmin',' gmax',' stat'
      print 101, 'pe_me=',0, lmini,lmaxi, gmin, gmax, status
      print 101, 'count=',count
      print 101, 'offst=',offset
      print *, '---------------------------'
      print 101,'NPE, gmin, gmax :',NPE,gmin,gmax
      print 101,'relax =',2
      status = RPN_COMM_limit_2(0, npe, gmin, gmax,lmini,lmaxi,count, offset,2)
      print 102, '      ','   ID',' mini',' maxi',' gmin',' gmax',' stat'
      print 101, 'pe_me=',0, lmini,lmaxi, gmin, gmax, status
      print 101, 'count=',count
      print 101, 'offst=',offset
      print *, '---------------------------'
      gmin = 1
      gmax = 13
      print 101,'NPE, gmin, gmax :',NPE,gmin,gmax
      print 101,'relax =',3
      do my_id=0,NPE-1
        status = RPN_COMM_limit_2(my_id, npe, gmin, gmax,lmini,lmaxi,count, offset,3)
        print 102, '      ','   ID',' mini',' maxi',' gmin',' gmax',' stat'
        print 101, 'pe_me=',my_id, lmini,lmaxi, gmin, gmax, status
        print 101, 'count=',count
        print 101, 'offst=',offset
        print *,''
      enddo