Subject: chapter 9 document

From: [email-masked] (Mary E Zosel)
Date: Fri, 4 Dec 92 12:43:57 -0800

To: F90 group
the following text has an updated copy of chapter 9 --- this includes
the hpf macros pasted on the front so you can run it thru docmake.
If you have a chance - print it out and see if you can spot more
editorial changes or issues we should discuss at the meeting next
week.  I will send Chuck a copy Monday morning to include in the
latest document before the meeting.  Any edits you get to me early
Monday or before will be included.
   -mary-

---
---
%hpf-freestanding-chapter-header.tex

%Version of August 5, 1992 - David Loveman, Digital Equipment Corporation

\documentstyle[11pt]{report}
\pagestyle{plain}
\pagenumbering{arabic}
\marginparwidth 0pt
\oddsidemargin=.25in
\evensidemargin  .25in
\marginparsep 0pt
\topmargin=-.5in
\textwidth=6.0in
\textheight=9.0in
\parindent=2em

%the file syntax-macros.tex is physically included below

%syntax-macros.tex

%Version of July 29, 1992 - Guy Steele, Thinking Machines

\newdimen\bnfalign         \bnfalign=2in
\newdimen\bnfopwidth       \bnfopwidth=.3in
\newdimen\bnfindent        \bnfindent=.2in
\newdimen\bnfsep           \bnfsep=6pt
\newdimen\bnfmargin        \bnfmargin=0.5in
\newdimen\codemargin       \codemargin=0.5in
\newdimen\intrinsicmargin  \intrinsicmargin=3em
\newdimen\casemargin       \casemargin=0.75in
\newdimen\argumentmargin   \argumentmargin=1.8in

\def\IT{\it}
\def\RM{\rm}
\let\CHAR=\char
\let\CATCODE=\catcode
\let\DEF=\def
\let\GLOBAL=\global
\let\RELAX=\relax
\let\BEGIN=\begin
\let\END=\end

\def\FUNNYCHARACTIVE{\CATCODE`\a=13 \CATCODE`\b=13 \CATCODE`\c=13 \CATCODE`\d=13
		     \CATCODE`\e=13 \CATCODE`\f=13 \CATCODE`\g=13 \CATCODE`\h=13
		     \CATCODE`\i=13 \CATCODE`\j=13 \CATCODE`\k=13 \CATCODE`\l=13
		     \CATCODE`\m=13 \CATCODE`\n=13 \CATCODE`\o=13 \CATCODE`\p=13
		     \CATCODE`\q=13 \CATCODE`\r=13 \CATCODE`\s=13 \CATCODE`\t=13
		     \CATCODE`\u=13 \CATCODE`\v=13 \CATCODE`\w=13 \CATCODE`\x=13
		     \CATCODE`\y=13 \CATCODE`\z=13 \CATCODE`\[=13 \CATCODE`\]=13
                     \CATCODE`\-=13}

\def\RETURNACTIVE{\CATCODE`\
=13}

\makeatletter
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
 -.2ex}{2.3ex plus .2ex}{\large\sf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
 -.2ex}{1.5ex plus .2ex}{\large\sf}}

\def\@ifpar#1#2{\let\@tempe\par \def\@tempa{#1}\def\@tempb{#2}\futurelet
    \@tempc\@ifnch}

\def\?#1.{\begingroup\def\@tempq{#1}\list{}{\leftmargin\intrinsicmargin}\relax
  \item[]{\bf\@tempq.} \@intrinsictest}
\def\@intrinsictest{\@ifpar{\@intrinsicpar\@intrinsicdesc}{\@intrinsicpar\relax}}
\long\def\@intrinsicdesc#1{\list{}{\relax
  \def\@tempb{ Arguments}\ifx\@tempq\@tempb
			  \leftmargin\argumentmargin
			  \else \leftmargin\casemargin \fi
  \labelwidth\leftmargin  \advance\labelwidth -\labelsep
  \parsep 4pt plus 2pt minus 1pt
  \let\makelabel\@intrinsiclabel}#1\endlist}
\long\def\@intrinsicpar#1#2\\{#1{#2}\@ifstar{\@intrinsictest}{\endlist\endgroup}}
\def\@intrinsiclabel#1{\setbox0=\hbox{\rm #1}\ifnum\wd0>\labelwidth
  \box0 \else \hbox to \labelwidth{\box0\hfill}\fi}
\def\Case(#1):{\item[{\it Case (#1):}]}
\def\&#1 {\@ifnextchar({\def\@tempq{#1}\@intrinsicopt}{\item[#1]}}
\def\@intrinsicopt(#1){\item[{\@tempq} (#1)]}

\def\MATRIX#1{\relax
    \@ifnextchar,{\@MATRIXTABS{}#1,\@FOO, \hskip0pt plus 1filll\penalty-1\@gobble
  }{\@ifnextchar;{\@MATRIXTABS{}#1,\@FOO; \hskip0pt plus 1filll\penalty-1\@gobble
  }{\@ifnextchar:{\@MATRIXTABS{}#1,\@FOO: \hskip0pt plus 1filll\penalty-1\@gobble
  }{\@ifnextchar.{\hfill\penalty1\null\penalty10000\hskip0pt plus 1filll
		  \@MATRIXTABS{}#1,\@FOO.\penalty-50\@gobble
  }{\@MATRIXTABS{}#1,\@FOO{ }\hskip0pt plus 1filll\penalty-1}}}}}

\def\@MATRIXTABS#1#2,{\@ifnextchar\@FOO{\@MATRIX{#1#2}}{\@MATRIXTABS{#1#2&}}}
\def\@MATRIX#1\@FOO{\(\left[\begin{array}{rrrrrrrrrr}#1\end{array}\right]\)}

\def\@IFSPACEORRETURNNEXT#1#2{\def\@tempa{#1}\def\@tempb{#2}\futurelet\@
tempc\@ifspnx}

{
\FUNNYCHARACTIVE
\GLOBAL\DEF\FUNNYCHARDEF{\RELAX
    \DEFa{{\IT\CHAR"61}}\DEFb{{\IT\CHAR"62}}\DEFc{{\IT\CHAR"63}}\RELAX
    \DEFd{{\IT\CHAR"64}}\DEFe{{\IT\CHAR"65}}\DEFf{{\IT\CHAR"66}}\RELAX
    \DEFg{{\IT\CHAR"67}}\DEFh{{\IT\CHAR"68}}\DEFi{{\IT\CHAR"69}}\RELAX
    \DEFj{{\IT\CHAR"6A}}\DEFk{{\IT\CHAR"6B}}\DEFl{{\IT\CHAR"6C}}\RELAX
    \DEFm{{\IT\CHAR"6D}}\DEFn{{\IT\CHAR"6E}}\DEFo{{\IT\CHAR"6F}}\RELAX
    \DEFp{{\IT\CHAR"70}}\DEFq{{\IT\CHAR"71}}\DEFr{{\IT\CHAR"72}}\RELAX
    \DEFs{{\IT\CHAR"73}}\DEFt{{\IT\CHAR"74}}\DEFu{{\IT\CHAR"75}}\RELAX
    \DEFv{{\IT\CHAR"76}}\DEFw{{\IT\CHAR"77}}\DEFx{{\IT\CHAR"78}}\RELAX
    \DEFy{{\IT\CHAR"79}}\DEFz{{\IT\CHAR"7A}}\DEF[{{\RM\CHAR"5B}}\RELAX
    \DEF]{{\RM\CHAR"5D}}\DEF-{\@IFSPACEORRETURNNEXT{{\CHAR"2D}}{{\IT\CHAR"2D}}}}
}

%%% Warning!  Devious return-character machinations in the next several lines!
%%%           Don't even *breathe* on these macros!
{\RETURNACTIVE\global\def\RETURNDEF{\def
{\@ifnextchar\FNB{}{\@stopline\@ifnextchar
{\@NEWBNFRULE}{\penalty\@M\@startline\ignorespaces}}}}\global\def\@NEWBNFRULE
{\vskip\bnfsep\@startline\ignorespaces}\global\def\@ifspnx{\ifx\@tempc\@
sptoken \let\@tempd\@tempa \else \ifx\@tempc
\let\@tempd\@tempa \else \let\@tempd\@tempb \fi\fi \@tempd}}
%%% End of bizarro return-character machinations.

\def\IS{\@stopfield\global\setbox\@curfield\hbox\bgroup
  \hskip-\bnfindent \hskip-\bnfopwidth  \hskip-\bnfalign
  \hbox to \bnfalign{\unhbox\@curfield\hfill}\hbox to \bnfopwidth{\bf is \hfill}}
\def\OR{\@stopfield\global\setbox\@curfield\hbox\bgroup
  \hskip-\bnfindent \hskip-\bnfopwidth \hbox to \bnfopwidth{\bf or \hfill}}
\def\R#1 {\hbox to 0pt{\hskip-\bnfmargin R#1\hfill}}
\def\XBNF{\FUNNYCHARDEF\FUNNYCHARACTIVE\RETURNDEF\RETURNACTIVE
  \def\@underbarchar{{\char"5F}}\tt\frenchspacing
  \advance\@totalleftmargin\bnfmargin \tabbing
  \hskip\bnfalign\hskip\bnfopwidth\hskip\bnfindent\=\kill\>\+\@gobblecr}
\def\endXBNF{\-\endtabbing}

\def\BNF{\BEGIN{XBNF}}
\def\FNB{\END{XBNF}}

\begingroup \catcode `|=0 \catcode`\\=12
|gdef|@XCODE#1\EDOC{#1|endtrivlist|end{tt}}
|endgroup

\def\CODE{\begin{tt}\advance\@totalleftmargin\codemargin \@verbatim
   \def\@underbarchar{{\char"5F}}\frenchspacing \@vobeyspaces \@XCODE}
\def\ICODE{\begin{tt}\advance\@totalleftmargin\codemargin \@verbatim
   \def\@underbarchar{{\char"5F}}\frenchspacing \@vobeyspaces
   \FUNNYCHARDEF\FUNNYCHARACTIVE \UNDERBARACTIVE\UNDERBARDEF \@XCODE}

\def\@underbarsub#1{{\ifmmode _{#1}\else {$_{#1}$}\fi}}
\let\@underbarchar\_
\def\@underbar{\let\@tempq\@underbarsub\if\@tempz A\let\@tempq\@underbarchar\fi
  \if\@tempz B\let\@tempq\@underbarchar\fi\if\@tempz C\let\@tempq\@underbarchar\fi
  \if\@tempz D\let\@tempq\@underbarchar\fi\if\@tempz E\let\@tempq\@underbarchar\fi
  \if\@tempz F\let\@tempq\@underbarchar\fi\if\@tempz G\let\@tempq\@underbarchar\fi
  \if\@tempz H\let\@tempq\@underbarchar\fi\if\@tempz I\let\@tempq\@underbarchar\fi
  \if\@tempz J\let\@tempq\@underbarchar\fi\if\@tempz K\let\@tempq\@underbarchar\fi
  \if\@tempz L\let\@tempq\@underbarchar\fi\if\@tempz M\let\@tempq\@underbarchar\fi
  \if\@tempz N\let\@tempq\@underbarchar\fi\if\@tempz O\let\@tempq\@underbarchar\fi
  \if\@tempz P\let\@tempq\@underbarchar\fi\if\@tempz Q\let\@tempq\@underbarchar\fi
  \if\@tempz R\let\@tempq\@underbarchar\fi\if\@tempz S\let\@tempq\@underbarchar\fi
  \if\@tempz T\let\@tempq\@underbarchar\fi\if\@tempz U\let\@tempq\@underbarchar\fi
  \if\@tempz V\let\@tempq\@underbarchar\fi\if\@tempz W\let\@tempq\@underbarchar\fi
  \if\@tempz X\let\@tempq\@underbarchar\fi\if\@tempz Y\let\@tempq\@underbarchar\fi
  \if\@tempz Z\let\@tempq\@underbarchar\fi\@tempq}
\def\@under{\futurelet\@tempz\@underbar}

\def\UNDERBARACTIVE{\CATCODE`\_=13}
\UNDERBARACTIVE
\def\UNDERBARDEF{\def_{\protect\@under}}
\UNDERBARDEF

\catcode`\$=11  

%the following line would allow derived-type component references 
%FOO%BAR in running text, but not allow LaTeX comments
%without this line, write FOO\%BAR
%\catcode`\%=11 

\makeatother

%end of file syntax-macros.tex

\title{High Performance Fortran \\ Language Specification}
\author{High Performance Fortran Forum}
%\date{ }

\hyphenation{RE-DIS-TRIB-UT-ABLE sub-script Wil-liam-son}

\begin{document}

\maketitle

\newpage

\pagenumbering{roman}

\vspace*{4.5in}

This is the result of a LaTeX run of a draft of a single chapter of 
the HPFF Final Report document.

\vspace*{3.0in}

\copyright 1992 Rice University, Houston Texas.  Permission to copy 
without fee all or part of this material is granted, provided the 
Rice University copyright notice and the title of this document 
appear, and notice is given that copying is by permission of Rice 
University.

\tableofcontents

\newpage

\pagenumbering{arabic}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%put text of chapter here

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%put \end{document} here

%hpf-subset.tex

%list of work needed for this chapter.
%
% comments and volunteers welcome
%
%how to reference another chapter so I don't have
%the hard-reference to Chapter 8 in the text.
%

%Version of Dec. 02, 1992 - D. Loveman, DEC, M. Zosel LLNL

\chapter{Subset High 
Performance Fortran\protect\footnote{Version of
Dec. 2, 1992 - David Loveman, Digital Equipment Corporation, Mary Zosel LLNL,
with assistance from members of Fortran 90 subgroup.}}
\label{subset}

\section{Overview}
High Performance Fortran is defined as full Fortran 90 with 
restrictions on storage association and augmented by
language features in three areas:

\begin{itemize}

\item 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,

\item a FORALL statement and construct, and

\item extended intrinsic functions and a library.

\end{itemize}

This chapter presents a subset of HPF capable of 
being implemented
more rapidly than the full HPF.  
A subset implementation will  provide a standard
interim capability and full HPF implementations should
be developed as rapidly as possible.  The definition of 
the subset  language is intended to be a minimal 
requirement.  A given implementation may support 
additional Fortran 90  and HPF features.

\section{Fortran 90 Features in Subset High 
Performance Fortran}
The items listed here are the features of the HPF subset language.
For reference, the section numbers from the 
Fortran 90 standard  ISO/IEC 1539:1991 (E) are given 
along with the related syntax rule numbers.  

\sloppy

\begin{itemize}

\item All FORTRAN 77 standard conforming features, except for 
sequence and storage association.  See chapter 8.

\item The Fortran 90 definitions of MIL-STD-1753 features:

\begin{itemize}

\item DO WHILE statement (8.1.4.1.1 / R821)

\item END DO statement (8.1.4.1.1./ R825)

\item IMPLICIT NONE statement (5.3 / R540)

\item INCLUDE line (3.4)

\item scalar bit manipulation intrinsic procedures:  
     IOR, IAND, NOT, IEOR, ISHFT, ISHFTC, 
     BTEST, IBSET, IBCLR, IBITS, MVBITS  (13.13)

\item binary, octal and hexadecimal constants for use 
in DATA statements (4.3.1.1 / R407 and 5.2.9 / R533)

\end{itemize}

\item arithmetic and logical array features:

\begin{itemize}

\item array sections (6.2.2.3 / R618-621)

\begin{itemize}

\item subscript triplet notation (6.2.2.3.1)

\item vector-valued subscripts (6.2.2.3.2)

\end{itemize}

\item array constructors limited to one level of implied 
DO (4.5 / R431)

\item arithmetic and logical operations on whole arrays and 
     array sections (2.4.3, 2.4,5, and 7.1)

\item array assignment (2.4.5, 7.5, 7.5.1.4, and 7.5.1.5)

\item masked array assignment (7.5.3)

\begin{itemize}

\item WHERE statement (7.5.3 / R738)

\item block WHERE . . . ELSEWHERE construct (7.5.3 / R739)

\end{itemize}

\item array-valued external functions (12.5.2.2)

\item AUTOMATIC arrays (5.1.2.4.1)

\item ALLOCATABLE arrays and the ALLOCATE and 
DEALLOCATE statements 
(5.1.2.4.3, 6.3.1 / R622, and 6.3.3 / R631)

\item assumed-shape arrays (5,1,2,4,2 / R516)

\end{itemize}

\item intrinsics:

The list of intrinsic functions and subroutines below is a combination of 
routines which are entirely new to Fortran and
routines that  have always been part of Fortran, but
now have been extended to new argument and result types.  The new
or extended definitions of these routines are part of the subset. If
a FORTRAN 77 routine is not included in this list, then only the
original FORTRAN 77 definition is part of the subset.

For all of the intrinsics that  have an optional argument DIM, only
values of DIM which are initialization expressions and hence deliver 
a known shape at compile time are part of the subset.  The
intrinsics with this constraint are marked with * in the list below. 

\begin{itemize}

\item argument presence inquiry function:  
PRESENT (13.10.1)

\item numeric elemental functions:  
     ABS, AIMAG, AINT, ANINT, CEILING, CMPLX, CONJG, 
     DBLE, DIM, DPROD, FLOOR, INT, MAX, MIN, MOD, 
     MODULO, NINT, REAL, SIGN (13.10.2)

\item mathematical elemental functions:  
     ACOS, ASIN, ATAN, ATAN2, COS, COSH, EXP, LOG, 
     LOG10, SIN, SINH, SQRT, TAN, TANH (13.10.3)

\item character functions:  
     CHAR, ICHAR, INDEX, LEN, LGE, LGT, LLE, LLT (13.10.4)

\item bit manipulation elemental functions : 
     BTEST, IAND, IBCLR, IBITS, IBSET, 
     IEOR, IOR, ISHFT, ISHFTC, NOT (13.10.10)

\item vector and matrix multiply functions:  
     DOT_PRODUCT, MATMUL (13.10.13)

\item array reduction functions:  
     ALL*, ANY*, COUNT*, MAXVAL*, MINVAL*, PRODUCT*, 
SUM* (13.10.14)

\item array inquiry functions:  
     ALLOCATED, LBOUND*, SHAPE, SIZE*, UBOUND (13.10.15)

\item array construction functions:  
     MERGE, PACK, SPREAD*, UNPACK (13.10.16)

\item array reshape function:  
     RESHAPE (13.10.17)

\item array manipulation functions:  
     CSHIFT*, EOSHIFT*, TRANSPOSE (13.10.18)

\item array location functions:  
     MAXLOC*, MINLOC* (13.10.19)

\item intrinsic elemental subroutine:  
      MVBITS (13.9.3, 13.11)

\item intrinsic subroutines:  
      DATE_AND_TIME, RANDOM_NUMBER, 
      RANDOM_SEED,  SYSTEM_CLOCK (3.11)

\end{itemize}

\item declarations:

\begin{itemize}

\item Type declaration statements, 
with all forms of {\it type-spec} 
except {\it kind-selector} and TYPE(type-name), 
and all forms of {\it attr-spec}  except
{\it access-spec} , TARGET, and POINTER. 
(5.1 / R501-503, R510)

\item attribute specification statements:  
     ALLOCATABLE, INTENT, OPTIONAL, PARAMETER, SAVE (5.2)

\end{itemize}

\item procedure features:

\begin{itemize}

\item INTERFACE blocks with no 
{\it generic-spec} or 
{\it module-procedure-stmt} (12.3.2.1)

\item optional arguments (5.2.2)

\item keyword argument passing (12.4.1 /R1212)

\end{itemize}

\item syntax improvements:

\begin{itemize}

\item long (31 character) names (3.2.2)

\item lower case letters (3.1.7)

\item use of ``\_'' in names (3.1.3)

\item ``!'' initiated comments, both full line and trailing 
(3.3.2.1)

\end{itemize}

\end{itemize}

\section {Discussion of the Fortran 90 Subset Features}

There are many Fortran 90 features which are useful and 
relatively easy to implement, but are not included in the
subset language.  Features were selected for the subset
language for several reasons.

The Mil-STD-1753 features have been implemented so 
widely that many users have forgotten that they are not
part of FORTRAN 77.  They are included in the HPF subset.

Additional syntactic improvements are included, such
as long names and the "!" form of comments because of
their general usefulness in program documentation, 
including the description of HPF itself.

The biggest addition to FORTRAN 77 in the HPF 
subset language is the
inclusion of the array language. A number of vendors have 
identified the usefulness of array operations for 
concise expression of parallelism and  already
support these features.

The new storage classes such as allocatable, 
automatic, and assumed-shape objects are included in
the subset.  They provide an important alternative to
the use of storage association features such 
as EQUIVALENCE for memory management.

Interface blocks
have been added to the subset in order to facilitate use of the HPF 
directives across subroutine boundaries.
The interface blocks provide a mechanism to specify the 
expected mapping of data, in addition to the types and 
intents of the arguments. 

There were other Fortran 90 features considered for the subset. Some
features such as CASE or NAMELIST were recognized as popular features
of Fortran 90, but had no direct bearing on high performance. Other
features such as support for double precision complex (via KIND) or
procedureless MODULES were rejected because of the perception that
the additional implementation complexity might delay release of
subset compilers. It was not a goal of HPFF to define an "ideal"
subset of Fortran 90 for all purposes.

\section{HPF Features NOT in Subset High Performance Fortran}

All HPF directives  and language extensions are included 
in the HPF subset
language with the following exceptions:

\begin{itemize}

\item  directives for REALIGN,  REDISTRIBUTE, and
DYNAMIC  

\item the PROCESSOR_VIEW directive  

\item the PURE directive

\item the {\it for-all-construct}

\item  the HPF library

\item values of the optional DIM arguments to the Fortran 90 MAXLOC
and MINLOC intrinsic functions that are not initialization expressions.  

\item the EXTRINSIC directive, definition of extrinsic 
procedures, and the Fortran 90 SPMD binding  

\end{itemize}

\section {Discussion of the HPF Extension Subset}

The data mapping features of the HPF subset are limited to 
static mappings, plus the possible remapping of arguments 
across the interface of subprogram boundaries. Since the 
subset language does not include MODULES, and COMMON block 
variables cannot be remapped, this restriction only impacts 
remapping of local variables and additional remapping of 
arguments, after the subprogram boundary.

Only the simplest version of FORALL statement is required in the 
subset. Note that the omision of the PURE directive from the subset
means that only HPF and Fortran 90 instrinsic functions can be
called from the FORALL statement.  No other subprograms can be called.

Only the intrinsics which are useful for declaration of 
variables and mapping inquiries are included in the 
subset.  The full set of  extended operations proposed for 
the  HPF library is not required.

All of these HPF language reductions are made in the spirit 
of allowing  vendors to get a usable (subset) version of 
HPF to users quickly so that initial experimentation with 
the language can begin.  
This list of HPF features excluded from the subset should not be
interpretted as requiring implementors to omit the features from
the subset.  Implementations  with as many HPF features as possible
are encouraged.  The list does, however,
establish the features a user should avoid if an HPF application is
expected to be move between different HPF subset implementations.

\fussy

\end{document}