        program gaussian
        parameter (nproc0=4)
        parameter (N = 100)
        parameter (NN = 101)
        integer indx(N), iTmp(1)
       
        real a(N,NN)
        real row(NN)
        real fac(N),temp(N)
        real maxNum
        real x(N), T

C$      decomposition d(100)
C$      distribute d(block)
C$      align a(i,:) with d(i)
C$      align temp(i) with d(i)
C$      align fac(i) with d(i)     
        call input(a,N,NN)
        indx = -1
        call start_timer()
        do k = 1, N
           temp = a(:,k)
           iTmp = MAXLOC(temp, MASK=indx.EQ. -1) 
           indxRow = iTmp(1)
           maxNum = a(indxRow,k) 
           indx(indxRow) = k
           fac = a(:,k) / maxNum
          
           row(1:NN) = a(indxRow, :) + 0.0
           forall(i=1:N, j=k:NN, indx(i).EQ.-1)
     &       a(i,j) = a(i,j) - fac(i) * row(j)

        end do
        call stop_timer()
C       back substition
        do j = N, 1, -1
        T=0.0
        do k=j+1, N
          T = T + a(j,k)*x(k)
        end do
        x(j) = (a(j,NN)-T)/a(j,j)
        end do
        do i=1, N
        call ksingl(6)
        write(6,1) i, x(i)
1       format(1x, 'x',i2, '=', f10.3)
        call kflush(6)
        end do
        stop
        end








