Subject: hpff-interpret: Re: No mapping directives in explicit interface?

From: [email-masked] (Carl Offner)
Date: Thu, 27 Jun 1996 11:15:10 -0400

---------------------------------------------------------------------------
[email-masked] is a mailing list for corrections,
clarifications, and interpretations related to High Performance Fortran.
Instructions for adding or deleting yourself from this list appear at the
bottom of this message.
---------------------------------------------------------------------------

On Henry's example:

---------------------------------------------------------------------
         program prog
           interface
             subroutine sub1(a)
               integer :: a(:)
             end subroutine sub1
             subroutine sub2(a)
               integer :: a(:)
             end subroutine sub2
             subroutine sub3(a)
               integer :: a(:)
             end subroutine sub3
           end interface

           integer :: a(100)
   !hpf$   processors proc(number_of_processors())
   !hpf$   distribute a(block) onto proc

           call sub1(a)
           call sub2(a)
           call sub3(a)
         end program prog

         subroutine sub1(a)
           integer :: a(:)
   !hpf$   processors proc(number_of_processors())
   !hpf$   distribute a(cyclic) onto proc
         end subroutine sub1

         subroutine sub2(a)
           integer :: a(:)
   !hpf$   processors proc(number_of_processors())
   !hpf$   distribute a*(block) onto *proc
         end subroutine sub2

         subroutine sub3(a)
           integer :: a(:)
   !hpf$   processors proc(number_of_processors())
   !hpf$   distribute a*(cyclic) onto *proc
         end subroutine sub3
---------------------------------------------------------------------

I would say that all three interfaces are non-conforming because the
interfaces do not reflect the mappings.  There are, to be sure,
instances in which an interface would not be required -- sub2 is
an example -- but if an interface is present, it should correctly
reflect the mapping of all explicitly mapped arguments.

Now I don't actually see that the HPF spec says precisely this.
However, it was certainly the understanding behind the explicit
interface proposal.  After all, what is the point in requiring an
explicit interface if the explicit interface does not have to describe
the mappings?  So maybe (unless some language lawyer can convince us
all that this is already in the spec) we should add a sentence to this
effect.  Presumably this would be something like specifying that
the mapping of a dummy argument is a "characteristic" of that
argument, in the terminology of the Fortran standard.

Again, I assume that this is nothing really new, just a clarification.

		--Carl
---------------------------------------------------------------------------
To (un)subscribe to this list, send mail to
[email-masked].
Leave the subject line blank, and in the body put the line
(un)subscribe <email-address>
---------------------------------------------------------------------------

---

From: Dave Watson <[email-masked]>
Date: Fri, 28 Jun 1996 14:38:42 +0100 (BST)

> Again, I assume that this is nothing really new, just a clarification.

I believe Carl has hit the nail on the head. Alignment/Distribution of a dummy
SHOULD be a characteristic. With this statement the distinction between
prescriptive and descriptive mappings in HPF-1.x becomes redundant naturally
since an interface must be present for any mapped object and remapping
must be performed if the interface is present for a descriptive mapping.
It seems to me to be both logical and in the spirit of F90/F95 that mapping
should be a characteristic. After all, F90 requires an interface if TARGET is 
specified for a dummy but HPF does not (currently) require that a compiler
is informed that an argument is/is not distributed and if so how! I believe 
the current position within HPF-2 to be that an interface is required if there
is remapping of the actual and not otherwise. From this I would concur that 
all 3 interfaces are non-conforming. However, I think that HPF-2 should be 
explicit and state that hpf directives applied to dummy arguments are 
characteristics of the dummy. Consider the following :

            integer :: a(10),b(10)
    !hpf$   distribute a(block)
    !hpf$   distribute b(cyclic)
            call external_sub(a)
            call external_sub(b)

A compiler would be justified in rejecting this program since it can prove 
that either or both interfaces cause remapping but no interface is present. If
we add an interface both calls become legal. By the absence of a specified 
interface the compiler can infer the f77 interface and thus that the arguments
need to be remapped to the default mapping the compiler uses when no mapping 
is specified.

            integer :: a(10),b(10)
    !hpf$   distribute a(block)
    !hpf$   distribute b(cyclic)
            interface
              subroutine external_sub(x)
                integer :: external_x(*)
              end subroutine sub
            end interface
            call external_sub(a)
            call external_sub(b)

I strongly support the notion that mapping is a characteristic of a dummy and
hence that interfaces are required for all procedures with mapped arguments. 
cheers
   dave