Vectorization........................................................................................................................

103

Using the +Ovectorize option............................................................................................

103

Controlling vectorization locally.........................................................................................

104

Calling BLAS library routines.............................................................................................

105

Controlling code generation for performance...........................................................................

106

7 Writing HP-UX applications......................................................................

107

Accessing command-line arguments........................................................................................

107

Calling HP-UX system and library routines................................................................................

108

Using HP-UX file I/O.............................................................................................................

108

Stream I/O using FSTREAM..............................................................................................

108

Performing I/O using HP-UX system calls.............................................................................

108

Establishing a connection to a file......................................................................................

108

Obtaining an HP-UX file descriptor.....................................................................................

109

8 Calling C routines from HP Fortran............................................................

110

Data types...........................................................................................................................

110

Unsigned integers............................................................................................................

111

Logicals..........................................................................................................................

111

Complex numbers............................................................................................................

112

Derived types..................................................................................................................

113

Pointers...........................................................................................................................

113

Argument-passing conventions................................................................................................

113

Case sensitivity.....................................................................................................................

114

Arrays.................................................................................................................................

116

Memory layout of a two-dimensional array in Fortran and C..................................................

116

C strings..............................................................................................................................

118

C null-terminated string.....................................................................................................

118

Fortran hidden length argument.........................................................................................

118

Passing a string...............................................................................................................

118

File handling........................................................................................................................

120

Sharing data........................................................................................................................

122

9 Using Fortran directives...........................................................................

123

Directive syntax....................................................................................................................

123

Using HP Fortran directives....................................................................................................

123

$HP$ ALIAS....................................................................................................................

124

$HP$ CHECK_OVERFLOW...............................................................................................

126

$HP$ LIST.......................................................................................................................

127

$HP$ OPTIMIZE..............................................................................................................

127

Compatibility

directives.........................................................................................................

128

Controlling

vectorization...................................................................................................

128

Controlling parallelization.................................................................................................

129

Controlling dependence checks.........................................................................................

129

Controlling checks for side effects.......................................................................................

129

10 Migrating to HP Fortran.........................................................................

131

Incompatibilities with HP FORTRAN 77...................................................................................

131

Compiler limits................................................................................................................

131

Command-line options not supported..................................................................................

131

Format field widths...........................................................................................................

132

Floating-point constants.....................................................................................................

132

Intrinsic functions.............................................................................................................

132

Procedure calls and definitions..........................................................................................

133

Data types and constants..................................................................................................

133

Input/output....................................................................................................................

134

Directives........................................................................................................................

134

Contents 5