! Shows BITS NeXtOpt problem with X-Midas pipes and NeXtMidas plots (threads)
! reading them using Portland Group Fortran (pgf77 v6.0.5) on multi-processor/core
! systems. Original problem found under X-Midas 4.2.3 on RHEL 3u4.
!
! @bug 1790
! @author Bryan Wang / Neon Ngo
! @version $Id: test_xmpipes_nxm_multithread.txt,v 1.2 2009/03/10 18:41:46 ntn Exp $
!
startmacro
!startmacro/nmq=8k/ps=16k
  result nelem   1e19  ! number of elements
  result xferlen 1k    ! transfer length

  nm/on/bg/id=999      ! startup NeXtMidas JVM
  xpipe/np=32/nw=128/setup/controls on
    waveform;nxm/rt/tl=xferlen _xmpipe1 SL nelem*1e1 SIN 10000 1000 ,,, 1e-5
    waveform;nxm/rt/tl=xferlen _xmpipe2 SL nelem*1e2 SIN 10000 1000 ,,, 1e-5
    waveform;nxm/rt/tl=xferlen _xmpipe3 SL nelem*1e3 SIN 10000 1000 ,,, 1e-5
    waveform;nxm/rt/tl=xferlen _xmpipe4 SL nelem*1e4 SIN 10000 1000 ,,, 1e-5
    waveform;nxm/rt/tl=xferlen _xmpipe5 SL nelem*1e5 SIN 10000 1000 ,,, 1e-5
    waveform;nxm/rt/tl=xferlen _xmpipe6 SL nelem*1e6 SIN 10000 1000 ,,, 1e-5
!    waveform;nxm/rt/tl=xferlen _xmpipe7 SL nelem*1e7 SIN 10000 1000 ,,, 1e-5
!    waveform;nxm/rt/tl=xferlen _xmpipe8 SL nelem*1e8 SIN 10000 1000 ,,, 1e-5
!    waveform;nxm/rt/tl=xferlen _xmpipe9 SL nelem*1e9 SIN 10000 1000 ,,, 1e-5
!    xrtplot/xs=2 _xmpipe1
    nm/xs=2 plot xmpipe:_xmpipe1 /wpos=(10,20,200,200)
    nm/xs=3 plot xmpipe:_xmpipe2 /wpos=(220,20,200,200)
    nm/xs=4 plot xmpipe:_xmpipe3 /wpos=(430,20,200,200)
    nm/xs=5 plot xmpipe:_xmpipe4 /wpos=(640,20,200,200)
    nm/xs=5 plot xmpipe:_xmpipe5 /wpos=(850,20,200,200)
    nm/xs=6 plot xmpipe:_xmpipe6 /wpos=(1060,20,200,200)
!    nm/xs=7 plot xmpipe:_xmpipe7 /wpos=(10,250,200,200)
!    nm/xs=8 plot xmpipe:_xmpipe8 /wpos=(220,250,200,200)
!    nm/xs=9 plot xmpipe:_xmpipe9 /wpos=(440,250,200,200)

    ! for debugging X-Midas pipes
!   xpmonitor/xs=10/ncols=9          ! pipe monitor in BOT option tree
!   xpipemonitor;xmpy/xs=10/ncols=9  ! if have xmpy in path
!   xpipemonitor/xs=10/ncols=9       ! for X-Midas 4.6.0+
  xpipe off
  nm/off               ! end NeXtMidas JVM
endmacro
