C FFT with multiple elements per process.
C{{{  master
      SUBROUTINE master (nchans, chan)
      IMPLICIT NONE
      INTEGER nchans, chan, i
C     C{{{  declare tags
      INTEGER tend, tint, tcpx
      PARAMETER (tend = 0)
      PARAMETER (tint = 1)
      PARAMETER (tcpx = 3)
C     C}}}
      INTEGER npts
      REAL datum(0:1)
      call INPUT(chan, npts, 1, tint)
      print *, 'data... npts = ', npts
      print *, 'transform...'
C{{{  receive data
      DO 20, i = 0, npts-1
        call INPUT(chan, datum, 2, tcpx)
        print '(F8.5,A,F8.5)', datum(0), '  ', datum(1)
20    CONTINUE
C}}}
      END
C
C{{{  worker
      SUBROUTINE worker (nchans, chan, ndims, x)
      IMPLICIT NONE
      INTEGER nchans, chan, ndims, x
C     C{{{  declare tags
      INTEGER tend, tint, tcpx
      PARAMETER (tend = 0)
      PARAMETER (tint = 1)
      PARAMETER (tcpx = 3)
C     C}}}
C{{{  set up s, seg
      INTEGER s, seg
      PARAMETER (s = 2)
      PARAMETER (seg = 2**s)
C   seg = (1 << s)
C}}}
      REAL data(0:1, 0:seg-1), transform(0:1, 0:seg-1)
      INTEGER Isize, Icoord
      INTEGER n, i, place
      INTEGER srccoord(0:seg-1), srcaddr(0:seg-1)
      INTEGER dstcoord(0:seg-1), dstaddr(0:seg-1)
C{{{  main code
C     C{{{  Tell master problem size
      n = Isize(x)
      place = Icoord(x)
      call OUTPUT (chan, n * seg, 1, tint)
      DO 55, i = 0, seg-1
        data(0, i) = place
        data(1, i) = i
        srccoord(i) = MOD(place + n - i, n)
        dstcoord(i) = MOD(place + i, n)
        dstaddr(i) = i
55    CONTINUE
      call RELD(x, seg, transform, 2, seg, data, srccoord, srcaddr,
     :          dstcoord, dstaddr)
C}}}
      print *, 'worker outputting result'
      call OU1DAR (chan, x, seg, transform, 2, seg, tcpx)
C}}}
      END
C}}}
C}}}
C
C{{{  configuration
      IMPLICIT NONE
      EXTERNAL master, worker
      INTEGER xid
      INTEGER xsize
      INTEGER chan, null
      INTEGER rank (1)
      PARAMETER (xid   = 0)
      PARAMETER (xsize = 8)
      PARAMETER (chan = 0)
      DATA rank /xid/
      CALL acbegn ()
      CALL acindx (xid, xsize)
      CALL acchan (chan, 0)
      CALL acarry (master, 1, chan, 0, null)
      CALL acarry (worker, 1, chan, 1, rank)
      CALL acdone ()
      END
C}}}
