Subject: new FORALL proposal

From: Tomasz Haupt <[email-masked]>
Date: Mon, 19 Oct 1992 15:23:08 -0400

The present draft, (v.02)  has several serious drawbacks. The most important 
are:

- The same directive (PURE) has a different meaning if applied to functions
  and subroutines. We found it unacceptable therefore we proposed used two
  distinct directives: PURE and INDEPENDENT

- directive INDEPENDENT (to annotate independent do loop, as opposed to our 
  INDEPENDENT procedures) is not a mature concept. First of all, since it
  is semantical extension to 'regular' DO loops, the same way as FORALL is,
  it deserves a similar treatment as FORALL. It is not consistent to have
  a part of the G. Steele pictures being served by a new statement (FORALL)
  and others by HPF directive. It is confusing. Moreover, semantics of
  independent loops allows for private, temporary, scalar variables. On the
  other hand it is next to impossible to introduce such features in HPF 
  without significant revisions of the HPF idea or without introducing  
  a whole bunch of new syntactic features. We want to avoid any of them. 
  The solution is surprisingly simple: independent procedures. In this way 
  both HPF computational model and 30-years old tradition of Fortran scope of 
  variables is preserved.   

- We want both user defined elemental functions and independent loops. 
  We found it wrong, however, that restrictions imposed on user
  defined elemental function are the same as restrictions imposed on 
  functions to be executed as an independent loop. Some of the restrictions on
  independent procedures can be relaxed, notably mandatory intent IN for
  arguments.  

- finally, we found that some opportunities of parallel execution has been
  overlooked in the current HPF proposal. This is why we introduced local
  functions (which are part of HPF in contrast to FOREIGN procedures). 
  The local function provides some support for reductions which we were 
  talking about. We have not find a way to introduce more powerful solutions
  without explicit reference to the machine architecture, and we want to 
  avoid it.
  
Although the proposal of a new version of FORALL chapter is made using the
previous one (partially approved) as a template, it is essentially a new
document. It is meant to be discussed as a first reading to get acceptance 
of HPFF as an general idea. I do not believe that it is flawless, 
sufficiently precise and comprehensive. Some omissions, inaccuracies, 
misspellings, etc. are unavoidable at this stage. We believe that at this 
stage the first part of it, the overview of our proposal is the most 
important. The detailed definitions of the proposed features given in the 
other part of the proposal serve as a prototype of what we expect to see in 
the final version.

Finally, please note that although we call our proposal 'an alternative
version of the chapter 4', it is actually an extension of the original one,
addressing our concerns explained above. Thus, it is our vision of how our
ideas may be incorporated in the original proposal. 

The outline ouf our proposal is as follows:

1) three categories of procedures (on top of 'regular' and external/foreign):
    PURE (as before)
    INDEPENDENT (less restrictions; PURE is a special case of INDEPENDENT)
    LOCAL (but not FOREIGN)

    the LOCAL and INDEPENDENT functions may be referenced in FORALL   

2) FORALL statement, as it has been originally introduced with a
   modification that INDEPENDENT and LOCAL procedures are allowed 

3) FORALL construct with FORALL-ELSEFORALL option instead of FORALL+WHERE

4) No INDEPENDENT DO, ASYNCH DO, INDEPENDENT FORALL, etc. This functionality
   is achieved by using FORALL + INDEPENDENT procedure

5) LOCAL functions in FORALL to address embarrassingly parallel problems
   and reductions

6) Elemantal PURE functions (as before)

I believe that it is a good idea to circulate our proposal as a separate
document.

We hope that discussion of our proposal will lead to the best possible 
conclusion: the HPF definition that HPFF wants.

                                  Tom Haupt, Syracuse