(j3.2006) Atomic references and updates

Van Snyder Van.Snyder
Thu Dec 4 21:29:34 EST 2008

Yesterday I proposed three alternatives to 08-297r1, and then sent
details about two of them.

I've tweaked the second one in light of recent correspondence, and
attach it.

For the parts of it that provide similar functionality to 08-297r1, but
spelt differently, it's less than half as much.  Seven of the lines of
the attachment are a note illustrating what is meant by "atomic," which
is lacking from 08-297r1.

The difference in functionality is that more than one atomic operation
can be specified in a single statement.  Nick is worked up about this
because of unspecified ordering, but there was nothing in 08-297r1 to
prohibit atomic operations inside DO CONCURRENT constructs.

If it's necessary to prohibit this, it would take as much space in the
attachment as it would in an amendment of 08-297r1.

Aside from the fact that the attachment represents a smaller change to
the standard, the attraction of it for me is that programmers already
know what variable reference and variable definition contexts are.
Also, atomic operations can appear in more contexts, such as dummy
arguments and in I/O lists, although the latter probably isn't

Van Snyder                    |  What fraction of Americans believe 
Van.Snyder at jpl.nasa.gov       |  Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or
disapproved by JPL, CalTech, NASA, the President, or anybody else.
-------------- next part --------------
[100:5.3.19p1] At the end of the first paragraph of "5.3.19 VOLATILE
attribute" delete ", or by another image without synchronization".

[R601] Insert "<<or>> <atomic-indicator>" after "<<or>> <array-section>".

[New] "6.4.2a Atomic indicator

R613a <atomic-indicator> <<is>> <designator> % ATOMIC

C618a The <designator> shall be of type integer with kind
      ATOMIC_INT_KIND or of type logical with kind ATOMIC_LOGICAL_KIND,
      where the values of ATOMIC_INT_KIND and ATOMIC_LOGICAL_KIND are
      given by named constants from the intrinsic module ISO_FORTRAN_ENV.

{So the processor can arrange convenient alignment:}

C618b The <designator> shall not be a component of an object of a
      sequence type ( or of a type with the BIND(C) attribute.

{Maybe require copy-in for atomic actual arguments, to avoid thunking or
hoping for copy in/out; maybe put it at C1236b with "atomic indicator"
and "actual argument" exchanged:}

C618c If an atomic indicator is an actual argument, the corresponding
      dummy argument shall have the VALUE attribute.

If an atomic indicator appears

o in a reference, the entirety of the value of the designated entity is
  produced as if instantaneously, and

o in a variable definition context, the entirety of the value of the
  designated entity is defined as if instantaneously,

without interfering with or interference from processes defined by
means other than Fortran or from other images.

NOTE 6.5a
  Suppose a processor represents LOGICAL(ATOMIC_LOGICAL_KIND) using two
  octets, and its values are represented by Z'0000' or Z'FFFF'.  An
  atomic reference to or definition of such an object would always
  produce one of those values, and never produce either Z'00FF' or
  Z'FF00', even if a process defined by means other than Fortran, or
  another image, is defining it concurrently."

[188:8.5.1p6] Replace the first sentence of the paragraph:

"An atomic (6.4.2a) reference to a coarray or coindexed object is
permitted during execution of a segment that is unordered relative to
the execution of a segment in which an atomic definition of it occurs."

[191:NOTE 8.38]
Delete ",VOLATILE"

[Same,b as in 08-297r1, but without "specified by atomic

More information about the J3 mailing list