From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Mon Sep 25 01:55:37 2023
Return-Path: <owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom9
Delivered-To: sc22wg5-dom9@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 9F2F53569FB; Mon, 25 Sep 2023 01:55:37 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
Received: from nag-j.co.jp (bvdeuz19.secure.ne.jp [180.222.80.19])
	by www.open-std.org (Postfix) with SMTP id 2D4CD3569C7
	for <sc22wg5@open-std.org>; Mon, 25 Sep 2023 01:55:31 +0200 (CEST)
Received: (qmail 9816 invoked from network); 25 Sep 2023 08:55:28 +0900
Received: from unknown (HELO Maru10) (218.42.159.105)
  by 0 with SMTP; 25 Sep 2023 08:55:28 +0900
From: "Malcolm Cohen" <malcolm@nag-j.co.jp>
To: "'WG5'" <sc22wg5@open-std.org>
References: <DM6PR12MB31302BD1D034319D5CD42B7ACBF1A@DM6PR12MB3130.namprd12.prod.outlook.com> <20230912161937.ED0F6356986@www.open-std.org> <493F5A4F-8746-4CA4-ACF7-554B71168255@nasa.gov> <20230912184902.A227F35699F@www.open-std.org> <20230914051137.8F0F93569EF@www.open-std.org> <20230914132511.A9155356742@www.open-std.org> <20230919074924.5A64A356969@www.open-std.org> <20230919085702.1ECCF3569C0@www.open-std.org> <73963378-8AB0-447B-8BA0-EC90F07B0FEF@nasa.gov> <DM6PR12MB3130F647EF16E1D055CCD673CBFAA@DM6PR12MB3130.namprd12.prod.outlook.com> <20230920085704.D845D3569F4@www.open-std.org> <20230920093749.0462C3569FD@www.open-std.org> <DM6PR12MB3130828786A39BD24BA2D206CBF9A@DM6PR12MB3130.namprd12.prod.outlook.com>
In-Reply-To: <DM6PR12MB3130828786A39BD24BA2D206CBF9A@DM6PR12MB3130.namprd12.prod.outlook.com>
Subject: RE: Do Concurrent with unspecified locality, calling pure procedures
Date: Mon, 25 Sep 2023 08:55:28 +0900
Message-ID: <047201d9ef42$986b5030$c941f090$@nag-j.co.jp>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0473_01D9EF8E.085A2420"
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQG/qXZQcGIQLpZ1F3Ca3tHLE/EEbAFGgQaEAuD8HXAB7pdlIQFRoAeAAhuw4kIC1WjZxwJ3QBx3AbrjyQ0B8n/94QMXn0msAfWBGYgClWAmvK+OLJRA
Content-Language: ja
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

This is a multipart message in MIME format.

------=_NextPart_000_0473_01D9EF8E.085A2420
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi Jeff,

 

Nitpick: Code is invalid. You want to make "B" INTENT(INOUT), otherwise the
whole of B becomes undefined (at the call), and thus the whole of B is
undefined on exit from the loop, which is probably not what you intend.

 

After that fix, serial execution works fine.

 

> I cannot see any way for the compiler to implement what we require there,
which is that elements of T be localized

 

We do not require that, because that is NOT one of the possible effects of
unspecified locality - the standard never requires that unspecified locality
behave as LOCAL or LOCAL_INIT. All elements that are written by multiple
iterations become *undefined*. It is invalid to refer to the value of an
undefined variable, whereas LOCAL/LOCAL_INIT leave the variable with its
previous definition status and value.

 

Now, a compiler auto-parallelising DO CONCURRENT may well implement some
cases of unspecified locality by creating temps, just as if the variable
were LOCAL. But the user program has no valid way to tell whether that
happened, because the variable is undefined. 

 

> I cannot see any way for the compiler to implement

 

Implementation by serial execution still works fine.

 

> I'd just like to add the commonsense thing that we all agree on, which is
that unspecified locality is a terrible idea,

 

Such a note is not appropriate for the standard.

 

> it seems catastrophic

 

Lack of parallel execution (but possible retention of other optimisations)
is not what I would call catastrophic. Catastrophic would be "runs
noticeably slower than normal DO", or "inevitably gives the wrong answer".
Here it will be approximately the same as normal DO (and may be faster if
one of the other optimisations kicks in), just no auto-parallelisation.

 

> in the case of procedure calls

 

Well, if you're going to pass whole arrays around when you only want to
read/write one or two elements, sure. That falls into "hiding information
from the compiler", which is never a good idea when you are hoping for some
kind of auto-parallelism. Or other optimisations for that matter. 

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: Jeff Hammond <jehammond@nvidia.com> 
Sent: Wednesday, September 20, 2023 7:29 PM
To: General J3 interest list <j3@mailman.j3-fortran.org>
Cc: WG5 <sc22wg5@open-std.org>; Malcolm Cohen <malcolm@nag-j.co.jp>
Subject: Do Concurrent with unspecified locality, calling pure procedures

 

Can we add something about the fact that unspecified locality is nigh
impossible when the code that is executed during the iteration is invisible
to the compiler due to a procedure call?

 

If I take the Peter example and put the loop body in a pure procedure, I
cannot see any way for the compiler to implement what we require there,
which is that elements of T be localized whenever K=L (or the entire array
is localized).


The alternative seems to be that procedure calls with arrays will disable
parallelism unless the compile does whole-program analysis, possibly at
link-time, to figure out what is defined or undefined by the procedure.

 

I don't expect us to solve this.  I'd just like to add the commonsense thing
that we all agree on, which is that unspecified locality is a terrible idea,
and that it seems catastrophic in the case of procedure calls.

 

module w

interface

pure subroutine bar(J,K,L,T,A,B)

  implicit none

  integer, intent(in) :: J, K, L

  real, intent(in) :: A(:)

  real, intent(out) :: B(:)

  real, intent(inout) :: T(:)

  ! the implementation, found elsewhere, does this:

  ! T(K) = A(J)

  ! B(J) = T(L)

end subroutine bar

end interface

end module w

 

subroutine foo(N, A, B, T, K, L)

  use w

  implicit none

  integer, intent(in) :: N, K(N), L(N)

  real, intent(in) :: A(N)

  real, intent(out) :: B(N)

  real, intent(inout) :: T(N)

  do concurrent (integer :: J=1:N)

    call bar(J,K(J),L(J),T,A,B)

  end do

end subroutine foo

 

From: J3 <j3-bounces@mailman.j3-fortran.org
<mailto:j3-bounces@mailman.j3-fortran.org> > on behalf of Jeff Hammond via
J3 <j3@mailman.j3-fortran.org <mailto:j3@mailman.j3-fortran.org> >
Date: Wednesday, 20. September 2023 at 12.37
To: General J3 interest list <j3@mailman.j3-fortran.org
<mailto:j3@mailman.j3-fortran.org> >
Cc: Jeff Hammond <jehammond@nvidia.com <mailto:jehammond@nvidia.com> >, WG5
<sc22wg5@open-std.org <mailto:sc22wg5@open-std.org> >, Malcolm Cohen
<malcolm@nag-j.co.jp <mailto:malcolm@nag-j.co.jp> >
Subject: [J3] [SC22WG5.6491] RE: [EXTERNAL] [BULK] Subobject of a variable


External email: Use caution opening links or attachments 

 

Thanks, I have been slowly coming around to a similar conclusion, which is
that Do Concurrent means "in any order" plus "user hints that
auto-parallelization is desirable", which is to say, Do Concurrent may only
be mapped to "!$omp parallel do" conditionally, after the compiler has
proven that the loop is legal to auto-parallelize. 

 

In this interpretation, Concurrent is still quite powerful, because it gives
the user a way to strongly encourage auto-parallelization, when compilers
may not otherwise do so aggressively because auto-parallelization all Do
loops that are legal to do so with threads is likely to hurt performance,
because thread overhead is nontrivial.  This should lead to high-quality
implementations of auto-parallelization (as I know Damian and friends want)
and sequential behavior only in pathological cases that most people aren't
writing. 

 

It may interest some to know that yesterday during the OpenMP meeting, we
decided to settle the problem of "!$omp loop" on Do Concurrent by adding a
restriction that users must specify the locality of variables that will be
written to in more than one iteration.  This means that, in the context of
OpenMP, Peter's problematic example becomes erroneous unless the programmer
adds shared() appropriately, as you and Damian both suggest is the
resolution to this.

 

Anyways, our implementation likely requires very little change to reflect
this, since Do Concurrent can be implemented with OpenACC "kernels", which
causes the compiler to do auto-parallelization, based on what it can prove
is possible.  I imagine that Intel will have to do more work, to disable
parallelism when it's not legal.

 

Jeff

 

 

On 20. Sep 2023, at 11.56, Malcolm Cohen via J3 <j3@mailman.j3-fortran.org
<mailto:j3@mailman.j3-fortran.org> > wrote:

 


External email: Use caution opening links or attachments

 

Hi Jeff,

 

The other side of a variable being "undefined" is "having a specific value".

 

No-one would expect that having a specific value propagates to subobjects
(the rank or type would be different).

 

> It is hard for me to understand how I can apply the locality inference
rules when the inferred locality propagates, but the rules used for that
inference don't.

 

Rules don't "propagate". Rules are rules.

 

I do not see anything odd about "If I define the whole of array X in an
iteration, no other iteration can define the whole of array X" and "If I
define an element of the array X in an iteration, no other iteration can
define that element of X".

 

Perhaps it might help to think that DO CONCURRENT is not in fact a variation
of OpenMP !$OMP DO. That is not how it came about. DO CONCURRENT is two
things:

1.	A reworking of FORALL to remove the plethora of array temps that
FORALL often mandates.
2.	A standardised form of the directive "!DEC$IVDEP" (I probably have
that spelled wrong - the manuals are in the office.) This directive declares
that the loop iterations are independent, and that enables various useful
loop optimisations, like software pipelining and so on.

 

Now, in the "simple" cases (and there are a lot of simple cases), it can be
easy to parallelise a DO CONCURRENT as originally designed (F2008), viz with
everything "unspecified locality", but although parallelisability was a
strong consideration, it was not the driving force behind the original
design.

 

The drawbacks of unspecified locality re parallelisation are what lead to
the introduction of specified locality in F2018.

 

Seriously, users wanting good performance should not be using unspecified
locality, except perhaps in the simplest of loops. Actually, with my
Software Engineering hat on, I'd say users should not be using unspecified
locality ever, they should tell the compiler *and subsequent
readers/maintainers of the code* what they want explicitly.

 

And for the compiler, if it cannot work out what the locality of some
variable is, it should just execute the loop serially (in any order). That
will always give the correct answer, because loop iterations are independent
(well, the user claimed they were, anyway), and do not depend of what the
locality actually is. (If a "parallelise DO CONCURRENT" option is active, it
might be a good idea to produce a warning when this happens.)

 

Anecdote: When I explained DO CONCURRENT to some OpenMP programmers, they
were aghast. "Do not ever execute it in parallel!" was their response, with
the explanation "If we want a loop executed in parallel we will use !$OMP
PARALLEL DO, if the compiler might create threads on any other loop, that
would be excessive threads and would slow down the overall execution due to
thread contention for resources."

 

Cheers,

--

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: J3 <j3-bounces@mailman.j3-fortran.org
<mailto:j3-bounces@mailman.j3-fortran.org> > On Behalf Of Jeff Hammond via
J3
Sent: Tuesday, September 19, 2023 10:59 PM
To: Clune, Thomas L. (GSFC-6101) <thomas.l.clune@nasa.gov
<mailto:thomas.l.clune@nasa.gov> >; General J3 interest list
<j3@mailman.j3-fortran.org <mailto:j3@mailman.j3-fortran.org> >
Cc: Jeff Hammond <jehammond@nvidia.com <mailto:jehammond@nvidia.com> >; WG5
<sc22wg5@open-std.org <mailto:sc22wg5@open-std.org> >; Malcolm Cohen
<malcolm@nag-j.co.jp <mailto:malcolm@nag-j.co.jp> >
Subject: [J3] [SC22WG5.6488] [EXTERNAL] [BULK] Subobject of a variable

 

Okay, but we are saying that, in the context of do concurrent, locality
obviously propagates to subobjects, but (un)definedness obviously doesn't.

 

This bothers me because we use (un)definedness to infer the locality of
variables with unspecified locality.  It is hard for me to understand how I
can apply the locality inference rules when the inferred locality
propagates, but the rules used for that inference don't.

 

Jeff

 

From: Clune, Thomas L. (GSFC-6101) < <mailto:thomas.l.clune@nasa.gov>
thomas.l.clune@nasa.gov>
Date: Tuesday, 19. September 2023 at 16.17
To: General J3 interest list < <mailto:j3@mailman.j3-fortran.org>
j3@mailman.j3-fortran.org>
Cc: Jeff Hammond < <mailto:jehammond@nvidia.com> jehammond@nvidia.com>, WG5
< <mailto:sc22wg5@open-std.org> sc22wg5@open-std.org>, Malcolm Cohen <
<mailto:malcolm@nag-j.co.jp> malcolm@nag-j.co.jp>
Subject: Re: [EXTERNAL] [BULK] [J3] [SC22WG5.6486] Subobject of a variable


External email: Use caution opening links or attachments

 

I do not find this situation odd.    Lots of things don't propagate to
subobjects.      E.g., if an array is allocatable, it's elements are not.
If an array is pointer, it's elements are not.

 

And "undefinedness" is very much a property of subobjects.   Indeed, a
variable is only defined if all of its subobjects are defined.  (I hope I
have that right.)

 

*	Tom

 

From: J3 < <mailto:j3-bounces@mailman.j3-fortran.org>
j3-bounces@mailman.j3-fortran.org> on behalf of j3 <
<mailto:j3@mailman.j3-fortran.org> j3@mailman.j3-fortran.org>
Reply-To: j3 < <mailto:j3@mailman.j3-fortran.org> j3@mailman.j3-fortran.org>
Date: Tuesday, September 19, 2023 at 4:57 AM
To: j3 < <mailto:j3@mailman.j3-fortran.org> j3@mailman.j3-fortran.org>
Cc: Jeff Hammond < <mailto:jehammond@nvidia.com> jehammond@nvidia.com>, WG5
< <mailto:sc22wg5@open-std.org> sc22wg5@open-std.org>, Malcolm Cohen <
<mailto:malcolm@nag-j.co.jp> malcolm@nag-j.co.jp>
Subject: [EXTERNAL] [BULK] [J3] [SC22WG5.6486] Subobject of a variable

 


CAUTION: This email originated from outside of NASA.  Please take care when
clicking links or opening attachments.  Use the "Report Message" button to
report suspicious messages to the NASA SOC.





If a variable has unspecified locality,

- if it is referenced in an iteration it shall either be previously defined
during that iteration, or shall not be defined or become undefined during
any other iteration; if it is defined or becomes undefined by more than one
iteration it becomes undefined when the loop terminates;

real, dimension(10) :: A

 

do concurrent (integer :: k=1:size(A))

  A(k) = k

  if (k.eq.1) A(10) = 0

end do

 

As best I can tell, A(1:9) are defined after the loop terminates, while
A(10) and A are not.  Does the fact that A is undefined before and becomes
undefined during this loop imply anything about the undefined-ness of its
elements during the loop or must one reason about them strictly
independently, based on the element-wise defined/undefined-ness?

 

Now suppose I make A shared.  Malcolm said all the elements of A are shared
as well "It's not written there now, because, like, how could it possibly be
anything else?"

 

real, dimension(10) :: A

 

do concurrent (integer :: k=1:size(A)) shared(A)

  A(k) = k

  if (k.eq.1) A(10) = 0

end do

 

It is odd to me that the shared-ness of A propagates to its elements but the
undefined-ness does not.  Why must I reason about the element-wise behavior
of an array independent of the array itself when worrying about whether a
variable becomes undefined or defined during a loop, but in the same
context, they are obviously not independent regarding locality?

 

Jeff

 





On 19. Sep 2023, at 10.49, Malcolm Cohen via J3 <
<mailto:j3@mailman.j3-fortran.org> j3@mailman.j3-fortran.org> wrote:

 


External email: Use caution opening links or attachments

 

Hi Brad,

 

There is no doubt that subobject includes array elements.

 

The point is that a subobject of a variable is itself a variable. So nothing
more needs to be said on that front.

 

But in the case of a subobject of a constant, that is often not constant.
E.g.

   INTEGER,PARAMETER :: x(10) = [ 1,2,3,4,5,6,7,8,9,10 ]

   READ *,I

   PRINT *,x(I) 

 

Here, X(I) is not a variable, and is also not a constant. It is a
non-constant subobject of a constant!

 

That is what those words are there for. They are not intended to imply that
subobjects of a variable are not data objects. They are simply because they
are also variables, indeed, portions that can be defined and redefined
separately, and being capable of being defined and redefined makes them
variables.

 

We could add a NOTE to say that "A subobject of a variable is a variable,
but a subobject of a constant is not necessarily itself constant, e.g. if it
has a non-constant subscript." Not sure it is really worth it though, at
least, not until we decide what to do with our overly-large set of terms.

 

Cheers,

--

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: Brad Richardson < <mailto:everythingfunctional@protonmail.com>
everythingfunctional@protonmail.com> 
Sent: Thursday, September 14, 2023 10:25 PM
To: General J3 interest list < <mailto:j3@mailman.j3-fortran.org>
j3@mailman.j3-fortran.org>; 'WG5' < <mailto:sc22wg5@open-std.org>
sc22wg5@open-std.org>
Subject: [ukfortran] [SC22WG5.6484] [J3] RE: [EXTERNAL] [BULK] are race
conditions allowed in do concurrent?

 

Hi Malcolm,

 

> >variable/data entity/data object

> >[are] circular, and doesn't seem to include individual array elements

 

> Yes it does, see 3.138 subobject.

 

While I see that it probably intends to include it, what it actually says is

 

subobject of a constant

 

so the edit would be to change it to

 

subobject of a variable or constant

 

I don't think the circularity is causing too much confusion, so I don't see
much urgency in trying to fix it, and don't quite see an easy way to do so.
I think we can leave it for now.

 

Regards,

Brad

 

On Thu, 2023-09-14 at 14:04 +0900, Malcolm Cohen via J3 wrote:

Hi Brad,

 

There is no contradiction, subtle or otherwise, here.

 

Locality-specs are only for named variables. However, as noted, subobjects
of variables are also variables.

 

> The way I've heard "definition" applied to arrays is that definition of an
element of an array does not constitute definition of the variable,

 

Correct (except in the trivial case of an array with a single element). This
is all spelled out explicitly: defining every "part" of a multi-part
variable defines the variable.

 

I can see some potential wording improvements for the next revision, but
nothing that rises to the level of a defect.

 

E.g. it may be better to mention that "if a variable has SHARED locality,
all of its subobjects have SHARED locality". It's not written there now,
because, like, how could it possibly be anything else? There is nothing else
it could be.  But making it explicit would lead naturally into writing "If a
variable with SHARED locality is defined." instead of the current "If it is
defined.".

 

>variable/data entity/data object

>[are] circular, and doesn't seem to include individual array elements

 

Yes it does, see 3.138 subobject.

 

The circularity is unfortunate, but they are all reasonably worded for
comprehensibility (not for trail-following). So it's either deleting one of
them (ugh) or rewording one to break the circle without making it hard to
understand (it's not obvious exactly what to do here, which is why it is
still like this).

 

If it were a glossary of terms, instead of a list of definitions, there
would be no problem with circularity, right?

 

Anyway, I agree it would be good to fix it as long as it doesn't make any
individual term hard to understand.

 

Given our experience this time around, I would be in favour of pruning our
terms and definitions, down to a more minimal set. If there are "useful"
terms that do not lend themselves to trivial drop-in replacement, and I
think there are, we could consider adding a "Glossary" (of "useful terms",
but probably better not to call them "terms"!).

 

Cheers,

--

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: Brad Richardson < <mailto:everythingfunctional@protonmail.com>
everythingfunctional@protonmail.com> 
Sent: Wednesday, September 13, 2023 3:49 AM
To: General J3 interest list < <mailto:j3@mailman.j3-fortran.org>
j3@mailman.j3-fortran.org>; WG5 < <mailto:sc22wg5@open-std.org>
sc22wg5@open-std.org>
Subject: [ukfortran] [SC22WG5.6480] [EXTERNAL] [BULK] [J3] are race
conditions allowed in do concurrent?

 

Hmm... I decided to work through this a bit more thoroughly.

 

From the syntax definitions:

 

R902

variable

is designator

or function-reference

 

R901

designator

is object-name

or array-element

or array-section

or coindexed-named-object

or complex-part-designator

or structure-component

or substring

 

 

Ok, so according to the syntax an array element is a variable.

 

From the terms and definitions:

 

variable

data entity (3.41) that can be defined (3.48) and redefined during execution
of a program

 

data entity

data object (3.42), result of the evaluation of an expression, or the result
of the execution of a function reference

 

data object

constant, variable, or subobject of a constant

 

which is circular, and doesn't seem to include individual array elements.

 

So now the question is which "definition" does the DO CONCURRENT constraint
refer to?

 

From the syntax definitions:

 

R1129

concurrent-locality

is

[ locality-spec ]...

 

R1130

locality-spec

is LOCAL ( variable-name-list )

or LOCAL_INIT ( variable-name-list )

or REDUCE ( reduce-operation : variable-name-list )

or SHARED ( variable-name-list )

or DEFAULT ( NONE )

 

only allows variable-name, not designator, so it's not exactly clear.

 

The "constraint" appears in normative text, I.e.

 

If a variable has

 

which is not hyperlinked and is not in a font indicating reference to the
syntax term.

 

My reading of this is that we have a subtle contradiction between the syntax
and normative terms. My guess is that the syntax meaning (i.e. an array
element is a variable) is what is intended for the rules here, and thus it's
valid to (un)define *different* elements of an array in separate iterations,
but not valid to (un)define and reference the same element of an array in
separate iterations.

 

I think it would be worth "fixing" the terms and definitions to eliminate
the circular definition and make it consistent with the syntax.

 

Regards,

Brad

 

On Tue, 2023-09-12 at 17:37 +0000, Clune, Thomas L. (GSFC-6101) wrote:

"Variable" does not mean what we think it means:     <variable>   <<is>>
<designator> <<or>> <function-reference>

 

And <designator> includes <array-element>.

 

But I for one would not mind an explanatory note that clarifies the common
use case of array elements in this context. 

 

 

 

From:J3 < <mailto:j3-bounces@mailman.j3-fortran.org>
j3-bounces@mailman.j3-fortran.org> on behalf of j3 <
<mailto:j3@mailman.j3-fortran.org> j3@mailman.j3-fortran.org>
Reply-To: j3 < <mailto:j3@mailman.j3-fortran.org> j3@mailman.j3-fortran.org>
Date: Tuesday, September 12, 2023 at 12:19 PM
To: j3 < <mailto:j3@mailman.j3-fortran.org> j3@mailman.j3-fortran.org>, WG5
< <mailto:sc22wg5@open-std.org> sc22wg5@open-std.org>
Cc: Brad Richardson < <mailto:everythingfunctional@protonmail.com>
everythingfunctional@protonmail.com>
Subject: [EXTERNAL] [BULK] [J3] [SC22WG5.6477] are race conditions allowed
in do concurrent?

 


CAUTION: This email originated from outside of NASA.  Please take care when
clicking links or opening attachments.  Use the "Report Message" button to
report suspicious messages to the NASA SOC.








Hi Jeff,

 

Based on " If it is defined or becomes undefined during any iteration, it
shall not be referenced, defined, or become undefined during any other
iteration.", the provide program is invalid, because `x` becomes defined in
more than one iteration.

 

The way I've heard "definition" applied to arrays is that definition of an
element of an array does not constitute definition of the variable, because
it is then only partially defined. I.e. an array is only defined once each
of its elements has been defined.

 

My opinion is that the above constraint simply does not adequately
describe/is still ambiguous about the case of arrays. I think an interp
would be warranted, and we should say that an element of an array should
have the same constraint as above if the variable is shared.

 

Regards,

Brad

 

On Tue, 2023-09-12 at 14:43 +0000, Jeff Hammond via J3 wrote:

Is this a legal program in Fortran with defined behavior?  If it is illegal
or the behavior is undefined, where do we say that?

 

program main

  integer :: k

  real :: x

  x = 0.0

  do concurrent (k=1:2) shared(x)

    x = real(k)

  end do

  print*,x

end program main

 

Is that what the following is intended to do?

 

"If a variable has SHARED locality, appearances of the variable within the
DO CONCURRENT construct refer to the variable in the innermost executable
construct or scoping unit that includes the DO CONCURRENT construct. If it
is defined or becomes undefined during any iteration, it shall not be
referenced, defined, or become undefined during any other iteration."

 

If so, then I am struggling to apply this to arrays.  When we say a variable
has shared locality, is the variable the array or the element?  We can only
put array names in SHARED(), but applying the text regarding "to become
defined" from the perspective of arrays appears to have interesting
consequences.

 

Thanks,


Jeff

 


------=_NextPart_000_0473_01D9EF8E.085A2420
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 15 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:Helvetica;
	panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:"Yu Gothic";
	panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:"Yu Gothic";
	panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
	{font-family:LMRoman10;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:10.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.apple-converted-space
	{mso-style-name:apple-converted-space;}
span.25
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;
	mso-ligatures:none;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:720249496;
	mso-list-template-ids:-1148025586;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level2
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:72.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:108.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:144.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level5
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:180.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:216.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:252.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level8
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:288.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l0:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:324.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l1
	{mso-list-id:840320221;
	mso-list-template-ids:1045187398;}
@list l1:level1
	{mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level2
	{mso-level-tab-stop:72.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level3
	{mso-level-tab-stop:108.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level4
	{mso-level-tab-stop:144.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level5
	{mso-level-tab-stop:180.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level6
	{mso-level-tab-stop:216.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level7
	{mso-level-tab-stop:252.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level8
	{mso-level-tab-stop:288.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level9
	{mso-level-tab-stop:324.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2
	{mso-list-id:1505893819;
	mso-list-template-ids:2061527190;}
@list l3
	{mso-list-id:2069692889;
	mso-list-template-ids:668221752;}
@list l3:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level2
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:72.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:108.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:144.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level5
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:180.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:216.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:252.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level8
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:288.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:324.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-GB link=3Dblue =
vlink=3Dpurple style=3D'word-wrap:break-word'><div =
class=3DWordSection1><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>Hi Jeff,<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Nitpick: Code is =
invalid. You want to make &#8220;B&#8221; INTENT(INOUT), otherwise the =
whole of B becomes undefined (at the call), and thus the whole of B is =
undefined on exit from the loop, which is probably not what you =
intend.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>After that fix, =
serial execution works fine.<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>&gt;</span><span =
style=3D'font-size:12.0pt'> <span lang=3DEN-US>I cannot see any way for =
the compiler to implement what we require there, which is that elements =
of T be localized</span></span><span =
style=3D'font-size:11.0pt'><o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>We do not require =
that, because that is NOT one of the possible effects of unspecified =
locality &#8211; the standard never requires that unspecified locality =
behave as LOCAL or LOCAL_INIT. All elements that are written by multiple =
iterations become *<b>undefined</b>*. It is invalid to refer to the =
value of an undefined variable, whereas LOCAL/LOCAL_INIT leave the =
variable with its previous definition status and =
value.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Now, a compiler =
auto-parallelising DO CONCURRENT may well implement some cases of =
unspecified locality by creating temps, just as if the variable were =
LOCAL. But the user program has no valid way to tell whether that =
happened, because the variable is undefined. <o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>&gt;</span><span =
style=3D'font-size:12.0pt'> <span lang=3DEN-US>I cannot see any way for =
the compiler to implement<o:p></o:p></span></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Implementation by serial execution still =
works fine.</span><span =
style=3D'font-size:11.0pt'><o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'> &gt;</span><span =
style=3D'font-size:12.0pt'> <span lang=3DEN-US>I&#8217;d just like to =
add the commonsense thing that we all agree on, which is that =
unspecified locality is a terrible idea,<o:p></o:p></span></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>Such a =
note is not appropriate for the standard.<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&gt; it =
seems catastrophic<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>Lack of =
parallel execution (but possible retention of other optimisations) is =
not what I would call catastrophic. Catastrophic would be &#8220;runs =
noticeably slower than normal DO&#8221;, or &#8220;inevitably gives the =
wrong answer&#8221;. Here it will be approximately the same as normal DO =
(and may be faster if one of the other optimisations kicks in), just no =
auto-parallelisation.<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&gt; in =
the case of procedure calls<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>Well, if =
you&#8217;re going to pass whole arrays around when you only want to =
read/write one or two elements, sure. That falls into &#8220;hiding =
information from the compiler&#8221;, which is never a good idea when =
you are hoping for some kind of auto-parallelism. Or other optimisations =
for that matter. <o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>Cheers,<o:p></o:p></span></p><div><p =
class=3DMsoNormal style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>-- </span><span =
style=3D'font-size:10.5pt'><o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>..............Malcolm Cohen, NAG =
Oxford/Tokyo.</span><span =
style=3D'font-size:10.5pt'><o:p></o:p></span></p></div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><div><div =
style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm =
0cm 0cm'><p class=3DMsoNormal><b><span =
style=3D'font-size:11.0pt'>From:</span></b><span =
style=3D'font-size:11.0pt'> Jeff Hammond &lt;jehammond@nvidia.com&gt; =
<br><b>Sent:</b> Wednesday, September 20, 2023 7:29 PM<br><b>To:</b> =
General J3 interest list &lt;j3@mailman.j3-fortran.org&gt;<br><b>Cc:</b> =
WG5 &lt;sc22wg5@open-std.org&gt;; Malcolm Cohen =
&lt;malcolm@nag-j.co.jp&gt;<br><b>Subject:</b> Do Concurrent with =
unspecified locality, calling pure =
procedures<o:p></o:p></span></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:12.0pt'>Can we add something about the =
fact that unspecified locality is nigh impossible when the code that is =
executed during the iteration is invisible to the compiler due to a =
procedure call?<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>If I =
take the Peter example and put the loop body in a pure procedure, I =
cannot see any way for the compiler to implement what we require there, =
which is that elements of T be localized whenever K=3DL (or the entire =
array is localized).<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:12.0pt'><br>The alternative seems to be =
that procedure calls with arrays will disable parallelism unless the =
compile does whole-program analysis, possibly at link-time, to figure =
out what is defined or undefined by the =
procedure.<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>I =
don&#8217;t expect us to solve this.&nbsp; I&#8217;d just like to add =
the commonsense thing that we all agree on, which is that unspecified =
locality is a terrible idea, and that it seems catastrophic in the case =
of procedure calls.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:12.0pt'>module =
w<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>interface<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:12.0pt'>pure subroutine =
bar(J,K,L,T,A,B)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; implicit none<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:12.0pt'>&nbsp; integer, =
intent(in) :: J, K, L<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; real, intent(in) :: =
A(:)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; real, intent(out) :: =
B(:)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; real, intent(inout) :: =
T(:)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; ! the implementation, found =
elsewher</span><span lang=3DEN-US =
style=3D'font-size:12.0pt'>e</span><span style=3D'font-size:12.0pt'>, =
does this:<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; ! T(K) =3D =
A(J)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; ! B(J) =3D =
T(L)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>end subroutine bar<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:12.0pt'>end =
interface<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>end module w<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:12.0pt'>subroutine foo(N, A, =
B, T, K, L)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; use w<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:12.0pt'>&nbsp; implicit =
none<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; integer, intent(in) :: N, K(N), =
L(N)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; real, intent(in) :: =
A(N)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; real, intent(out) :: =
B(N)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; real, intent(inout) :: =
T(N)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; do concurrent (integer :: =
J=3D1:N)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp; call =
bar(J,K(J),L(J),T,A,B)<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp; end do<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'font-size:12.0pt'>end subroutine =
foo<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></p><div =
id=3Dmail-editor-reference-message-container><div><div =
style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm'><p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><b><span =
style=3D'font-size:12.0pt;color:black'>From: </span></b><span =
style=3D'font-size:12.0pt;color:black'>J3 &lt;<a =
href=3D"mailto:j3-bounces@mailman.j3-fortran.org">j3-bounces@mailman.j3-f=
ortran.org</a>&gt; on behalf of Jeff Hammond via J3 &lt;<a =
href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&g=
t;<br><b>Date: </b>Wednesday, 20. September 2023 at 12.37<br><b>To: =
</b>General J3 interest list &lt;<a =
href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&g=
t;<br><b>Cc: </b>Jeff Hammond &lt;<a =
href=3D"mailto:jehammond@nvidia.com">jehammond@nvidia.com</a>&gt;, WG5 =
&lt;<a =
href=3D"mailto:sc22wg5@open-std.org">sc22wg5@open-std.org</a>&gt;, =
Malcolm Cohen &lt;<a =
href=3D"mailto:malcolm@nag-j.co.jp">malcolm@nag-j.co.jp</a>&gt;<br><b>Sub=
ject: </b>[J3] [SC22WG5.6491] RE: [EXTERNAL] [BULK] Subobject of a =
variable<o:p></o:p></span></p></div><table class=3DMsoNormalTable =
border=3D1 cellpadding=3D0 style=3D'background:#FFEB9C'><tr><td =
style=3D'padding:.75pt .75pt .75pt .75pt'><p class=3DMsoNormal><b><span =
style=3D'font-size:7.5pt;font-family:"Verdana",sans-serif;color:black'>Ex=
ternal email: Use caution opening links or attachments</span></b><span =
style=3D'font-size:7.5pt;font-family:"Verdana",sans-serif;color:black'> =
</span><span =
style=3D'font-size:11.0pt'><o:p></o:p></span></p></td></tr></table><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Thanks, I have been =
slowly coming around to a similar conclusion, which is that Do =
Concurrent means &#8220;in any order&#8221; plus &#8220;user hints that =
auto-parallelization is desirable&#8221;, which is to say, Do Concurrent =
may only be mapped to &#8220;!$omp parallel do&quot; conditionally, =
after the compiler has proven that the loop is legal to =
auto-parallelize. <o:p></o:p></span></p><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>In this =
interpretation, Concurrent is still quite powerful, because it gives the =
user a way to strongly encourage auto-parallelization, when compilers =
may not otherwise do so aggressively because auto-parallelization all Do =
loops that are legal to do so with threads is likely to hurt =
performance, because thread overhead is nontrivial. &nbsp;This should =
lead to high-quality implementations of auto-parallelization (as I know =
Damian and friends want) and sequential behavior only in pathological =
cases that most people aren&#8217;t writing. =
<o:p></o:p></span></p><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>It may interest some =
to know that yesterday during the OpenMP meeting, we decided to settle =
the problem of &#8220;!$omp loop&#8221; on Do Concurrent by adding a =
restriction that users must specify the locality of variables that will =
be written to in more than one iteration. &nbsp;This means that, in the =
context of OpenMP, Peter&#8217;s problematic example becomes erroneous =
unless the programmer adds shared() appropriately, as you and Damian =
both suggest is the resolution to =
this.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Anyways, our =
implementation likely requires very little change to reflect this, since =
Do Concurrent can be implemented with OpenACC &#8220;kernels&#8221;, =
which causes the compiler to do auto-parallelization, based on what it =
can prove is possible. &nbsp;I imagine that Intel will have to do more =
work, to disable parallelism when it&#8217;s not =
legal.<o:p></o:p></span></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>Jeff<o:p></o:p></span></p></div><div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><div><div><p =
class=3DMsoNormal style=3D'margin-bottom:12.0pt'><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><blockquote =
style=3D'margin-top:5.0pt;margin-bottom:5.0pt'><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>On 20. Sep 2023, at =
11.56, Malcolm Cohen via J3 &lt;<a =
href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&g=
t; wrote:<o:p></o:p></span></p></div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><div><table =
class=3DMsoNormalTable border=3D1 cellpadding=3D0 =
style=3D'background:#FFEB9C;caret-color: rgb(0, 0, 0);orphans: =
auto;widows: auto;-webkit-text-stroke-width: =
0px;word-spacing:0px'><tr><td style=3D'padding:.75pt .75pt .75pt =
.75pt'><p class=3DMsoNormal><b><span =
style=3D'font-size:7.5pt;font-family:"Verdana",sans-serif;color:black'>Ex=
ternal email: Use caution opening links or attachments</span></b><span =
style=3D'font-size:11.0pt;font-family:"Helvetica",sans-serif'><o:p></o:p>=
</span></p></td></tr></table><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p><div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Hi =
Jeff,</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>The other side of a =
variable being &#8220;undefined&#8221; is &#8220;having a specific =
value&#8221;.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>No-one would expect =
that having a specific value propagates to subobjects (the rank or type =
would be different).</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>&gt;</span><span =
class=3Dapple-converted-space><span =
style=3D'font-size:12.0pt'>&nbsp;</span></span><span lang=3DEN-US =
style=3D'font-size:12.0pt'>It is hard for me to understand how I can =
apply the locality inference rules when the inferred locality =
propagates, but the rules used for that inference =
don&#8217;t.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>Rules =
don&#8217;t &#8220;propagate&#8221;. Rules are =
rules.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>I do not =
see anything odd about &#8220;If I define the whole of array X in an =
iteration, no other iteration can define the whole of array X&#8221; and =
&#8220;If I define an element of the array X in an iteration, no other =
iteration can define that element of =
X&#8221;.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>Perhaps =
it might help to think that DO CONCURRENT is not in fact a variation of =
OpenMP !$OMP DO. That is not how it came about. DO CONCURRENT is two =
things:</span><o:p></o:p></p></div><ol style=3D'margin-top:0cm' =
start=3D1 type=3D1><li class=3DMsoListParagraph =
style=3D'margin-top:0cm;margin-bottom:0cm;mso-list:l1 level1 lfo3'>A =
reworking of FORALL to remove the plethora of array temps that FORALL =
often mandates.<span =
style=3D'font-size:10.0pt'><o:p></o:p></span></li><li =
class=3DMsoListParagraph =
style=3D'margin-top:0cm;margin-bottom:0cm;mso-list:l1 level1 lfo3'>A =
standardised form of the directive &#8220;!DEC$IVDEP&#8221; (I probably =
have that spelled wrong &#8211; the manuals are in the office.) This =
directive declares that the loop iterations are independent, and that =
enables various useful loop optimisations, like software pipelining and =
so on.<span =
style=3D'font-size:10.0pt'><o:p></o:p></span></li></ol><div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Now, in the =
&#8220;simple&#8221; cases (and there are a lot of simple cases), it can =
be easy to parallelise a DO CONCURRENT as originally designed (F2008), =
viz with everything &#8220;unspecified locality&#8221;, but although =
parallelisability was a strong consideration, it was not the driving =
force behind the original design.</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>The drawbacks of =
unspecified locality re parallelisation are what lead to the =
introduction of specified locality in =
F2018.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Seriously, users =
wanting good performance should not be using unspecified locality, =
except perhaps in the simplest of loops. Actually, with my Software =
Engineering hat on, I&#8217;d say users should not be using unspecified =
locality ever, they should tell the compiler *<b>and subsequent =
readers/maintainers of the code</b>* what they want =
explicitly.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>And for the compiler, =
if it cannot work out what the locality of some variable is, it should =
just execute the loop serially (in any order). That will always give the =
correct answer, because loop iterations are independent (well, the user =
claimed they were, anyway), and do not depend of what the locality =
actually is. (If a &#8220;parallelise DO CONCURRENT&#8221; option is =
active, it might be a good idea to produce a warning when this =
happens.)</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span style=3D'font-size:11.0pt'>Anecdote: When I =
explained DO CONCURRENT to some OpenMP programmers, they were aghast. =
&#8220;Do not ever execute it in parallel!&#8221; was their response, =
with the explanation &#8220;If we want a loop executed in parallel we =
will use !$OMP PARALLEL DO, if the compiler might create threads on any =
other loop, that would be excessive threads and would slow down the =
overall execution due to thread contention for =
resources.&#8221;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>Cheers,</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>--</span><o:p></o:p></p><p class=3DMsoNormal =
style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>..............Malcolm Cohen, NAG =
Oxford/Tokyo.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><div =
style=3D'border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm =
0cm 0cm;border-color:currentcolor currentcolor;border-image: =
none'><div><p class=3DMsoNormal><b><span =
style=3D'font-size:11.0pt'>From:</span></b><span =
class=3Dapple-converted-space><span =
style=3D'font-size:11.0pt'>&nbsp;</span></span><span =
style=3D'font-size:11.0pt'>J3 &lt;<a =
href=3D"mailto:j3-bounces@mailman.j3-fortran.org">j3-bounces@mailman.j3-f=
ortran.org</a>&gt;<span class=3Dapple-converted-space>&nbsp;</span><b>On =
Behalf Of<span class=3Dapple-converted-space>&nbsp;</span></b>Jeff =
Hammond via J3<br><b>Sent:</b><span =
class=3Dapple-converted-space>&nbsp;</span>Tuesday, September 19, 2023 =
10:59 PM<br><b>To:</b><span =
class=3Dapple-converted-space>&nbsp;</span>Clune, Thomas L. (GSFC-6101) =
&lt;<a =
href=3D"mailto:thomas.l.clune@nasa.gov">thomas.l.clune@nasa.gov</a>&gt;; =
General J3 interest list &lt;<a =
href=3D"mailto:j3@mailman.j3-fortran.org">j3@mailman.j3-fortran.org</a>&g=
t;<br><b>Cc:</b><span class=3Dapple-converted-space>&nbsp;</span>Jeff =
Hammond &lt;<a =
href=3D"mailto:jehammond@nvidia.com">jehammond@nvidia.com</a>&gt;; WG5 =
&lt;<a =
href=3D"mailto:sc22wg5@open-std.org">sc22wg5@open-std.org</a>&gt;; =
Malcolm Cohen &lt;<a =
href=3D"mailto:malcolm@nag-j.co.jp">malcolm@nag-j.co.jp</a>&gt;<br><b>Sub=
ject:</b><span class=3Dapple-converted-space>&nbsp;</span>[J3] =
[SC22WG5.6488] [EXTERNAL] [BULK] Subobject of a =
variable</span><o:p></o:p></p></div></div></div><div><p =
class=3DMsoNormal>&nbsp;<o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>Okay, =
but we are saying that, in the context of do concurrent, locality =
obviously propagates to subobjects, but (un)definedness obviously =
doesn&#8217;t.</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>This =
bothers me because we use (un)definedness to infer the locality of =
variables with unspecified locality.&nbsp; It is hard for me to =
understand how I can apply the locality inference rules when the =
inferred locality propagates, but the rules used for that inference =
don&#8217;t.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Jeff</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div><div =
id=3Dmail-editor-reference-message-container><div><div =
style=3D'border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm =
0cm 0cm;border-color:currentcolor currentcolor;border-image: none'><p =
class=3DMsoNormal style=3D'margin-bottom:12.0pt'><b><span lang=3DEN-US =
style=3D'font-size:12.0pt'>From:<span =
class=3Dapple-converted-space>&nbsp;</span></span></b><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Clune, Thomas L. (GSFC-6101) &lt;</span><a =
href=3D"mailto:thomas.l.clune@nasa.gov"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>thomas.l.clune@nasa.gov</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Date:<span =
class=3Dapple-converted-space>&nbsp;</span></b>Tuesday, 19. September =
2023 at 16.17<br><b>To:<span =
class=3Dapple-converted-space>&nbsp;</span></b>General J3 interest list =
&lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org"><span =
lang=3DEN-US =
style=3D'font-size:12.0pt'>j3@mailman.j3-fortran.org</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Cc:<span =
class=3Dapple-converted-space>&nbsp;</span></b>Jeff Hammond =
&lt;</span><a href=3D"mailto:jehammond@nvidia.com"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>jehammond@nvidia.com</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;, WG5 &lt;</span><a =
href=3D"mailto:sc22wg5@open-std.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>sc22wg5@open-std.org</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;, Malcolm Cohen =
&lt;</span><a href=3D"mailto:malcolm@nag-j.co.jp"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>malcolm@nag-j.co.jp</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Subject:<span =
class=3Dapple-converted-space>&nbsp;</span></b>Re: [EXTERNAL] [BULK] =
[J3] [SC22WG5.6486] Subobject of a =
variable</span><o:p></o:p></p></div><table class=3DMsoNormalTable =
border=3D1 cellpadding=3D0 style=3D'background:#FFEB9C'><tr><td =
style=3D'padding:.75pt .75pt .75pt .75pt'><div><p =
class=3DMsoNormal><b><span =
style=3D'font-size:7.5pt;font-family:"Verdana",sans-serif;color:black'>Ex=
ternal email: Use caution opening links or =
attachments</span></b><o:p></o:p></p></div></td></tr></table><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><div><p=
 class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:11.0pt'>I do =
not find this situation odd.&nbsp;&nbsp;&nbsp; Lots of things =
don&#8217;t propagate to subobjects.&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;E.g., =
if an array is allocatable, it&#8217;s elements are not.&nbsp; If an =
array is pointer, it&#8217;s elements are =
not.</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:11.0pt'>And =
&#8220;undefinedness&#8221; is very much a property of =
subobjects.&nbsp;&nbsp; Indeed, a variable is only defined if all of its =
subobjects are defined.&nbsp; (I hope I have that =
right.)</span><o:p></o:p></p></div><div><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><ul =
style=3D'margin-top:0cm' type=3Ddisc><li class=3DMsoListParagraph =
style=3D'margin-top:0cm;margin-bottom:0cm;mso-list:l0 level1 lfo6'><span =
lang=3DEN-US>Tom</span><span =
style=3D'font-size:10.0pt'><o:p></o:p></span></li></ul><div><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div =
style=3D'border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm =
0cm 0cm;border-color:currentcolor currentcolor;border-image: none'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><b><span lang=3DEN-US =
style=3D'font-size:12.0pt'>From:<span =
class=3Dapple-converted-space>&nbsp;</span></span></b><span lang=3DEN-US =
style=3D'font-size:12.0pt'>J3 &lt;</span><a =
href=3D"mailto:j3-bounces@mailman.j3-fortran.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>j3-bounces@mailman.j3-fortran.org</span></a><s=
pan lang=3DEN-US style=3D'font-size:12.0pt'>&gt; on behalf of j3 =
&lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org"><span =
lang=3DEN-US =
style=3D'font-size:12.0pt'>j3@mailman.j3-fortran.org</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Reply-To:<span =
class=3Dapple-converted-space>&nbsp;</span></b>j3 &lt;</span><a =
href=3D"mailto:j3@mailman.j3-fortran.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>j3@mailman.j3-fortran.org</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Date:<span =
class=3Dapple-converted-space>&nbsp;</span></b>Tuesday, September 19, =
2023 at 4:57 AM<br><b>To:<span =
class=3Dapple-converted-space>&nbsp;</span></b>j3 &lt;</span><a =
href=3D"mailto:j3@mailman.j3-fortran.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>j3@mailman.j3-fortran.org</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Cc:<span =
class=3Dapple-converted-space>&nbsp;</span></b>Jeff Hammond =
&lt;</span><a href=3D"mailto:jehammond@nvidia.com"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>jehammond@nvidia.com</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;, WG5 &lt;</span><a =
href=3D"mailto:sc22wg5@open-std.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>sc22wg5@open-std.org</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;, Malcolm Cohen =
&lt;</span><a href=3D"mailto:malcolm@nag-j.co.jp"><span lang=3DEN-US =
style=3D'font-size:12.0pt'>malcolm@nag-j.co.jp</span></a><span =
lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Subject:<span =
class=3Dapple-converted-space>&nbsp;</span></b>[EXTERNAL] [BULK] [J3] =
[SC22WG5.6486] Subobject of a =
variable</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><table=
 class=3DMsoNormalTable border=3D1 cellspacing=3D0 cellpadding=3D0 =
align=3Dleft width=3D"100%" style=3D'width:100.0%;border:solid black =
1.5pt'><tr><td width=3D"100%" =
style=3D'width:100.0%;border:none;background:#FFEB9C;padding:3.75pt =
3.75pt 3.75pt 3.75pt'><div><p class=3DMsoNormal =
style=3D'mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wr=
ap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizo=
ntal:column;mso-height-rule:exactly'><b><span =
style=3D'color:black'>CAUTION:</span></b><span =
class=3Dapple-converted-space><span =
style=3D'font-size:11.0pt;color:black'>&nbsp;</span></span><span =
style=3D'color:black'>This email originated from outside of NASA.&nbsp; =
Please take care when clicking links or opening attachments.&nbsp; Use =
the &quot;Report Message&quot; button to report suspicious messages to =
the NASA&nbsp;SOC.</span><o:p></o:p></p></div></td></tr></table><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;mar=
gin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:11.0pt'><br><br></span><o:p></o:p></p><div><div><div><=
div><div><p style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:10.5pt;font-family:LMRoman10'>If a variable has =
unspecified locality,</span><span =
style=3D'font-size:12.0pt;font-family:"Helvetica",sans-serif'><o:p></o:p>=
</span></p><p style=3D'margin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:10.5pt;font-family:LMRoman10'>- if it is referenced =
in an iteration it shall either be previously defined during that =
iteration, or shall not be defined or become undefined during any other =
iteration; if it is defined or becomes undefined by more than one =
iteration it becomes undefined when the loop terminates;</span><span =
style=3D'font-size:12.0pt;font-family:"Helvetica",sans-serif'><o:p></o:p>=
</span></p></div></div></div></div><blockquote =
style=3D'margin-left:30.0pt;margin-top:5.0pt;margin-right:0cm;margin-bott=
om:5.0pt'><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:11.0pt'>real, =
dimension(10) :: A</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>do concurrent (integer :: =
k=3D1:size(A))</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp; A(k) =3D =
k</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp; if (k.eq.1) A(10) =3D =
0</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>end =
do</span><o:p></o:p></p></div></div></blockquote><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>As best I can tell, A(1:9) are defined after =
the loop terminates, while A(10) and A are not. &nbsp;Does the fact that =
A is undefined before and becomes undefined during this loop imply =
anything about the undefined-ness of its elements during the loop or =
must one reason about them strictly independently, based on the =
element-wise =
defined/undefined-ness?</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Now suppose I make A shared. &nbsp;Malcolm =
said all the elements of A are shared as well &quot;It&#8217;s not =
written there now, because, like, how could it possibly be anything =
else?&#8221;</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
blockquote =
style=3D'margin-left:30.0pt;margin-top:5.0pt;margin-right:0cm;margin-bott=
om:5.0pt'><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:11.0pt'>real, =
dimension(10) :: A</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>do concurrent (integer :: k=3D1:size(A)) =
shared(A)</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp; A(k) =3D =
k</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp; if (k.eq.1) A(10) =3D =
0</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>end =
do</span><o:p></o:p></p></div></div></blockquote></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>It is odd to me that the shared-ness of A =
propagates to its elements but the undefined-ness does not. &nbsp;Why =
must I reason about the element-wise behavior of an array independent of =
the array itself when worrying about whether a variable becomes =
undefined or defined during a loop, but in the same context, they are =
obviously not independent regarding =
locality?</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Jeff</span><o:p></o:p></p></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><p =
class=3DMsoNormal =
style=3D'mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;mar=
gin-left:36.0pt'><span lang=3DEN-US =
style=3D'font-size:11.0pt'><br><br></span><o:p></o:p></p><blockquote =
style=3D'margin-top:5.0pt;margin-bottom:5.0pt'><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>On 19. Sep 2023, at 10.49, Malcolm Cohen via =
J3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org"><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>j3@mailman.j3-fortran.org</span></a><span =
lang=3DEN-US style=3D'font-size:11.0pt'>&gt; =
wrote:</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><table =
class=3DMsoNormalTable border=3D1 cellpadding=3D0 =
style=3D'margin-left:36.0pt;background:#FFEB9C;caret-color: rgb(0, 0, =
0);-webkit-text-stroke-width: 0px;word-spacing:0px'><tr><td =
style=3D'padding:.75pt .75pt .75pt .75pt'><div><p =
class=3DMsoNormal><b><span =
style=3D'font-size:7.5pt;font-family:"Verdana",sans-serif;color:black'>Ex=
ternal email: Use caution opening links or =
attachments</span></b><o:p></o:p></p></div></td></tr></table><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div><div><div><d=
iv style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Hi =
Brad,</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>There is no doubt that subobject includes =
array elements.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>The point is that a subobject of a variable =
is itself a variable. So nothing more needs to be said on that =
front.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>But in the case of a subobject of a constant, =
that is often not constant. =
E.g.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;&nbsp; INTEGER,PARAMETER :: x(10) =3D [ =
1,2,3,4,5,6,7,8,9,10 ]</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;&nbsp; READ =
*,I</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp; &nbsp;PRINT *,x(I)<span =
class=3Dapple-converted-space>&nbsp;</span></span><o:p></o:p></p></div></=
div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Here, X(I) is not a variable, and is also not =
a constant. It is a non-constant subobject of a =
constant!</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>That is what those words are there for. They =
are not intended to imply that subobjects of a variable are not data =
objects. They are simply because they are also variables, indeed, =
portions that can be defined and redefined separately, and being capable =
of being defined and redefined makes them =
variables.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>We could add a NOTE to say that &#8220;A =
subobject of a variable is a variable, but a subobject of a constant is =
not necessarily itself constant, e.g. if it has a non-constant =
subscript.&#8221; Not sure it is really worth it though, at least, not =
until we decide what to do with our overly-large set of =
terms.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Cheers,</span><o:p></o:p></p></div></div><div>=
<div style=3D'margin-left:36.0pt'><p class=3DMsoNormal =
style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>--</span><o:p></o:p></p></div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal =
style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>..............Malcolm Cohen, NAG =
Oxford/Tokyo.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'border:none;border-top:solid windowtext 1.0pt;padding:3.0pt =
0cm 0cm 0cm;border-color:currentcolor;border-image: none'><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><b><span lang=3DEN-US =
style=3D'font-size:11.0pt'>From:</span></b><span =
class=3Dapple-converted-space><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span></span><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Brad Richardson &lt;</span><a =
href=3D"mailto:everythingfunctional@protonmail.com"><span lang=3DEN-US =
style=3D'font-size:11.0pt;color:#0563C1'>everythingfunctional@protonmail.=
com</span></a><span lang=3DEN-US style=3D'font-size:11.0pt'>&gt;<span =
class=3Dapple-converted-space>&nbsp;</span><br><b>Sent:</b><span =
class=3Dapple-converted-space>&nbsp;</span>Thursday, September 14, 2023 =
10:25 PM<br><b>To:</b><span =
class=3Dapple-converted-space>&nbsp;</span>General J3 interest list =
&lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org"><span =
lang=3DEN-US =
style=3D'font-size:11.0pt;color:#0563C1'>j3@mailman.j3-fortran.org</span>=
</a><span lang=3DEN-US style=3D'font-size:11.0pt'>&gt;; 'WG5' =
&lt;</span><a href=3D"mailto:sc22wg5@open-std.org"><span lang=3DEN-US =
style=3D'font-size:11.0pt;color:#0563C1'>sc22wg5@open-std.org</span></a><=
span lang=3DEN-US =
style=3D'font-size:11.0pt'>&gt;<br><b>Subject:</b><span =
class=3Dapple-converted-space>&nbsp;</span>[ukfortran] [SC22WG5.6484] =
[J3] RE: [EXTERNAL] [BULK] are race conditions allowed in do =
concurrent?</span><o:p></o:p></p></div></div></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>Hi =
Malcolm,</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>&gt; &gt;variable/data =
entity/data object</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&gt; &gt;[are]<span =
class=3Dapple-converted-space>&nbsp;</span>circular, and doesn't seem to =
include individual array =
elements</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>&gt; Yes it does, see 3.138 =
subobject.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>While I see that it probably =
intends to include it, what it actually says =
is</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>subobject of a =
constant</span><o:p></o:p></p></div></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>so the edit would be to change =
it to</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>subobject of a variable or =
constant</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>I don't think the circularity is =
causing too much confusion, so I don't see much urgency in trying to fix =
it, and don't quite see an easy way to do so. I think we can leave it =
for now.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>Regards,</span><o:p></o:p></p></div></div></di=
v><div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>Brad</span><o:p></o:p></p></div></div></div><d=
iv><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>On Thu, 2023-09-14 at 14:04 =
+0900, Malcolm Cohen via J3 =
wrote:</span><o:p></o:p></p></div></div></div><blockquote =
style=3D'border:none;border-left:solid windowtext 1.5pt;padding:0cm 0cm =
0cm =
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5=
.0pt;border-color:currentcolor currentcolor currentcolor rgb(114, 159, =
207);border-image: none'><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:11.0pt'>Hi =
Brad,</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>There is no contradiction, subtle or =
otherwise, here.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Locality-specs are only for named variables. =
However, as noted, subobjects of variables are also =
variables.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&gt;<span =
class=3Dapple-converted-space>&nbsp;</span>The way I've heard =
&quot;definition&quot; applied to arrays is that definition of an =
element of an array does not constitute definition of the =
variable,</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Correct (except in the trivial case of an =
array with a single element). This is all spelled out explicitly: =
defining every &#8220;part&#8221; of a multi-part variable defines the =
variable.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>I can see some potential wording improvements =
for the next revision, but nothing that rises to the level of a =
defect.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>E.g. it may be better to mention that =
&#8220;if a variable has SHARED locality, all of its subobjects have =
SHARED locality&#8221;. It&#8217;s not written there now, because, like, =
how could it possibly be anything else? There is nothing else it could =
be. &nbsp;But making it explicit would lead naturally into writing =
&#8220;If a variable with SHARED locality is defined&#8230;&#8221; =
instead of the current &#8220;If it is =
defined&#8230;&#8221;.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&gt;variable/data entity/data =
object</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&gt;[are] circular, and doesn't seem to =
include individual array =
elements</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Yes it does, see 3.138 =
subobject.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>The circularity is unfortunate, but they are =
all reasonably worded for comprehensibility (not for trail-following). =
So it&#8217;s either deleting one of them (ugh) or rewording one to =
break the circle without making it hard to understand (it&#8217;s not =
obvious exactly what to do here, which is why it is still like =
this).</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>If it were a glossary of terms, instead of a =
list of definitions, there would be no problem with circularity, =
right?</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Anyway, I agree it would be good to fix it as =
long as it doesn&#8217;t make any individual term hard to =
understand.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Given our experience this time around, I =
would be in favour of pruning our terms and definitions, down to a more =
minimal set. If there are &#8220;useful&#8221; terms that do not lend =
themselves to trivial drop-in replacement, and I think there are, we =
could consider adding a &#8220;Glossary&#8221; (of &#8220;useful =
terms&#8221;, but probably better not to call them =
&#8220;terms&#8221;!).</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Cheers,</span><o:p></o:p></p></div></div><div>=
<div style=3D'margin-left:36.0pt'><p class=3DMsoNormal =
style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>--</span><o:p></o:p></p></div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal =
style=3D'text-align:justify'><span lang=3DEN-US =
style=3D'font-size:10.5pt'>..............Malcolm Cohen, NAG =
Oxford/Tokyo.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'border:none;border-top:solid windowtext 1.0pt;padding:3.0pt =
0cm 0cm 0cm;border-color:currentcolor;border-image: none'><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><b><span lang=3DEN-US =
style=3D'font-size:11.0pt'>From:</span></b><span =
class=3Dapple-converted-space><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span></span><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Brad Richardson &lt;</span><a =
href=3D"mailto:everythingfunctional@protonmail.com"><span lang=3DEN-US =
style=3D'font-size:11.0pt;color:#0563C1'>everythingfunctional@protonmail.=
com</span></a><span lang=3DEN-US style=3D'font-size:11.0pt'>&gt;<span =
class=3Dapple-converted-space>&nbsp;</span><br><b>Sent:</b><span =
class=3Dapple-converted-space>&nbsp;</span>Wednesday, September 13, 2023 =
3:49 AM<br><b>To:</b><span =
class=3Dapple-converted-space>&nbsp;</span>General J3 interest list =
&lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org"><span =
lang=3DEN-US =
style=3D'font-size:11.0pt;color:#0563C1'>j3@mailman.j3-fortran.org</span>=
</a><span lang=3DEN-US style=3D'font-size:11.0pt'>&gt;; WG5 =
&lt;</span><a href=3D"mailto:sc22wg5@open-std.org"><span lang=3DEN-US =
style=3D'font-size:11.0pt;color:#0563C1'>sc22wg5@open-std.org</span></a><=
span lang=3DEN-US =
style=3D'font-size:11.0pt'>&gt;<br><b>Subject:</b><span =
class=3Dapple-converted-space>&nbsp;</span>[ukfortran] [SC22WG5.6480] =
[EXTERNAL] [BULK] [J3] are race conditions allowed in do =
concurrent?</span><o:p></o:p></p></div></div></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>Hmm... I decided to work through =
this a bit more =
thoroughly.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>From the syntax =
definitions:</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>R902</span><o:p></o:p></p></div></div></div><d=
iv><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>variable</span><o:p></o:p></p></div></div></di=
v><div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>is =
designator</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or =
function-reference</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>R901</span><o:p></o:p></p></div></div></div><d=
iv><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>designator</span><o:p></o:p></p></div></div></=
div><div><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:11.0pt'>is =
object-name</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or =
array-element</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or =
array-section</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or =
coindexed-named-object</span><o:p></o:p></p></div></div></div><div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or =
complex-part-designator</span><o:p></o:p></p></div></div></div><div><div>=
<div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>or =
structure-component</span><o:p></o:p></p></div></div></div><div><div><div=
 style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or =
substring</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>Ok, so according to the syntax =
an array element is a =
variable.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>From the terms and =
definitions:</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>variable</span><o:p></o:p></p></div></div></di=
v><div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>data entity (3.41) that can be =
defined (3.48) and redefined during execution of a =
program</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>data =
entity</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>data object (3.42), result of the evaluation =
of an expression, or the result of the execution of a function =
reference</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>data =
object</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>constant, variable, or subobject of a =
constant</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>which is circular, and doesn't =
seem to include individual array =
elements.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>So now the question is which =
&quot;definition&quot; does the DO CONCURRENT constraint refer =
to?</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>From the syntax =
definitions:</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>R1129</span><o:p></o:p></p></div></div></div><=
div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>concurrent-locality</span><o:p></o:p></p></div=
></div></div><div><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>is</span><o:p></o:p></p></div></div></div><div=
><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>[ locality-spec =
]...</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>R1130</span><o:p></o:p></p></div></div></div><=
div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>locality-spec</span><o:p></o:p></p></div></div=
></div><div><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:11.0pt'>is LOCAL =
( variable-name-list =
)</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or LOCAL_INIT ( variable-name-list =
)</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or REDUCE ( reduce-operation : =
variable-name-list =
)</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or SHARED ( variable-name-list =
)</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>or DEFAULT ( NONE =
)</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>only allows variable-name, not =
designator, so it's not exactly =
clear.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>The &quot;constraint&quot; =
appears in normative text, =
I.e.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>If a variable =
has</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>which is not hyperlinked and is =
not in a font indicating reference to the syntax =
term.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>My reading of this is that we =
have a subtle contradiction between the syntax and normative terms. My =
guess is that the syntax meaning (i.e. an array element is a variable) =
is what is intended for the rules here, and thus it's valid to =
(un)define *different* elements of an array in separate iterations, but =
not valid to (un)define and reference the same element of an array in =
separate =
iterations.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>I think it would be worth =
&quot;fixing&quot; the terms and definitions to eliminate the circular =
definition and make it consistent with the =
syntax.</span><o:p></o:p></p></div></div></div><div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>Regards,</span><o:p></o:p></p></div></div></di=
v><div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>Brad</span><o:p></o:p></p></div></div></div><d=
iv><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div><div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span =
lang=3DEN-US style=3D'font-size:11.0pt'>On Tue, 2023-09-12 at 17:37 =
+0000, Clune, Thomas L. (GSFC-6101) =
wrote:</span><o:p></o:p></p></div></div></div><blockquote =
style=3D'border:none;border-left:solid windowtext 1.5pt;padding:0cm 0cm =
0cm =
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5=
.0pt;border-color:currentcolor currentcolor currentcolor rgb(114, 159, =
207);border-image: none'><div><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&#8220;Variable&#8221; does not mean what we =
think it means:&nbsp;&nbsp;&nbsp;&nbsp; &lt;variable&gt;&nbsp; =
&nbsp;&lt;&lt;is&gt;&gt;&nbsp; &lt;designator&gt; &lt;&lt;or&gt;&gt; =
&lt;function-reference&gt;</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>And &lt;designator&gt; includes =
&lt;array-element&gt;.</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>But I for one would not mind an explanatory =
note that clarifies the common use case of array elements in this =
context.&nbsp;</span><o:p></o:p></p></div></div><div><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div><=
div style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div =
style=3D'border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm =
0cm 0cm;border-color:currentcolor;border-image: none'><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><b><span lang=3DEN-US =
style=3D'font-size:12.0pt'>From:</span></b><span lang=3DEN-US =
style=3D'font-size:12.0pt'>J3 &lt;</span><a =
href=3D"mailto:j3-bounces@mailman.j3-fortran.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt;color:#0563C1'>j3-bounces@mailman.j3-fortran.or=
g</span></a><span lang=3DEN-US style=3D'font-size:12.0pt'>&gt; on behalf =
of j3 &lt;</span><a href=3D"mailto:j3@mailman.j3-fortran.org"><span =
lang=3DEN-US =
style=3D'font-size:12.0pt;color:#0563C1'>j3@mailman.j3-fortran.org</span>=
</a><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&gt;<br><b>Reply-To:<span =
class=3Dapple-converted-space>&nbsp;</span></b>j3 &lt;</span><a =
href=3D"mailto:j3@mailman.j3-fortran.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt;color:#0563C1'>j3@mailman.j3-fortran.org</span>=
</a><span lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Date:<span =
class=3Dapple-converted-space>&nbsp;</span></b>Tuesday, September 12, =
2023 at 12:19 PM<br><b>To:<span =
class=3Dapple-converted-space>&nbsp;</span></b>j3 &lt;</span><a =
href=3D"mailto:j3@mailman.j3-fortran.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt;color:#0563C1'>j3@mailman.j3-fortran.org</span>=
</a><span lang=3DEN-US style=3D'font-size:12.0pt'>&gt;, WG5 =
&lt;</span><a href=3D"mailto:sc22wg5@open-std.org"><span lang=3DEN-US =
style=3D'font-size:12.0pt;color:#0563C1'>sc22wg5@open-std.org</span></a><=
span lang=3DEN-US style=3D'font-size:12.0pt'>&gt;<br><b>Cc:<span =
class=3Dapple-converted-space>&nbsp;</span></b>Brad Richardson =
&lt;</span><a href=3D"mailto:everythingfunctional@protonmail.com"><span =
lang=3DEN-US =
style=3D'font-size:12.0pt;color:#0563C1'>everythingfunctional@protonmail.=
com</span></a><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&gt;<br><b>Subject:<span =
class=3Dapple-converted-space>&nbsp;</span></b>[EXTERNAL] [BULK] [J3] =
[SC22WG5.6477] are race conditions allowed in do =
concurrent?</span><o:p></o:p></p></div></div></div><div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><table class=3DMsoNormalTable border=3D1 cellspacing=3D0 =
cellpadding=3D0 align=3Dleft width=3D"100%" =
style=3D'width:100.0%;border:solid black 1.5pt'><tr><td width=3D"100%" =
style=3D'width:100.0%;border:none;background:#FFEB9C;padding:3.75pt =
3.75pt 3.75pt 3.75pt'><div><div><p class=3DMsoNormal =
style=3D'mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wr=
ap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizo=
ntal:column;mso-height-rule:exactly'><b><span =
style=3D'color:black'>CAUTION:</span></b><span =
class=3Dapple-converted-space><span =
style=3D'font-size:11.0pt;color:black'>&nbsp;</span></span><span =
style=3D'color:black'>This email originated from outside of NASA.&nbsp; =
Please take care when clicking links or opening attachments.&nbsp; Use =
the &quot;Report Message&quot; button to report suspicious messages to =
the =
NASA&nbsp;SOC.</span><o:p></o:p></p></div></div></td></tr></table></div><=
p class=3DMsoNormal =
style=3D'mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;mar=
gin-left:72.0pt'><span lang=3DEN-US =
style=3D'font-size:11.0pt'><br><br><br><br><br></span><o:p></o:p></p><div=
><div><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Hi =
Jeff,</span><o:p></o:p></p></div></div></div><div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Based on &quot; If it is defined or becomes =
undefined during any iteration, it shall not be referenced, defined, or =
become undefined during any other iteration.&quot;, the provide program =
is invalid, because `x` becomes defined in more than one =
iteration.</span><o:p></o:p></p></div></div></div><div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>The way I've heard &quot;definition&quot; =
applied to arrays is that definition of an element of an array does not =
constitute definition of the variable, because it is then only partially =
defined. I.e. an array is only defined once each of its elements has =
been defined.</span><o:p></o:p></p></div></div></div><div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>My opinion is that the above constraint =
simply does not adequately describe/is still ambiguous about the case of =
arrays. I think an interp would be warranted, and we should say that an =
element of an array should have the same constraint as above if the =
variable is shared.</span><o:p></o:p></p></div></div></div><div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Regards,</span><o:p></o:p></p></div></div></di=
v><div><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>Brad</span><o:p></o:p></p></div></div></div><d=
iv><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>&nbsp;</span><o:p></o:p></p></div></div></div>=
<div><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:11.0pt'>On Tue, 2023-09-12 at 14:43 +0000, Jeff =
Hammond via J3 wrote:</span><o:p></o:p></p></div></div></div><blockquote =
style=3D'border:none;border-left:solid windowtext 1.5pt;padding:0cm 0cm =
0cm =
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5=
.0pt;border-color:currentcolor currentcolor currentcolor rgb(114, 159, =
207);border-image: none'><div style=3D'margin-left:36.0pt'><div =
style=3D'margin-left:36.0pt'><p class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Is this a legal program in Fortran with =
defined behavior?&nbsp; If it is illegal or the behavior is undefined, =
where do we say that?</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>program =
main</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&nbsp; =
integer :: k</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&nbsp; =
real :: x</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&nbsp; x =
=3D 0.0</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&nbsp; =
do concurrent (k=3D1:2) shared(x)</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;&nbsp;&nbsp; x =3D =
real(k)</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&nbsp; =
end do</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>&nbsp; =
print*,x</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>end =
program main</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>Is that =
what the following is intended to =
do?</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&#8220;If a variable has SHARED locality, =
appearances of the variable within the DO CONCURRENT construct refer to =
the variable in the innermost executable construct or scoping unit that =
includes the DO CONCURRENT construct. If it is defined or becomes =
undefined during any iteration, it shall not be referenced, defined, or =
become undefined during any other =
iteration.&#8221;</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US style=3D'font-size:12.0pt'>If so, =
then I am struggling to apply this to arrays.&nbsp; When we say a =
variable has shared locality, is the variable the array or the =
element?&nbsp; We can only put array names in SHARED(), but applying the =
text regarding &#8220;to become defined&#8221; from the perspective of =
arrays appears to have interesting =
consequences.</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>&nbsp;</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'>Thanks,</span><o:p></o:p></p></div></div><div =
style=3D'margin-left:36.0pt'><div style=3D'margin-left:36.0pt'><p =
class=3DMsoNormal><span lang=3DEN-US =
style=3D'font-size:12.0pt'><br>Jeff</span><o:p></o:p></p></div></div></bl=
ockquote></div></blockquote></blockquote></div></div></blockquote></div><=
/div></div></div></div></div></div></div></div></blockquote></div><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt'><o:p>&nbsp;</o:p></span></p></div></div></div>=
</div></div></div></div></body></html>
------=_NextPart_000_0473_01D9EF8E.085A2420--

