[Bug fortran/82471] do concurrent is much slower the ordinary do!

chinoune.mehdi at hotmail dot com gcc-bugzilla@gcc.gnu.org
Sun Oct 8 09:25:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82471

--- Comment #2 from Chinoune <chinoune.mehdi at hotmail dot com> ---
(In reply to Thomas Koenig from comment #1)
> There is a subtle problem with your test case, it is the
> ordering of the variables in the DO concurrent statement.
> 
> 
>   DO CONCURRENT( K=1:N, J=1:M, I=1:L)
>      C(I,J,K) = A(I,J,K) + B(I,J,K)
>   END DO
> 
> This is probably not what you meant to write; this
> will fail (with the variable bounds you gave above in
> 
>   ALLOCATE( A(L,M,N), B(L,M,N), C(L,M,N) )
> 
> if any of L, M or N has a different value.

Why will it fail ?!. Could you please explain.

> 
> If you write
> 
>   DO CONCURRENT( I=1:L, K=1:N, J=1:M)
> 
> things are much faster.

I know that
DO CONCURRENT( I=1:L, J=1:M, K=1:N)
is the fastest
but I expected that do-concurrent work like ordinary-do by varying the last
index in nested loops.
And since the do-concurrent can run in any order I expected that the compiler
will choose the best order. but it turns that do-concurrent is not portable at
all. Intel Fortran Compiler works as I expected.
So which order should I use!


More information about the Gcc-bugs mailing list