      PROGRAM LUNODE
      implicit none 
      
      include 'defn.h'

*
*     ** NODE PROGRAM FOR BLOCK LU FACTORIZATION **
*     Runs on the iPSC/860 at Rice University
*
*  -- NPAC, Syracuse University --
*     Manish Parashar
*     April 1992
*

      real work(WSIZE), a(ASIZE)
      integer ipiv(MAX_LDA)
      integer lda, n, m, nb
      integer nprocs, me, host
      integer msg(4), info
      integer HostMsgType, TimeMsgType
      integer iarch, iord, idir
      character*20 filename
      double precision clock0, starttime, stoptime, mflops


      data HostMsgType /2100/
      data TimeMsgType /2200/

      call open0 ( nprocs, me, host )
      call setarc0 (nprocs,iarch,iord,idir)

 21   continue
      call setarc0 (nprocs,iarch,iord,idir)
	
c     call tracenode(150000,0,1)
c     call tracelevel(6,6,0)

      call bcast0 (msg,16,HostMsgType,host)
      n = msg(1)
      m = msg(2)
      lda = msg(3)
      nb = msg(4)
      call rcvdat(n,m,lda,nb,a)
c     print *,me,n,m,lda,nb

*     ** BEGIN MAIN ITERATION LOOP FOR LU FACTORIZATION **

      call sync0()

      starttime = clock0()

      call hgetrf(n,m,lda,nb,a,work,ipiv,info)

      stoptime = clock0() - starttime

c     print *,me,stoptime

c     call snddat(m,n,nb,lda,ipiv,a,work)

c     call send0(stoptime,8,TimeMsgType+me,host)

      call sync0()
      if (me .eq. 0) call send0(me,4,HostMsgType,host)
c     call traceexit()
c     call traceflush()

      goto 21
      call close0(1)

      END
