Topic: SF Do Concurrent Statement?

Hi Jeff,

It appears from my simple program (below) that SF Do Concurrent statement does not accept LOCAL(variables).
It would be better if the variable "R" was locally specified (Local(R)) within the Do Concurrent loop.
It's possible that the code is in error, but if I'm correct it would be a nice to add Local()  to the SF compiler.
Btw, the variable "I" stays local by default even though it's not defined as local.

Frank

Routine and Results:
!--- Example DO_CONCURRENT
!--- The following shows a DO CONCURRENT construct with a mask-expr
!--- and no locality specified for variables:
PROGRAM DO_CONCURRENT
    IMPLICIT NONE
    INTEGER, PARAMETER :: N = 3
    REAL,DIMENSION(N) :: A, B
    REAL              :: C, R
    INTEGER :: I

    A = [4.0,5.0,6.0]
    B = [1.0,2.0,3.0]
    C = 15.0
    R = -1.0
    I = -1

    PRINT *, 'ORIGINAL VALUES:'
    PRINT *, 'A=', A
    PRINT *, 'B=', B
    PRINT *, 'C=', C
    PRINT *, 'R=', R
    PRINT *, 'I=', I
    PRINT *

    WRITE(*,'(1X,A)') 'RUN DO CONCURRENT LOOP:'
    WRITE(*,'(1X,5(A,5X))') 'I', 'A', 'B', 'MOD(A,B)', 'R'

    DO CONCURRENT (I = 1:N, A(I) > 0.0) ! LOCAL(R)
        R =  MODULO (A(I), B(I))

        A(I) = A(I) - R

        C = -15.0

        WRITE(*,'(1X,I1,1X,4(F6.2,2X))')  I, A(I), B(I), A(I)-FLOOR(A(I)/B(I))*B(I), R
    END DO

    PRINT *
    PRINT *, 'DO CONCURRENT FINAL VALUES:'
    PRINT *, 'I=', I, ' (DOES NOT GET REDEFINED!)'
    PRINT *, ' R=',  R, ' (GETS REDEFINED!)'
    PRINT *, 'A=', A
    PRINT *, 'B=', B
    PRINT *, 'C=', C, ' (GETS REDEFINED!)'
END PROGRAM DO_CONCURRENT

ORIGINAL VALUES:
A=   4.00000000       5.00000000       6.00000000
B=   1.00000000       2.00000000       3.00000000
C=   15.0000000
R=  -1.00000000
I=          -1

RUN DO CONCURRENT LOOP:
I     A     B     MOD(A,B)     R
1   4.00    1.00    0.00    0.00
2   4.00    2.00    0.00    1.00
3   6.00    3.00    0.00    0.00

DO CONCURRENT FINAL VALUES:
I=          -1  (DOES NOT GET REDEFINED!)
  R=   0.00000000      (GETS REDEFINED!)
A=   4.00000000       4.00000000       6.00000000
B=   1.00000000       2.00000000       3.00000000
C=  -15.0000000      (GETS REDEFINED!)

Re: SF Do Concurrent Statement?

The locality specifiers from Fortran 2018 (I believe?) aren't supported at all in GNU Fortran 14, which is what we're currently shipping.  GNU Fortran 15 does support locality specifiers, and I'm working on updating to that compiler.

Unfortunately, GNU Fortran 15 also changed the coarray API, so the update is taking a long while.

Jeff Armstrong
Approximatrix, LLC