Subject: Subset High Performance Fortran

From: David Loveman <[email-masked]>
Date: Fri, 29 May 92 12:50:38 PDT

It may not be correct, but it *will* generate some discussion.

-David

------------------------------------------------------------------------

Proposal for Subset HPF

David Loveman
Digital Equipment Corporation
Version of May 29, 1992

1.  OVERVIEW

High Performance Fortran is being defined as full Fortran 90 augmented
by language features in three areas:

7 directives in the form of structured comments which, although they do
not change the meaning of a program, provide information to a compiler
to enable optimization,

7 a FORALL statement, and

7 new intrinsic functions.

This proposal presents a subset of HPF capable of being implemented by
multiple implementors more rapidly than the full HPF.  It is intended
that such a subset implementation be to provide a standard interim
capability and that full HPF implementations should be developed as
rapidly as possible.

2.  FORTRAN 90

The facilities for array computations in Fortran 90 will make it the
programming language of choice for scientific and engineering numerical
calculations on high performance computers. Indeed, some of these
facilities are already supported in compilers from a number of vendors.
 The introductory overview in the Fortran 90 standard states:

     Operations for processing whole arrays and subarrays 
     (array sections) are included in [Fortran 90] for two 
     principal reasons: (1) these features provide a more 
     concise and higher level language that will allow 
     programmers more quickly and reliably to develop and 
     maintain scientific/engineering applications, and (2) 
     these features can significantly facilitate optimization 
     of array operations on many computer architectures.

Other features of Fortran 90 that improve upon the features provided in FORTRAN are:

7 Additional storage classes of objects --- The new storage classes
such as allocatable, automatic, and assumed-shape objects, and the
pointer facility of Fortran 90 add significantly to those of FORTRAN 77
and should reduce the style of use of FORTRAN 77 constructs which can
lead to less than full computational speed on high performance
computers, such as EQUIVALENCEd array objects, COMMON definitions with
non-identical array definitions across subprograms, and
actual-argument/dummy-argument array shape transformations.

7 Modules --- The module facilities of Fortran 90 enable the practice
of design implementation using data abstractions.  These facilities
support the specification of modules, including user-defined data types
and structures, defined operators on those types, and generic
procedures for implementing common algorithms to be used on a variety
of data structures. In addition to modules, the definition of interface
blocks enables the application programmer to specify the interfaces
subprograms explicitly, allowing a high quality compiler to use the
information specified to provide better checking and optimization at
the interface to other subprograms.

7 Additional intrinsic procedures --- Fortran 90 includes the
definition of a large number of new intrinsic procedures.  Many of
these new intrinsic procedures support mathematical operations on
arrays, including the construction and transformation of arrays.  Also,
there are numerical accuracy intrinsic procedures designed to support
numerical programming, and bit manipulation intrinsic procedures
derived from MIL-STD-1753.

Over time, High Performance Fortran will be fully Fortran 90
conformant.  Because the effort involved in producing a full Fortran 90
compiler, High Performance Fortran is defined at two levels:  Subset
High Performance Fortran and  full High Performance Fortran.  Subset
High Performance Fortran is a subset of Fortran 90 with a subset of the
HPF additional language features.  High Performance Fortran is full
Fortran 90 with all of the approved HPF language features.

3.  FORTRAN 90 FEATURES IN SUBSET HIGH PERFORMANCE FORTRAN

7 FORTRAN 77 standard conformant, except for sequence and 
   storage association

7 MIL-STD-1753 conformance

    DO WHILE statement

    END DO statement

    IMPLICIT NONE statement

    INCLUDE statement (line)

    scalar bit manipulation intrinsic functions:  
     IOR, IAND, NOT, IEOR, ISHFT, ISHFTC, 
     BTEST, IBSET, IBCLR, IBITS, MVBITS

    octal and hexadecimal constants for use in DATA statements:  
     O'. . .', Z'. . . '

7 arithmetic and logical array features

    array sections

     > subscript triplet notation

     > vector-valued subscripts

    array constructors

    arithmetic and logical operations on whole arrays and 
     array sections

    array assignment

    masked array assignment

     > WHERE statement

     > block WHERE . . . ELSEWHERE construct

    array-valued external functions

    AUTOMATIC arrays

    ALLOCATABLE arrays and the ALLOCATE and DEALLOCATE statements

    assumed-shape arrays

7 inquiry, elemental, and transformational intrinsic functions

    argument presence inquiry function:  PRESENT

    numeric scalar and array elemental functions:  
     ABS, AIMAG, AINT, ANINT, CEILING, CMPLX, CONJG, 
     DBLE, DIM, DPROD, FLOOR, INT, MAX, MIN, MOD, 
     MODULO, NINT, REAL, SIGN

    mathematical scalar and array elemental functions:  
     ACOS, ASIN, ATAN, ATAN2, COS, COSH, EXP, LOG, 
     LOG10, SIN, SINH, SQRT, TAN, TANH

    character scalar functions:  
     CHAR, ICHAR, INDEX, LGE, LGT, LLE, LLT

    character inquiry function:  LEN

    kind functions:  
     KIND, SELECTED_INT_KIND, SELECTED_REAL_KIND

    bit manipulation functions (the MIL-STD-1753 functions): 
     BTEST, IAND, IBCLR, IBITS, IBSET, 
     IEOR, IOR, ISHFT, ISHFTC, NOT

    vector and matrix multiply functions:  
     DOT_PRODUCT, MATMUL

    array reduction functions:  
     ALL, ANY, COUNT, MAXVAL, MINVAL, PRODUCT, SUM

    array inquiry functions:  
     ALLOCATED, LBOUND, SHAPE, SIZE, UBOUND

    array construction functions:  
     MERGE, PACK, SPREAD, UNPACK

    array reshape function:  
     RESHAPE

    array manipulation functions:  
     CSHIFT, EOSHIFT, TRANSPOSE

    array location functions:  
     MAXLOC, MINLOC

    intrinsic subroutines:  
     the MIL-STD-1753 subroutines  MVBITS, RANDOM_NUMBER

7 control statements

    CASE

    DO loop extensions

     > "DO forever"

     > CYCLE

     > EXIT

7 declarations

    object-oriented syntax

     > object-oriented DATA statement

     > specification attributes:  
        DATA, DIMENSION, INTENT, OPTIONAL, 
        PARAMETER, SAVE, KIND selector

    attribute specification statements:  
     INTENT, OPTIONAL, PARAMETER, SAVE

7 procedure features

    INTERFACE blocks

    optional arguments

    keyword argument passage

7 syntax improvements

    long (31 character) names

    lower case letters

    use of "_" in names

    binary constants for use in DATA statements - B'. . .'

    " delimiter for character strings in addition to ' delimiter

    "!" initiated comments, both full line and trailing

    relational operators:  <, <=, ==, /=, >, >=

    named IF, CASE, DO constructs

    optional "construct-name name" on END statement for PROGRAM, 
     BLOCK DATA, FUNCTION, and SUBROUTINE

7 KIND capability - only standard way to get COMPLEX*16

    KIND type parameters

    KIND-qualified literals

    KIND intrinsics

4.  FORTRAN 90 FEATURES NOT IN SUBSET HIGH PERFORMANCE FORTRAN

7 sequence and storage association

7 assumed size arrays

7 free form source input

7 CHARACTER array operations

7 recursive procedures

7 Fortran 90 pointers

7 modules and the USE statement

7 user-defined derived types (i.e., record structures)

7 internal procedures

7 generic and defined operators

7 Fortran 90 non-FORTRAN 77 input / output facilities including 
   NAMELIST

7 intrinsic functions not in High Performance Fortran

    character scalar functions:  
     ACHAR, ADJUSTL, ADJUSTR, IACHAR, LEN_TRIM, REP,
     SCAN, TRIM, VERIFY

    logical function:  LOGICAL

    numeric inquiry functions:  
     DIGITS, EPSILON, HUGE, MAXEXPONENT, MINEXPONENT,
     PRECISION, RADIX, RANGE, TINY

    bit inquiry function:  
     BIT_SIZE

    transfer:  
     TRANSFER

    floating point manipulation functions:  
     EXPONENT, FRACTION, SCALE, SET_EXPONENT, NEAREST, 
     RRSPACING, SPACING

    pointer association status inquiry function:  
     ASSOCIATED

    intrinsic subroutines:  
     DATE_AND_TIME, RANDOM_SEED, SYSTEM_CLOCK

5.  HPF FEATURES IN SUBSET HIGH PERFORMANCE FORTRAN

In the absence of any approved HPF features, the list of features in
Subset High Performance Fortran can only be suggestive. 

7 "Specification" HPF directives

7 FORALL

    single assignment statement FORALL

    multiple assignment statement FORALL

7 NUMBER_OF_PROCESSORS and PROCESSOR_SHAPE intrinsics

6.  HPF FEATURES NOT IN SUBSET HIGH PERFORMANCE FORTRAN

In the absence of any approved HPF features, the list of features not
in Subset High Performance Fortran can only be suggestive. 

7 "Executable" HPF directives

7 FORALL with other than assignment statements

7 The other intrinsic functions

---

From: John Merlin <[email-masked]>
Date: Thu, 4 Jun 92 17:27:08 BST

I agree entirely with your lists of F90 features in and out of
Subset HPF, except for one exceedingly minor quibble -- why is 
'free source form input' *not* in Subset HPF, while most of its 
features (such as '!' comments, long names, etc) are included?  
However, this is such a trivial point that I don't really mind
if you completely ignore it!

                         John Merlin

---

From: David Loveman <[email-masked]>
Date: Fri, 5 Jun 92 07:45:37 PDT

>if you completely ignore it!

I included features that I felt were either critical, or important 
and not too hard to implement.  My feeling is that free source form 
is important, yet not trivial to implement.  (I know it's just 
lexing but . . .)   I certainly would not fight including free
source form in the subset - I write all my examples in it, and
our next release  of compilers will support it - but I can't argue 
that it should be required.

If someone else wants to argue it case, i will vote "yes."

-David

---

From: John Merlin <[email-masked]>
Date: Fri, 5 Jun 92 16:36:13 BST

> If someone else wants to argue it case, i will vote "yes."

I entirely agree with your view.  I like it, but it's not crucial
to the purpose of HPF and so should probably be excluded from
Subset HPF simply on those grounds.  In fact, the lexical improvements
you've included in Subset HPF correspond to the upgraded version 
of 'fixed source form' in F90 (except for omitting the ';' statement
separator), which seems fine.

                        John Merlin.