C     Fx compiler version 2.1
CC    TEMPLATE tr(4)
CC    TEMPLATE td(10)
CC    ALIGN inpr(I,J,K,L) WITH tr(L)
CC    ALIGN det(I,J,K) WITH td(J)
CC    DISTRIBUTE tr(BLOCK_CYCLIC(4,1))
CC    DISTRIBUTE td(CYCLIC(10))
C     pi = 3.141592653589793
C     sigma0 = 1.13
C     thresh = 2.421
C     const2 = (thresh / (thresh + 399))
C     const1 = ((pi * 2) / 512)
C     doppler0(1) = 6
C     doppler0(2) = 16
C     doppler0(3) = 26
C     doppler0(4) = 36
C     range0(1) = 3
C     range0(2) = 5
C     range0(3) = 7
C     range0(4) = 9
C     CALL gen_bit_reverse_table(brt,512)
C     CALL gen_w_table(twiddles,512,9,256)
C     a0 = 255.5
C     DO k = 1, 512, 1
C     w(k) = ((cos((const1 * ((k + (-1)) - a0))) * .46) + .54)
C     ENDDO
C     CALL dgen(inpr,range0,doppler0,sigma0)
C     tclocks = 0
C     fclocks = 0
C     rclocks = 0
C     dclocks = 0
C     CALL fx_red_led_off()
C     CALL fx_green_led_off()
C     CALL fx_yellow_led_off()
C     CALL fx_taskinit(6,1,1)
C     CALL fx_gettaskid(imodid,irow,icol,ipid,iprocs)
C     CALL fx_blocksizes(isample_inpr_block,isample_inpr_stride,
C    $icompute_inpr_block,icompute_inpr_stride,icompute_det_block,
C    $icompute_det_stride,icompute_brt_block,icompute_brt_stride,
C    $icompute_twiddles_block,icompute_twiddles_stride,
C    $icompute_w_block,icompute_w_stride,icompute_const2_block,
C    $icompute_const2_stride,icompute_det2_block,icompute_det2_stride
C    $)
C     ivar = 0
C     CALL fx_starttimer()
C     IF (imodid.EQ.0) THEN
C     ivar = (ivar + 1)
C     CALL fx_newiter()
C     ifx_target = (ifxpmod((ivar + (-1)),1) + 1)
C     CALL fx_trecv(ifx_target,ipid,iprocs,inpr,imain_inpr_block,
C    $imain_inpr_stride,0,163840,163840,1,0)
C     ENDIF
C     IF (imodid.EQ.1) THEN
C     DO iter = 1, 100, 1
C     ivar = (ivar + 1)
C     CALL fx_newiter()
C     CALL fx_red_led_on()
C     CALL fx_gettimer()
C     CALL sample(inpr)
C     CALL fx_addtimer()
C     CALL fx_all_led_off()
C     IF (iter.EQ.100) THEN
C     ifx_target = ifxpmod((ivar + (-1)),1)
C     CALL fx_tsend(ifx_target,ipid,iprocs,inpr,isample_inpr_block,
C    $isample_inpr_stride,0,163840,163840,1,1)
C     ENDIF
C     ifx_target = (ifxpmod((ivar + (-1)),4) + 2)
C     CALL fx_tsend(ifx_target,ipid,iprocs,inpr,isample_inpr_block,
C    $isample_inpr_stride,0,163840,163840,1,2)
C     ENDDO
C     ENDIF
C     IF (imodid.EQ.2) THEN
C     DO iter = 1, 100, 4
C     ivar = (ivar + 1)
C     CALL fx_newiter()
C     ifx_target = (ifxpmod(((ivar * 4) + (-4)),1) + 1)
C     CALL fx_trecv(ifx_target,ipid,iprocs,inpr,icompute_inpr_block,
C    $icompute_inpr_stride,0,163840,163840,1,3)
C     CALL fx_green_led_on()
C     CALL fx_gettimer()
C     CALL compute(inpr,det,brt,twiddles,w,const2,det2)
C     CALL fx_addtimer()
C     CALL fx_all_led_off()
C     ENDDO
C     ENDIF
C     IF (imodid.EQ.3) THEN
C     DO iter = 2, 100, 4
C     ivar = (ivar + 1)
C     CALL fx_newiter()
C     ifx_target = (ifxpmod(((ivar * 4) + (-3)),1) + 1)
C     CALL fx_trecv(ifx_target,ipid,iprocs,inpr,icompute_inpr_block,
C    $icompute_inpr_stride,0,163840,163840,1,4)
C     CALL fx_green_led_on()
C     CALL fx_gettimer()
C     CALL compute(inpr,det,brt,twiddles,w,const2,det2)
C     CALL fx_addtimer()
C     CALL fx_all_led_off()
C     ENDDO
C     ENDIF
C     IF (imodid.EQ.4) THEN
C     DO iter = 3, 100, 4
C     ivar = (ivar + 1)
C     CALL fx_newiter()
C     ifx_target = (ifxpmod(((ivar * 4) + (-2)),1) + 1)
C     CALL fx_trecv(ifx_target,ipid,iprocs,inpr,icompute_inpr_block,
C    $icompute_inpr_stride,0,163840,163840,1,5)
C     CALL fx_green_led_on()
C     CALL fx_gettimer()
C     CALL compute(inpr,det,brt,twiddles,w,const2,det2)
C     CALL fx_addtimer()
C     CALL fx_all_led_off()
C     ENDDO
C     ENDIF
C     IF (imodid.EQ.5) THEN
C     DO iter = 4, 100, 4
C     ivar = (ivar + 1)
C     CALL fx_newiter()
C     ifx_target = (ifxpmod(((ivar * 4) + (-1)),1) + 1)
C     CALL fx_trecv(ifx_target,ipid,iprocs,inpr,icompute_inpr_block,
C    $icompute_inpr_stride,0,163840,163840,1,6)
C     CALL fx_green_led_on()
C     CALL fx_gettimer()
C     CALL compute(inpr,det,brt,twiddles,w,const2,det2)
C     CALL fx_addtimer()
C     CALL fx_all_led_off()
C     ENDDO
C     ENDIF
C     CALL fx_stoptimer()
C     CALL fx_analyztime()
C     IF (fxcellid.EQ.0) THEN
C     tusecs = ((tclocks / 20) / 100)
C     fusecs = ((fclocks / 20) / 100)
C     rusecs = ((rclocks / 20) / 100)
C     dusecs = ((dclocks / 20) / 100)
C     usecs = (((tusecs + fusecs) + rusecs) + dusecs)
C     tpercent = ((real(tusecs) / real(usecs)) * 100.)
C     fpercent = ((real(fusecs) / real(usecs)) * 100.)
C     rpercent = ((real(rusecs) / real(usecs)) * 100.)
C     dpercent = ((real(dusecs) / real(usecs)) * 100.)
C     WRITE (unit=6,fmt=*) '1D Distribution'
C     WRITE (unit=6,fmt=*) 4,' channels',10,' range cells'
C     WRITE (unit=6,fmt=*) 'tpose     :',tusecs,tpercent
C     WRITE (unit=6,fmt=*) 'fft/mag   :',fusecs,fpercent
C     WRITE (unit=6,fmt=*) 'reduce    :',rusecs,rpercent
C     WRITE (unit=6,fmt=*) 'detect    :',dusecs,dpercent
C     WRITE (unit=6,fmt=*) 'total(us) :',usecs
C     WRITE (unit=6,fmt=*) ''
C     WRITE (unit=6,fmt=*) det2(5,2),det2(6,2),det2(7,2),det2(8,2),
C    $det2(9,2)
C     WRITE (unit=6,fmt=*) det2(5,3),det2(6,3),det2(7,3),det2(8,3),
C    $det2(9,3)
C     WRITE (unit=6,fmt=*) det2(15,5),det2(16,5),det2(17,5),det2(18,5
C    $),det2(19,5)
C     WRITE (unit=6,fmt=*) det2(25,7),det2(26,7),det2(27,7),det2(28,7
C    $),det2(29,7)
C     WRITE (unit=6,fmt=*) det2(35,9),det2(36,9),det2(37,9),det2(38,9
C    $),det2(39,9)
C     WRITE (unit=6,fmt=*) det2(35,10),det2(36,10),det2(37,10),det2(
C    $38,10),det2(39,10)
C     ENDIF
C     END
      PROGRAM main
      EXTERNAL dgen
      INTRINSIC real
      REAL real
      INTEGER icompute_inpr_block
      INTEGER ipid
      INTEGER icol
      INTEGER icompute_det_stride
      INTEGER isample_inpr_stride
      INTEGER ivar
      INTEGER icompute_brt_stride
      INTEGER iter
      INTEGER fxcellid
      INTEGER icompute_twiddles_block
      EXTERNAL t_gather
      INTEGER irow
      INTEGER dpercent
      INTEGER fpercent
      REAL fxbuffer
      EXTERNAL fx_green_led_off
      EXTERNAL fx_tsend
      EXTERNAL fx_trecv
      INTEGER rpercent
      INTEGER tpercent
      INTEGER icompute_det2_stride
      EXTERNAL fx_gettaskid
      INTEGER imain_inpr_block
      INTEGER icompute_w_block
      EXTERNAL fx_yellow_led_on
      INTEGER k
      EXTERNAL fx_procstart
      EXTERNAL fx_stoptimer
      REAL a0
      INTEGER usecs
      INTEGER icompute_inpr_stride
      EXTERNAL fx_red_led_on
      EXTERNAL fx_deinit
      EXTERNAL t_scatter
      INTEGER icompute_twiddles_stride
      INTEGER fxdistarg
      REAL sigma0
      INTEGER icompute_const2_block
      EXTERNAL fx_yellow_led_off
      EXTERNAL fx_blocksizes
      EXTERNAL gen_bit_reverse_table
      REAL const1
      REAL const2
      EXTERNAL fx_analyztime
      INTEGER imain_inpr_stride
      REAL pi
      EXTERNAL fx_starttimer
      INTEGER icompute_w_stride
      INTEGER imodid
      EXTERNAL sample
      EXTERNAL fx_all_led_off
      EXTERNAL fx_red_led_off
      INTEGER dusecs
      INTEGER fusecs
      EXTERNAL msg_reduce
      REAL thresh
      INTEGER iprocs
      INTEGER rusecs
      INTEGER tusecs
      INTEGER ifx_target
      EXTERNAL fxinitdesc
      EXTERNAL fx_newiter
      INTEGER icompute_det_block
      INTEGER isample_inpr_block
      INTEGER icompute_brt_block
      INTEGER icompute_const2_stride
      INTRINSIC cos
      REAL cos
      INTEGER dclocks
      INTEGER fclocks
      EXTERNAL gen_w_table
      INTEGER icompute_det2_block
      INTEGER rclocks
      EXTERNAL fx_init
      INTEGER tclocks
      EXTERNAL fx_set_module_geometry
      EXTERNAL fx_addtimer
      EXTERNAL ifxpmod
      INTEGER ifxpmod
      EXTERNAL fx_green_led_on
      EXTERNAL compute
      EXTERNAL fx_gettimer
      EXTERNAL fx_taskinit
      INTEGER doppler0(4)
      REAL inpr(2,512,10,4)
      REAL twiddles(2,256)
      REAL w(512)
      INTEGER fxdetdesc(71,3)
      INTEGER range0(4)
      INTEGER fxinprdesc(71,4)
      INTEGER det(512,1,4)
      INTEGER brt(512)
      INTEGER det2(40,10)
      INTEGER fxdistarray(6,20)
      COMMON /timing/ fclocks,tclocks,rclocks,dclocks
      COMMON /fxcommon/ fxcellid,fxdistarg
      CALL fx_init(fxcellid,3,1,1,1)
      CALL fx_set_module_geometry(0,0,0,8,8)
      CALL fx_set_module_geometry(1,0,0,1,1)
      CALL fx_set_module_geometry(2,0,1,2,5)
      CALL fx_set_module_geometry(3,2,1,2,5)
      CALL fx_set_module_geometry(4,4,1,2,5)
      CALL fx_set_module_geometry(5,6,1,2,5)
      fxdistarg = 0
      fxdistarray(1,1) = 2
      fxdistarray(2,1) = 0
      fxdistarray(3,1) = 1
      fxdistarray(4,1) = 10
      fxdistarray(5,1) = 0
      fxdistarray(6,1) = 0
      fxdistarray(3,2) = 512
      fxdistarray(3,3) = 4
      CALL fxinitdesc(1,3,fxdistarray,fxdetdesc)
      fxdistarray(1,1) = 4
      fxdistarray(2,1) = 0
      fxdistarray(3,1) = 4
      fxdistarray(4,1) = 1
      fxdistarray(5,1) = 0
      fxdistarray(6,1) = 0
      fxdistarray(3,2) = 2
      fxdistarray(3,3) = 512
      fxdistarray(3,4) = 10
      CALL fxinitdesc(1,4,fxdistarray,fxinprdesc)
C     TEMPLATE tr(4)
C     TEMPLATE td(10)
C     ALIGN inpr(I,J,K,L) WITH tr(L)
C     ALIGN det(I,J,K) WITH td(J)
C     DISTRIBUTE tr(BLOCK_CYCLIC(4,1))
C     DISTRIBUTE td(CYCLIC(10))
      pi = 3.141592653589793
      sigma0 = 1.13
      thresh = 2.421
      const2 = (thresh / (thresh + 399))
      const1 = ((pi * 2) / 512)
      doppler0(1) = 6
      doppler0(2) = 16
      doppler0(3) = 26
      doppler0(4) = 36
      range0(1) = 3
      range0(2) = 5
      range0(3) = 7
      range0(4) = 9
      CALL gen_bit_reverse_table(brt,512)
      CALL gen_w_table(twiddles,512,9,256)
      a0 = 255.5
      DO k = 1, 512, 1
        w(k) = ((cos((const1 * ((k + (-1)) - a0))) * .46) + .54)
      ENDDO
      fxdistarg = 1
      CALL dgen(inpr,range0,doppler0,sigma0,fxinprdesc,(-1),(-1),(-1)
     $)
      tclocks = 0
      fclocks = 0
      rclocks = 0
      dclocks = 0
      CALL fx_red_led_off()
      CALL fx_green_led_off()
      CALL fx_yellow_led_off()
      CALL fx_taskinit(6,1,1)
      CALL fx_gettaskid(imodid,irow,icol,ipid,iprocs)
      CALL fx_blocksizes(isample_inpr_block,isample_inpr_stride,
     $icompute_inpr_block,icompute_inpr_stride,icompute_det_block,
     $icompute_det_stride,icompute_brt_block,icompute_brt_stride,
     $icompute_twiddles_block,icompute_twiddles_stride,
     $icompute_w_block,icompute_w_stride,icompute_const2_block,
     $icompute_const2_stride,icompute_det2_block,icompute_det2_stride
     $)
      ivar = 0
      CALL fx_starttimer()
      IF (imodid.EQ.0) THEN
        ivar = (ivar + 1)
        CALL fx_newiter()
        ifx_target = (ifxpmod((ivar + (-1)),1) + 1)
        CALL fx_trecv(ifx_target,ipid,iprocs,inpr,imain_inpr_block,
     $imain_inpr_stride,0,163840,163840,1,0)
      ENDIF
      IF (imodid.EQ.1) THEN
        DO iter = 1, 100, 1
          ivar = (ivar + 1)
          CALL fx_newiter()
          CALL fx_red_led_on()
          CALL fx_gettimer()
          fxdistarg = 1
          CALL sample(inpr,fxinprdesc)
          CALL fx_addtimer()
          CALL fx_all_led_off()
          IF (iter.EQ.100) THEN
            ifx_target = ifxpmod((ivar + (-1)),1)
            CALL fx_tsend(ifx_target,ipid,iprocs,inpr,
     $isample_inpr_block,isample_inpr_stride,0,163840,163840,1,1)
          ENDIF
          ifx_target = (ifxpmod((ivar + (-1)),4) + 2)
          CALL fx_tsend(ifx_target,ipid,iprocs,inpr,
     $isample_inpr_block,isample_inpr_stride,0,163840,163840,1,2)
        ENDDO
      ENDIF
      IF (imodid.EQ.2) THEN
        DO iter = 1, 100, 4
          ivar = (ivar + 1)
          CALL fx_newiter()
          ifx_target = (ifxpmod(((ivar * 4) + (-4)),1) + 1)
          CALL fx_trecv(ifx_target,ipid,iprocs,inpr,
     $icompute_inpr_block,icompute_inpr_stride,0,163840,163840,1,3)
          CALL fx_green_led_on()
          CALL fx_gettimer()
          fxdistarg = 1
          CALL compute(inpr,det,brt,twiddles,w,const2,det2,fxinprdesc
     $,fxdetdesc,(-1),(-1),(-1),(-1),(-1))
          CALL fx_addtimer()
          CALL fx_all_led_off()
        ENDDO
      ENDIF
      IF (imodid.EQ.3) THEN
        DO iter = 2, 100, 4
          ivar = (ivar + 1)
          CALL fx_newiter()
          ifx_target = (ifxpmod(((ivar * 4) + (-3)),1) + 1)
          CALL fx_trecv(ifx_target,ipid,iprocs,inpr,
     $icompute_inpr_block,icompute_inpr_stride,0,163840,163840,1,4)
          CALL fx_green_led_on()
          CALL fx_gettimer()
          fxdistarg = 1
          CALL compute(inpr,det,brt,twiddles,w,const2,det2,fxinprdesc
     $,fxdetdesc,(-1),(-1),(-1),(-1),(-1))
          CALL fx_addtimer()
          CALL fx_all_led_off()
        ENDDO
      ENDIF
      IF (imodid.EQ.4) THEN
        DO iter = 3, 100, 4
          ivar = (ivar + 1)
          CALL fx_newiter()
          ifx_target = (ifxpmod(((ivar * 4) + (-2)),1) + 1)
          CALL fx_trecv(ifx_target,ipid,iprocs,inpr,
     $icompute_inpr_block,icompute_inpr_stride,0,163840,163840,1,5)
          CALL fx_green_led_on()
          CALL fx_gettimer()
          fxdistarg = 1
          CALL compute(inpr,det,brt,twiddles,w,const2,det2,fxinprdesc
     $,fxdetdesc,(-1),(-1),(-1),(-1),(-1))
          CALL fx_addtimer()
          CALL fx_all_led_off()
        ENDDO
      ENDIF
      IF (imodid.EQ.5) THEN
        DO iter = 4, 100, 4
          ivar = (ivar + 1)
          CALL fx_newiter()
          ifx_target = (ifxpmod(((ivar * 4) + (-1)),1) + 1)
          CALL fx_trecv(ifx_target,ipid,iprocs,inpr,
     $icompute_inpr_block,icompute_inpr_stride,0,163840,163840,1,6)
          CALL fx_green_led_on()
          CALL fx_gettimer()
          fxdistarg = 1
          CALL compute(inpr,det,brt,twiddles,w,const2,det2,fxinprdesc
     $,fxdetdesc,(-1),(-1),(-1),(-1),(-1))
          CALL fx_addtimer()
          CALL fx_all_led_off()
        ENDDO
      ENDIF
      CALL fx_stoptimer()
      CALL fx_analyztime()
      IF (fxcellid.EQ.0) THEN
        tusecs = ((tclocks / 20) / 100)
        fusecs = ((fclocks / 20) / 100)
        rusecs = ((rclocks / 20) / 100)
        dusecs = ((dclocks / 20) / 100)
        usecs = (((tusecs + fusecs) + rusecs) + dusecs)
        tpercent = ((real(tusecs) / real(usecs)) * 100.)
        fpercent = ((real(fusecs) / real(usecs)) * 100.)
        rpercent = ((real(rusecs) / real(usecs)) * 100.)
        dpercent = ((real(dusecs) / real(usecs)) * 100.)
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) '1D Distribution'
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) 4,' channels',10,' range cells'
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) 'tpose     :',tusecs,tpercent
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) 'fft/mag   :',fusecs,fpercent
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) 'reduce    :',rusecs,rpercent
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) 'detect    :',dusecs,dpercent
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) 'total(us) :',usecs
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) ''
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) det2(5,2),det2(6,2),det2(7,2),det2(8,2
     $),det2(9,2)
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) det2(5,3),det2(6,3),det2(7,3),det2(8,3
     $),det2(9,3)
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) det2(15,5),det2(16,5),det2(17,5),det2(
     $18,5),det2(19,5)
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) det2(25,7),det2(26,7),det2(27,7),det2(
     $28,7),det2(29,7)
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) det2(35,9),det2(36,9),det2(37,9),det2(
     $38,9),det2(39,9)
        ENDIF
        IF (fxcellid.EQ.0) THEN
          WRITE (unit=6,fmt=*) det2(35,10),det2(36,10),det2(37,10),
     $det2(38,10),det2(39,10)
        ENDIF
      ENDIF
      CALL fx_deinit()
      END
CC    TEMPLATE tr(4)
CC    ALIGN inpr(I,J,K,L) WITH tr(L)
CC    DISTRIBUTE tr(BLOCK_CYCLIC(4,1))
CC    NOCHECK inpr
C     RETURN 
C     END
      SUBROUTINE sample(inpr,fxinprdesc)
      INTEGER fxcellid
      EXTERNAL fx_procstart
      INTEGER fxdistarg
      EXTERNAL fxdblcheck
      EXTERNAL fxinitdesc
      REAL inpr(2,512,10,4)
      INTEGER fxinprdesc(71,4)
      INTEGER fxdistarray(6,20)
      COMMON /fxcommon/ fxcellid,fxdistarg
      CALL fxdblcheck(fxdistarg,1,'sample')
      fxdistarg = 0
      fxdistarray(1,1) = 4
      fxdistarray(2,1) = 0
      fxdistarray(3,1) = 4
      fxdistarray(4,1) = 1
      fxdistarray(5,1) = 0
      fxdistarray(6,1) = 0
      fxdistarray(3,2) = 2
      fxdistarray(3,3) = 512
      fxdistarray(3,4) = 10
      CALL fxinitdesc(1,4,fxdistarray,fxinprdesc)
C     TEMPLATE tr(4)
C     ALIGN inpr(I,J,K,L) WITH tr(L)
C     DISTRIBUTE tr(BLOCK_CYCLIC(4,1))
C     NOCHECK inpr
      CALL fx_procstart()
      RETURN 
      END
CC    TEMPLATE tr(4)
CC    TEMPLATE td(10)
CC    ALIGN inpd(I,J,K,L) WITH td(K)
CC    ALIGN mag(I,J,K) WITH td(J)
CC    ALIGN det(I,J,K) WITH td(J)
CC    DISTRIBUTE td(CYCLIC(10))
CC    NOCHECK det,inpd
C     DO i = 1, 4, 1
C     PDO (j = 1:10)
C     PIN inpd(:,:,j,:)
C     POUT mag(:,j,:)
C     LOCAL
C     IF (fxcellid.LT.10) THEN
C     fxloopstart0 = (MAX((fxcellid + 1),1))
C     fxlmidx0 = ifxlm(fxmagdesc,1,fxloopstart0)
C     DO j = fxloopstart0, MIN((fxcellid + 1),10), 1
C     x(1,:) = inpd(1,:,j,i) * w
C     x(2,:) = inpd(2,:,j,i) * w
C     CALL fft(x,brt,twiddles,512,9,256)
C     y = (x / 512)
C     tmpmag = ((y(1,1:40) * y(1,1:40)) + y(2,1:40) * y(2,1:40))
C     mag(1:40,j,i) = sqrt(tmpmag)
C     fxlmidx0 = (fxlmidx0 + 1)
C     ENDDO
C     ENDIF
C     ENDLOCAL
C     ENDPDO
C     magsum = (sum(mag(1:40,:,i)))
C     localthresh(i) = (const2 * magsum)
C     PDO (j = 1:10)
C     PIN mag(:,j,:)
C     POUT det(:,j,:)
C     LOCAL
C     IF (fxcellid.LT.10) THEN
C     fxloopstart0 = (MAX((fxcellid + 1),1))
C     fxlmidx0 = ifxlm(fxdetdesc,1,fxloopstart0)
C     DO j = fxloopstart0, MIN((fxcellid + 1),10), 1
C     DO k = 1, 40, 1
C     IF (mag(k,j,i).GT.localthresh(i)) THEN
C     det(k,j,i) = 1
C     ELSE
C     det(k,j,i) = 0
C     ENDIF
C     ENDDO
C     fxlmidx0 = (fxlmidx0 + 1)
C     ENDDO
C     ENDIF
C     ENDLOCAL
C     ENDPDO
C     ENDDO
C     det2 = det(1:40,:,1)
C     RETURN 
C     END
      SUBROUTINE compute(inpd,det,brt,twiddles,w,const2,det2,
     $fxinpddesc,fxdetdesc,fxbrtdesc,fxtwiddlesdesc,fxwdesc,
     $fxconst2desc,fxdet2desc)
      INTEGER fxindex1
      INTEGER fxindex2
      INTEGER fxlmidx0
      REAL fxredux0
      INTEGER fxfirst0
      INTEGER fxfirst1
      INTEGER fxcellid
      EXTERNAL fxinnerloop1
      INTRINSIC sqrt
      REAL sqrt
      INTEGER fxloopstart0
      INTEGER fxcc0
      INTEGER fxcc1
      INTEGER fxbufdataidx
      EXTERNAL fxbcastpairs
      INTEGER i
      INTEGER j
      INTEGER k
      EXTERNAL fx_procstart
      INTEGER fxbufoff5
      INTEGER fxrslice0
      INTEGER fxstride0
      INTEGER fxlmlast0
      INTEGER fxstride1
      INTEGER fxlmlast1
      INTRINSIC float
      REAL float
      EXTERNAL ifxlm
      INTEGER ifxlm
      INTEGER fxdistarg
      REAL const2
      INTEGER fxplr0
      INTEGER fxaddr
      EXTERNAL fxdblcheck
      INTEGER fxlmfirst0
      INTEGER fxlmfirst1
      REAL magsum
      EXTERNAL msg_reduce
      EXTERNAL fxcl_inita
      EXTERNAL fxinitdesc
      INTEGER fxlast0
      INTEGER fxlast1
      EXTERNAL fft
      INTEGER fxlmstride0
      INTEGER fxlmstride1
      INTEGER dclocks
      EXTERNAL ifxceil
      INTEGER ifxceil
      INTEGER fclocks
      EXTERNAL fxdsend
      INTEGER rclocks
      INTEGER tclocks
      INTEGER fxidiotic3_0
      EXTERNAL fxdistcheck
      EXTERNAL fxallocinit
      INTEGER fxallocinit
      INTEGER fxslice0
      REAL inpd(2,512,1,4)
      INTEGER fxconst2desc(71,1)
      INTEGER fxbuffer(1)
      REAL twiddles(2,256)
      REAL w(512)
      REAL x(2,512)
      REAL y(2,512)
      INTEGER fxmagdesc(71,3)
      INTEGER fxdetdesc(71,3)
      COMPLEX fxcbuffer(1)
      DOUBLE PRECISION fxdbuffer(1)
      LOGICAL fxlbuffer(1)
      INTEGER fxbrtdesc(71,1)
      REAL fxrbuffer(1)
      INTEGER fxdet2desc(71,2)
      REAL tmpmag(40)
      DOUBLE COMPLEX fxdcbuffer(1)
      INTEGER fxinpddesc(71,4)
      INTEGER fxtwiddlesdesc(71,2)
      REAL mag(512,1,4)
      INTEGER det(512,1,4)
      INTEGER brt(512)
      INTEGER fxwdesc(71,1)
      INTEGER det2(40,10)
      REAL localthresh(4)
      INTEGER fxdistarray(6,20)
      EQUIVALENCE (fxbuffer,fxrbuffer)
      EQUIVALENCE (fxbuffer,fxlbuffer)
      EQUIVALENCE (fxbuffer,fxdbuffer)
      EQUIVALENCE (fxbuffer,fxcbuffer)
      EQUIVALENCE (fxbuffer,fxdcbuffer)
      COMMON /timing/ fclocks,tclocks,rclocks,dclocks
      COMMON /fxcommon/ fxcellid,fxdistarg
      CALL fxdblcheck(fxdistarg,1,'compute')
      fxdistarg = 0
      CALL fxdistcheck(fxdet2desc,0,7,'compute')
      CALL fxdistcheck(fxconst2desc,0,6,'compute')
      CALL fxdistcheck(fxwdesc,0,5,'compute')
      CALL fxdistcheck(fxtwiddlesdesc,0,4,'compute')
      CALL fxdistcheck(fxbrtdesc,0,3,'compute')
      fxbufoff5 = fxallocinit(fxbuffer,320)
      fxdistarray(1,1) = 2
      fxdistarray(2,1) = 0
      fxdistarray(3,1) = 1
      fxdistarray(4,1) = 10
      fxdistarray(5,1) = 0
      fxdistarray(6,1) = 0
      fxdistarray(3,2) = 512
      fxdistarray(3,3) = 4
      CALL fxinitdesc(1,3,fxdistarray,fxdetdesc)
      fxdistarray(1,1) = 2
      fxdistarray(2,1) = 0
      fxdistarray(3,1) = 1
      fxdistarray(4,1) = 10
      fxdistarray(5,1) = 0
      fxdistarray(6,1) = 0
      fxdistarray(3,2) = 512
      fxdistarray(3,3) = 4
      CALL fxinitdesc(1,3,fxdistarray,fxmagdesc)
      fxdistarray(1,1) = 3
      fxdistarray(2,1) = 0
      fxdistarray(3,1) = 1
      fxdistarray(4,1) = 10
      fxdistarray(5,1) = 0
      fxdistarray(6,1) = 0
      fxdistarray(3,2) = 2
      fxdistarray(3,3) = 512
      fxdistarray(3,4) = 4
      CALL fxinitdesc(1,4,fxdistarray,fxinpddesc)
C     TEMPLATE tr(4)
C     TEMPLATE td(10)
C     ALIGN inpd(I,J,K,L) WITH td(K)
C     ALIGN mag(I,J,K) WITH td(J)
C     ALIGN det(I,J,K) WITH td(J)
C     DISTRIBUTE td(CYCLIC(10))
C     NOCHECK det,inpd
      CALL fx_procstart()
      DO i = 1, 4, 1
C     PDO (j = 1:10)
C     PIN inpd(:,:,j,:)
C     POUT mag(:,j,:)
C     LOCAL
        IF (fxcellid.LT.10) THEN
          fxloopstart0 = (MAX((fxcellid + 1),1))
          fxlmidx0 = ifxlm(fxmagdesc,1,fxloopstart0)
          DO j = fxloopstart0, MIN((fxcellid + 1),10), 1
            DO fxindex1 = 1, 512, 1
              x(1,fxindex1) = (inpd(1,fxindex1,fxlmidx0,i) * w(
     $fxindex1))
            ENDDO
            DO fxindex1 = 1, 512, 1
              x(2,fxindex1) = (inpd(2,fxindex1,fxlmidx0,i) * w(
     $fxindex1))
            ENDDO
            CALL fft(x,brt,twiddles,512,9,256)
            DO fxindex1 = 1, 2, 1
              DO fxindex2 = 1, 512, 1
                y(fxindex1,fxindex2) = (x(fxindex1,fxindex2) / 512)
              ENDDO
            ENDDO
            DO fxindex1 = 1, 40, 1
              tmpmag(fxindex1) = ((y(1,fxindex1) * y(1,fxindex1)) + (
     $y(2,fxindex1) * y(2,fxindex1)))
            ENDDO
            DO fxindex1 = 1, 40, 1
              mag(fxindex1,fxlmidx0,i) = sqrt(tmpmag(fxindex1))
            ENDDO
            fxlmidx0 = (fxlmidx0 + 1)
          ENDDO
        ENDIF
C     ENDLOCAL
C     ENDPDO
        fxredux0 = 0
        CALL fxcl_inita(0,1,1,fxlast0,fxlmlast0,fxcc0,1,fxmagdesc((
     $fxcellid + 8),1),40,1,512,fxfirst0,fxlmfirst0)
        CALL fxcl_inita(0,1,1,fxlast1,fxlmlast1,fxcc1,1,fxmagdesc((
     $fxcellid + 8),2),10,1,1,fxfirst1,fxlmfirst1)
        DO fxindex1 = fxlmfirst0, fxlmlast0, 1
          DO fxindex2 = fxlmfirst1, fxlmlast1, 1
            fxredux0 = (fxredux0 + mag(fxindex1,fxindex2,i))
          ENDDO
        ENDDO
        CALL msg_reduce(fxredux0,fxcellid,64)
        magsum = fxredux0
        localthresh(i) = (const2 * magsum)
C     PDO (j = 1:10)
C     PIN mag(:,j,:)
C     POUT det(:,j,:)
C     LOCAL
        IF (fxcellid.LT.10) THEN
          fxloopstart0 = (MAX((fxcellid + 1),1))
          fxlmidx0 = ifxlm(fxdetdesc,1,fxloopstart0)
          DO j = fxloopstart0, MIN((fxcellid + 1),10), 1
            DO k = 1, 40, 1
              IF (mag(k,fxlmidx0,i).GT.localthresh(i)) THEN
                det(k,fxlmidx0,i) = 1
              ELSE
                det(k,fxlmidx0,i) = 0
              ENDIF
            ENDDO
            fxlmidx0 = (fxlmidx0 + 1)
          ENDDO
        ENDIF
C     ENDLOCAL
C     ENDPDO
      ENDDO
      fxbufdataidx = 1
      fxplr0 = 0
      fxrslice0 = fxplr0
      DO fxslice0 = 1, 40, 1
        CALL fxinnerloop1(fxbufdataidx,fxbuffer((fxbufoff5 + 
     $fxbufdataidx)),det2((fxrslice0 + 1),((MAX((fxdetdesc((fxcellid
     $ + 8),2) + (-1)),0)) + 1)),det(fxslice0,1,1),1,160,2048,1)
        fxrslice0 = (fxrslice0 + 1)
      ENDDO
      CALL fxbcastpairs(fxbuffer((fxbufoff5 + 1)),(fxbufdataidx + 
     $(-1)),1,320)
      RETURN 
      END
CC    TEMPLATE tr(4)
CC    ALIGN inpr(I,J,K,L) WITH tr(L)
CC    DISTRIBUTE tr(BLOCK_CYCLIC(4,1))
CC    NOCHECK inpr
C     pi = 3.141592653589793
C     arg1 = ((pi * 2.) / 512)
C     PDO (i = 1:4)
C     POUT inpr(:,:,:,i)
C     LOCAL
C     IF (fxcellid.LT.1) THEN
C     fxloopstart0 = (MAX(((fxcellid * 4) + 1),1))
C     DO i = fxloopstart0, MIN(((fxcellid * 4) + 4),4), 1
C     DO j = 1, 10, 1
C     DO k = 1, 512, 1
C     inpr(1,k,j,i) = gauss1(0.,sigma0)
C     inpr(2,k,j,i) = gauss1(0.,sigma0)
C     ENDDO
C     ENDDO
C     ENDDO
C     ENDIF
C     ENDLOCAL
C     ENDPDO
C     DO m = 1, 4, 1
C     range = range0(m)
C     doppler = doppler0(m)
C     PDO (i = 1:4)
C     PIN inpr(:,:,:,i)
C     POUT inpr(:,:,:,i)
C     LOCAL
C     IF (fxcellid.LT.1) THEN
C     fxloopstart0 = (MAX(((fxcellid * 4) + 1),1))
C     DO i = fxloopstart0, MIN(((fxcellid * 4) + 4),4), 1
C     DO k = 1, 512, 1
C     arg2 = ((arg1 * (k + (-1))) * doppler)
C     inpr(1,k,range,i) = (inpr(1,k,range,i) + cos(arg2))
C     inpr(2,k,range,i) = (inpr(2,k,range,i) + sin(arg2))
C     ENDDO
C     ENDDO
C     ENDIF
C     ENDLOCAL
C     ENDPDO
C     ENDDO
C     END
      SUBROUTINE dgen(inpr,range0,doppler0,sigma0,fxinprdesc,
     $fxrange0desc,fxdoppler0desc,fxsigma0desc)
      INTEGER fxcellid
      INTEGER fxloopstart0
      INTEGER i
      INTEGER j
      INTEGER k
      EXTERNAL fx_procstart
      INTEGER m
      INTEGER range
      INTRINSIC float
      REAL float
      EXTERNAL ifxlm
      INTEGER ifxlm
      INTEGER fxdistarg
      REAL sigma0
      EXTERNAL gauss1
      REAL gauss1
      REAL pi
      EXTERNAL fxdblcheck
      EXTERNAL msg_reduce
      EXTERNAL fxinitdesc
      INTRINSIC cos
      REAL cos
      INTRINSIC sin
      REAL sin
      EXTERNAL ifxceil
      INTEGER ifxceil
      INTEGER doppler
      REAL arg1
      REAL arg2
      EXTERNAL fxdistcheck
      INTEGER doppler0(4)
      INTEGER fxrange0desc(71,1)
      INTEGER fxsigma0desc(71,1)
      REAL inpr(2,512,10,4)
      INTEGER range0(4)
      INTEGER fxdoppler0desc(71,1)
      INTEGER fxinprdesc(71,4)
      INTEGER fxdistarray(6,20)
      COMMON /fxcommon/ fxcellid,fxdistarg
      CALL fxdblcheck(fxdistarg,1,'dgen')
      fxdistarg = 0
      CALL fxdistcheck(fxsigma0desc,0,4,'dgen')
      CALL fxdistcheck(fxdoppler0desc,0,3,'dgen')
      CALL fxdistcheck(fxrange0desc,0,2,'dgen')
      fxdistarray(1,1) = 4
      fxdistarray(2,1) = 0
      fxdistarray(3,1) = 4
      fxdistarray(4,1) = 1
      fxdistarray(5,1) = 0
      fxdistarray(6,1) = 0
      fxdistarray(3,2) = 2
      fxdistarray(3,3) = 512
      fxdistarray(3,4) = 10
      CALL fxinitdesc(1,4,fxdistarray,fxinprdesc)
C     TEMPLATE tr(4)
C     ALIGN inpr(I,J,K,L) WITH tr(L)
C     DISTRIBUTE tr(BLOCK_CYCLIC(4,1))
C     NOCHECK inpr
      pi = 3.141592653589793
      arg1 = ((pi * 2.) / 512)
C     PDO (i = 1:4)
C     POUT inpr(:,:,:,i)
C     LOCAL
      IF (fxcellid.LT.1) THEN
        fxloopstart0 = (MAX(((fxcellid * 4) + 1),1))
        DO i = fxloopstart0, MIN(((fxcellid * 4) + 4),4), 1
          DO j = 1, 10, 1
            DO k = 1, 512, 1
              inpr(1,k,j,i) = gauss1(0.,sigma0)
              inpr(2,k,j,i) = gauss1(0.,sigma0)
            ENDDO
          ENDDO
        ENDDO
      ENDIF
C     ENDLOCAL
C     ENDPDO
      DO m = 1, 4, 1
        range = range0(m)
        doppler = doppler0(m)
C     PDO (i = 1:4)
C     PIN inpr(:,:,:,i)
C     POUT inpr(:,:,:,i)
C     LOCAL
        IF (fxcellid.LT.1) THEN
          fxloopstart0 = (MAX(((fxcellid * 4) + 1),1))
          DO i = fxloopstart0, MIN(((fxcellid * 4) + 4),4), 1
            DO k = 1, 512, 1
              arg2 = ((arg1 * (k + (-1))) * doppler)
              inpr(1,k,range,i) = (inpr(1,k,range,i) + cos(arg2))
              inpr(2,k,range,i) = (inpr(2,k,range,i) + sin(arg2))
            ENDDO
          ENDDO
        ENDIF
C     ENDLOCAL
C     ENDPDO
      ENDDO
      END
C     x = 0.
C     DO i = 1, 12, 1
C     x = (x + real(random1()))
C     ENDDO
C     gauss1 = (mean + (sigma * (x + (-6.))))
C     END
      REAL FUNCTION gauss1(mean,sigma)
      REAL mean
      INTRINSIC real
      REAL real
      INTEGER fxcellid
      INTEGER i
      EXTERNAL fx_procstart
      REAL x
      REAL sigma
      INTEGER fxdistarg
      EXTERNAL fxdblcheck
      EXTERNAL msg_reduce
      EXTERNAL random1
      REAL random1
      COMMON /fxcommon/ fxcellid,fxdistarg
      CALL fxdblcheck(fxdistarg,0,'gauss1')
      x = 0.
      DO i = 1, 12, 1
        x = (x + real(random1()))
      ENDDO
      gauss1 = (mean + (sigma * (x + (-6.))))
      END
C     m = 100000000
C     m1 = 10000
C     b = 31415821
C     a1 = (a / m1)
C     a0 = mod(a,m1)
C     b1 = (b / m1)
C     b0 = mod(b,m1)
C     a0 = ((mod(((a0 * b1) + (a1 * b0)),m1) * m1) + (a0 * b0))
C     a = mod((a0 + 1),m)
C     random1 = (real(a) / m)
C     END
      REAL FUNCTION random1()
      INTRINSIC real
      REAL real
      INTEGER fxcellid
      INTEGER a
      SAVE a
      INTEGER b
      EXTERNAL fx_procstart
      INTEGER m
      INTEGER a0
      INTEGER a1
      INTEGER b0
      INTEGER b1
      INTEGER m1
      INTEGER fxdistarg
      EXTERNAL fxdblcheck
      EXTERNAL msg_reduce
      INTRINSIC mod
      INTEGER mod
      COMMON /fxcommon/ fxcellid,fxdistarg
      DATA a / 11111111 /
      CALL fxdblcheck(fxdistarg,0,'random1')
      m = 100000000
      m1 = 10000
      b = 31415821
      a1 = (a / m1)
      a0 = mod(a,m1)
      b1 = (b / m1)
      b0 = mod(b,m1)
      a0 = ((mod(((a0 * b1) + (a1 * b0)),m1) * m1) + (a0 * b0))
      a = mod((a0 + 1),m)
      random1 = (real(a) / m)
      END
C     nv2 = (n / 2)
C     j = 1
C     brt(1) = j
C     DO i = 2, n, 1
C     k = nv2
C6    CONTINUE
C     IF (k.LT.j) THEN
C     j = (j - k)
C     k = (k / 2)
C     GOTO 6 
C     ENDIF
C     j = (j + k)
C     brt(i) = j
C     ENDDO
C     RETURN 
C     END
      SUBROUTINE gen_bit_reverse_table(brt,n)
      INTEGER fxcellid
      INTEGER i
      INTEGER j
      INTEGER k
      EXTERNAL fx_procstart
      INTEGER n
      INTEGER fxdistarg
      EXTERNAL fxdblcheck
      EXTERNAL msg_reduce
      INTEGER nv2
      INTEGER brt(n)
      COMMON /fxcommon/ fxcellid,fxdistarg
      CALL fxdblcheck(fxdistarg,0,'gen_bit_reverse_table')
      nv2 = (n / 2)
      j = 1
      brt(1) = j
      DO i = 2, n, 1
        k = nv2
6       CONTINUE
        IF (k.LT.j) THEN
          j = (j - k)
          k = (k / 2)
          GOTO 6 
        ENDIF
        j = (j + k)
        brt(i) = j
      ENDDO
      RETURN 
      END
C     pi = 3.141592653589793
C     wr = cos((pi / ndv2))
C     wi = ( -sin((pi / ndv2)))
C     w(1,1) = 1.
C     w(2,1) = 0.
C     ptr = 1.
C     pti = 0.
C     DO i = 2, ndv2, 1
C     w(1,i) = ((ptr * wr) - (pti * wi))
C     w(2,i) = ((ptr * wi) + (pti * wr))
C     ptr = w(1,i)
C     pti = w(2,i)
C     ENDDO
C     RETURN 
C     END
      SUBROUTINE gen_w_table(w,n,m,ndv2)
      INTEGER fxcellid
      INTEGER i
      EXTERNAL fx_procstart
      INTEGER fxdistarg
      REAL pi
      REAL wi
      REAL wr
      EXTERNAL fxdblcheck
      EXTERNAL msg_reduce
      INTRINSIC cos
      REAL cos
      INTRINSIC sin
      REAL sin
      REAL pti
      REAL ptr
      INTEGER ndv2
      REAL w(2,ndv2)
      COMMON /fxcommon/ fxcellid,fxdistarg
      CALL fxdblcheck(fxdistarg,0,'gen_w_table')
      pi = 3.141592653589793
      wr = cos((pi / ndv2))
      wi = ( -sin((pi / ndv2)))
      w(1,1) = 1.
      w(2,1) = 0.
      ptr = 1.
      pti = 0.
      DO i = 2, ndv2, 1
        w(1,i) = ((ptr * wr) - (pti * wi))
        w(2,i) = ((ptr * wi) + (pti * wr))
        ptr = w(1,i)
        pti = w(2,i)
      ENDDO
      RETURN 
      END
CC    NOCHECK 
C     DO i = 1, n, 1
C     j = brt(i)
C     IF (i.LT.j) THEN
C     tr = a(1,j)
C     ti = a(2,j)
C     a(1,j) = a(1,i)
C     a(2,j) = a(2,i)
C     a(1,i) = tr
C     a(2,i) = ti
C     ENDIF
C     ENDDO
C     ijdiff = 1
C     stride = 2
C     spowerofw = ndv2
C     DO stage = 1, m, 1
C     first = 1
C     DO powerofw = 1, ndv2, spowerofw
C     pwr = w(1,powerofw)
C     pwi = w(2,powerofw)
C     DO i = first, n, stride
C     j = (i + ijdiff)
C     jr = a(1,j)
C     ji = a(2,j)
C     ir = a(1,i)
C     ii = a(2,i)
C     tr = ((jr * pwr) - (ji * pwi))
C     ti = ((jr * pwi) + (ji * pwr))
C     a(1,j) = (ir - tr)
C     a(2,j) = (ii - ti)
C     a(1,i) = (ir + tr)
C     a(2,i) = (ii + ti)
C     ENDDO
C     first = (first + 1)
C     ENDDO
C     ijdiff = stride
C     stride = (stride * 2)
C     spowerofw = (spowerofw / 2)
C     ENDDO
C     RETURN 
C     END
      SUBROUTINE fft(a,brt,w,n,m,ndv2)
      INTEGER fxcellid
      INTEGER powerofw
      INTEGER i
      INTEGER j
      EXTERNAL fx_procstart
      INTEGER m
      INTEGER n
      INTEGER stage
      INTEGER first
      INTEGER fxdistarg
      INTEGER spowerofw
      REAL ii
      REAL ji
      INTEGER ijdiff
      REAL ir
      REAL ti
      REAL jr
      REAL tr
      INTEGER stride
      EXTERNAL msg_reduce
      REAL pwi
      REAL pwr
      INTEGER ndv2
      REAL a(2,n)
      REAL w(2,ndv2)
      INTEGER brt(n)
      COMMON /fxcommon/ fxcellid,fxdistarg
C     NOCHECK 
      DO i = 1, n, 1
        j = brt(i)
        IF (i.LT.j) THEN
          tr = a(1,j)
          ti = a(2,j)
          a(1,j) = a(1,i)
          a(2,j) = a(2,i)
          a(1,i) = tr
          a(2,i) = ti
        ENDIF
      ENDDO
      ijdiff = 1
      stride = 2
      spowerofw = ndv2
      DO stage = 1, m, 1
        first = 1
        DO powerofw = 1, ndv2, spowerofw
          pwr = w(1,powerofw)
          pwi = w(2,powerofw)
          DO i = first, n, stride
            j = (i + ijdiff)
            jr = a(1,j)
            ji = a(2,j)
            ir = a(1,i)
            ii = a(2,i)
            tr = ((jr * pwr) - (ji * pwi))
            ti = ((jr * pwi) + (ji * pwr))
            a(1,j) = (ir - tr)
            a(2,j) = (ii - ti)
            a(1,i) = (ir + tr)
            a(2,i) = (ii + ti)
          ENDDO
          first = (first + 1)
        ENDDO
        ijdiff = stride
        stride = (stride * 2)
        spowerofw = (spowerofw / 2)
      ENDDO
      RETURN 
      END
C     iarg1 = 163840
C     iarg2 = 163840
C     iarg3 = 4096
C     iarg4 = 40960
C     iarg5 = 2048
C     iarg6 = 20480
C     iarg7 = 2048
C     iarg8 = 2048
C     iarg9 = 2048
C     iarg10 = 2048
C     iarg11 = 2048
C     iarg12 = 2048
C     iarg13 = 4
C     iarg14 = 4
C     iarg15 = 1600
C     iarg16 = 1600
C     END
      SUBROUTINE fx_blocksizes(iarg1,iarg2,iarg3,iarg4,iarg5,iarg6,
     $iarg7,iarg8,iarg9,iarg10,iarg11,iarg12,iarg13,iarg14,iarg15,
     $iarg16)
      INTEGER fxcellid
      INTEGER iarg1
      INTEGER iarg2
      INTEGER iarg3
      INTEGER iarg4
      INTEGER iarg5
      INTEGER iarg6
      INTEGER iarg7
      INTEGER iarg8
      INTEGER iarg9
      EXTERNAL fx_procstart
      INTEGER iarg10
      INTEGER iarg11
      INTEGER iarg12
      INTEGER iarg13
      INTEGER iarg14
      INTEGER iarg15
      INTEGER iarg16
      INTEGER fxdistarg
      EXTERNAL msg_reduce
      COMMON /fxcommon/ fxcellid,fxdistarg
      iarg1 = 163840
      iarg2 = 163840
      iarg3 = 4096
      iarg4 = 40960
      iarg5 = 2048
      iarg6 = 20480
      iarg7 = 2048
      iarg8 = 2048
      iarg9 = 2048
      iarg10 = 2048
      iarg11 = 2048
      iarg12 = 2048
      iarg13 = 4
      iarg14 = 4
      iarg15 = 1600
      iarg16 = 1600
      END
