        PROGRAM SOR3D_float
        PARAMETER (L=384, ITMAX=100)
        REAL EPS, MAXEPS, A(L, L, L), W, S
        DOUBLE PRECISION STARTT, ENDT, dvtime
!DVM$   DISTRIBUTE(BLOCK, BLOCK, BLOCK) :: A

        MAXEPS = 0.5
        W = 0.5
!DVM$   REGION
!DVM$   PARALLEL(K, J, I) ON A(I, J, K), CUDA_BLOCK(32, 8)
!        nest of two parallel loops, iteration (i, j) will be executed on
!        processor, which is owner of element A(i, j)
        DO K = 1, L
          DO J = 1, L
            DO I = 1, L
              IF (I.EQ.1 .OR. J.EQ.1 .OR. K.EQ.1
     >.OR. I.EQ.L .OR. J.EQ.L .OR. K.EQ.L) THEN
                A(I, J, K) = 0.
              ELSE
                A(I, J, K) = (1. + I + J + K)
              ENDIF
            ENDDO
          ENDDO
        ENDDO
!DVM$   END REGION
!DVM$   BARRIER
        STARTT = dvtime()
        DO IT = 1, ITMAX
          EPS = 0.
!DVM$     ACTUAL(EPS)
!DVM$     REGION

!DVM$ PARALLEL (K, J, I) ON A(I, J, K), ACROSS(A(1:1,1:1,1:1)),
!DVM$& REDUCTION(MAX(EPS)), PRIVATE(S)
          DO K = 2, L - 1
            DO J = 2, L - 1
              DO I = 2, L - 1
                S = A(I, J, K)
                A(I, J, K) = (W / 6. ) * (A(I, J, K-1) + A(I, J-1, K) + 
     >                                   A(I-1, J, K) + A(I+1, J, K) + 
     >                                   A(I, J+1, K) + A(I, J, K+1))+
     >                        + (1 - W) * A(I, J, K)
                EPS = MAX(EPS, ABS(S - A(I, J, K)))
              ENDDO
            ENDDO
          ENDDO
!DVM$     END REGION
!DVM$     GET_ACTUAL(EPS)
          PRINT 200, IT, EPS
200       FORMAT (' IT = ', I4, '   EPS = ', E14.7)
          IF (EPS .LT. MAXEPS) EXIT
        ENDDO
!DVM$   BARRIER
        ENDT = dvtime()

        PRINT *, 'SOR3D_float Benchmark Completed.'
        PRINT 201, L, L, L
201     FORMAT (' Size            = ', I4, ' x ', I4, ' x ', I4)
        PRINT 202, ITMAX
202     FORMAT (' Iterations      =       ', I12)
        PRINT 203, ENDT - STARTT
203     FORMAT (' Time in seconds =       ', F12.2)
        PRINT *, 'Operation type  =     floating point'
        IF (ABS(EPS - 5.134155) .LT. 1.0E-4) THEN
          PRINT *, 'Verification    =         SUCCESSFUL'
        ELSE
          PRINT *, 'Verification    =       UNSUCCESSFUL'
        ENDIF

        PRINT *, 'END OF SOR3D_float Benchmark'
        END
