(j3.2006) a question on cobounds

Bill Long longb
Tue Jul 28 08:34:50 EDT 2009



Jim Xia wrote:
> 
>  > >> *        integer, save :: U(10)[N,*]      !<-- but do we intend to 
> allow
>  > >> this?  I have difficulties in finding constraints/rules that 
> forbid this*
>  > >>
>  > >>    
>  > >
>  > > This is allowed.  The array U has the same size on all images, and the
>  > > size is known at compile time.  The [N,*] only affects how the image
>  > > numbers are computed in references within the subroutine. This case is
>  > > discussed at [92:24-26].
>  > >  
>  > Frankly, this looks like shockingly bad design.  Like Jim, I never
>  > imagined that something with variable bounds could be static, even if
>  > the size were constant.
> 

But the bounds are NOT variable from image to image. The thing you 
expect to be static, the memory layout, is static.  The flexibility we 
are allowing is in the cobounds which are only used by the compiler in 
the mapping to compute the image index in a reference.

> 
> Same shock today here finding this out.  Although it's not much of an 
> implementation issue, the simple fact that a piece of static memory can 
> be declared differently from one run to another, from one image to 
> another, is quite appalling.  

Do you also find it appalling that a user can specify bounds for a 
noncoarray explicit-shape dummy argument that are different from the 
bounds of the corresponding actual argument?  This does not seem like a 
new concept in Fortran.


It seems we just handed bad programmers a
> huge ammunition.  One can *smartly* devise asymmetrically coshaped 
> coarrays on different images and play all kinds of games with that. 

Actually, I think the "games" are very limited.  And no one is obligated 
to play them. My assumption is that most users would not take advantage 
of this flexibility.  Disallowing it just seemed like a gratuitous 
restriction that served no purpose. And, as Malcolm pointed out, one 
that is not practically enforceable anyway.


>  This blows away the symmetrical attribute (or simplicity) I've always 
> associated with coarrays.  

But the memory image IS symmetric.  This is the key.


All in a sudden UPC seems not a bad language
> at all since the asymmetrical nature of a shared array can be better 
> regulated than this.  If cobounds provide nothing more than a shrewd way 
> to compute image index, then what is the point to have cobounds and 
> corank?  It may make things much easier if corank has to be 1 and 
> colbound must be 1.  Maybe we should stay with MPI after all.

The basic concept of coarrays is the extension of Fortran's array 
concepts to the image space. Restricting the corank to 1 is incompatible 
with this foundational characteristic.

I'm guessing you have not written code that uses coarrays to represent a 
distributed array across a 2- or 3-dimensional grid. Coarrays with 
corank > 1 are enormously useful for program clarity and maintainability 
  in cases like this, and this is a pretty common case. This is a big 
advantage we have over UPC and MPI.  There are others as well, of course.

Cheers,
Bill



> 
> 
> Jim Xia
> 
> XL Fortran Compiler Test
> IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
> Phone (905) 413-3444  Tie-line 313-3444
> email: jimxia at ca.ibm.com
> D2/YF7/8200 /MKM
> 
> http://www.ibm.com/software/awdtools/fortran/xlfortran
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120





More information about the J3 mailing list