[J3] [EXTERNAL] Questions about DO CONCURRENT and locality

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Mon Jul 6 08:13:39 EDT 2020

Does one actually have to resort to DEFAULT(…) to sidestep the concern?   Or is it sufficient to put the “problematic” variables into appropriate LOCAL/SHARED locality specs?       I.e, if most of the loop is all-but trivial, but one array is used with indices in a hard-to-predict manner, but that array is explicitly listed in SHARED(), does that give the compiler enough information to parallelize while the locality of other variables is left implicit?

On Jul 3, 2020, at 9:54 PM, Daniel C Chen via J3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>> wrote:

I think the question of "CAN all DO CONCURRENT loops be parallelized" should be a
question for the vendors, not the standard committee as it is an implementation detail.
The standard does (should) not specify how a feature is implemented.
The processor can choose to implement it in parallel whenever it is possible or
sequentially as long as the result is the same (as Bob said).

DEFAULT(NONE) will force users to specify
the locality of all variables that appear in a DO CONCURRENT construct. The
processor should be able to parallelize the loops accordingly. That being said,
it would be users responsibility to specify the correct locality. For example,
not marking a variable that is defined in two different iterations SHARED.


XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com<mailto:cdchen at ca.ibm.com>

<graycol.gif>"Ondřej Čertík via J3" ---2020-07-03 09:03:33 PM---Robert, On Fri, Jul 3, 2020, at 6:23 PM, Robert Corbett via J3 wrote:

From:  "Ondřej Čertík via J3" <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
To:  "J3 Mailinglist" <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Cc:  "Ondřej Čertík" <ondrej at certik.us<mailto:ondrej at certik.us>>
Date:  2020-07-03 09:03 PM
Subject:  [EXTERNAL] Re: [J3] Questions about DO CONCURRENT and locality
Sent by:  "J3" <j3-bounces at mailman.j3-fortran.org<mailto:j3-bounces at mailman.j3-fortran.org>>



On Fri, Jul 3, 2020, at 6:23 PM, Robert Corbett via J3 wrote:
> I am not sure of the question here.
> If the question is "can all DO
> CONCURRENT loops be
> parallelized?", the answer is
> clearly "no". The Fortran 2008
> and 2018 standards specify that
> the iterations of a DO
> CONCURRENT loop can be
> executed in any order. They do
> not specify that the
> executions of the iterations of
> a DO CONCURRENT loop can
> be intermingled. Each iteration
> is executed to completion
> before the next iteration begins.

Thanks a lot for this excellent clarification.

Not being a native speaker, my understanding of the word concurrent is either "occurring at the same time" or "parallel", as I just looked up here:


But according to the current interpretation of the standard, "do concurrent" doesn't specify concurrent execution. Is my understanding correct?

I would be in favor to change the standard to ensure "do concurrent" specifies concurrent execution. As expected by a lot of people as well as the meaning of the word.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20200706/c119da2e/attachment.htm>

More information about the J3 mailing list