      program main
      implicit none

      include 'defn.h'

*
*     Main program to test kji-SAXPY and measure its performance
*     -- NPAC, Syracuse University --
*     Modifed Manish Parashar
*     April 1992
*
*      Programmer A. Gaber Mohamed, Ph.D., Jan. 7, 1991
*      NPAC, Syracuse University
*

      external UserInput
      integer Userinput

      double precision a(ASIZE)
      double precision b(MAX_LDA)
      integer ipiv(MAX_LDA)
      integer lda, n, m, nb, info
      integer j
      real dtime, starttime, stoptime
      real max_time, mflops
      real times(2)

      integer npanels(9)
      integer nprob(10)
c     integer ia, ib

      data nprob /50,100,250,500,1000,1500,2000,2500,3000,3500/
      data npanels /1,8,12,16,32,64,128,256,512/

 100    j = UserInput(lda,nb)
        if (j .le. 0) goto 200

c       do ia = 1,8
c         do ib = 1,9

c           lda = nprob(ia)
c           nb = npanels(ib)
            m = lda
            n = lda
c           print *,m,n,lda,nb

            call matgen(a,lda,n,b)

            if(nb .lt. lda) then
	         starttime =  dtime(times)
	         call kji_block(m,n,a,lda,ipiv,info,nb)
	         stoptime = dtime(times)
                 call chk(m,n,lda,a,ipiv,b,info)
            else
                 print *,'Error: Block Size > LDA'
                 goto 100
            endif
            max_time = stoptime
            mflops = ((2./3.)*LDA*LDA*LDA)/(1.0e6*max_time)
            print *,'Result:',lda,nb,max_time,mflops

c         enddo
c       enddo

        goto 100

 200    end
