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

From: <[email-masked]> (Henry Zongaro)
Date: Wed, 26 Jun 1996 10:01:13 -0400 (EDT)

---------------------------------------------------------------------------
[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.
---------------------------------------------------------------------------

Hello,

     According to Section 3.10 of the HPF Language Spec.,

         If there is an explicit interface for the called subprogram
         and that interface contains mapping directives (whether
         prescriptive or descriptive) for the dummy argument in
         question, the actual argument will be remapped if necessary
         to conform to the directives in the explicit interface.

     However, it does not state what should happen if there is an explicit
interface that does not contain explicit mapping directives.  I always took it
to mean that the mapping would be determined by the called procedure, just as
it would be for procedures with implicit interfaces, rather than happening on
the calling side.

     For example, my understanding is that the calls to sub1 and sub2 would
be permitted, but not the call to sub3, just as the calls would be permitted
if sub1, sub2 and sub3 had implicit interfaces in prog.

         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

     Do others have a different understanding of how this operates?

Thanks,

Henry
---------------------------------------------------------------------------
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: Carol Munroe <[email-masked]>
Date: Wed, 26 Jun 96 12:06:02 EDT

From: <[email-masked]> (Henry Zongaro)
   Date: Wed, 26 Jun 1996 10:01:13 -0400 (EDT)

   Hello,

Hi Henry,

The following is my understanding of this example.

I believe that the point of the explicit interface is to reconcile any
possible discrepancy in mappings between the actual argument and the dummy
argument, so that any remapping can always be done by the caller. The
intention was also to remove the distinction between prescriptive and
descriptive directives.  It was not intended to prevent the callee from
doing it, but by not removing the old syntactic distinction between
prescriptive and descriptive directives, some ambiguity may remain. I
believe that if a full interface is included, showing a discrepancy between
the actual argument's mapping and an incompatible descriptive mapping for
the dummy argument, the caller is apparently expected to make the remapping
happen anyway. So with an explicit interface, the call to sub3 is correct.

In particular, the lack of explicit mapping directives in the interface for
sub1 means that there is no guarantee that the remapping will be done
(since the caller doesn't see the need). The programmer is therefore taking
a change by relying on the (no longer significant) "prescriptive" form of
the directives in sub1.

With sub2, the default mapping behavior of the compiler may or may not be
nonsequential, block-distributed onto proc(number_of_processors()), so
again there could be a failure.

With sub3, again, the lack of an interface means that the caller 
does not remap as needed, so there will be a programmer's error.
With an interface, the remapping would be done.

--Carol
	    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)

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

	    subroutine sub1(a)
	      integer :: a(:)

	    subroutine sub2(a)
	      integer :: a(:)

	    subroutine sub3(a)
	      integer :: a(:)

   Thanks,

   Henry