HP Fortran
Release Notes for Tru64 UNIX
Systems
1.10.6 Obsolete Features Deleted
1.10.6.1 GLOBAL_TO_PHYSICAL and GLOBAL_LBOUNDS are Deleted
The following obsolete HPF Local Library routines have been deleted:
- GLOBAL_TO_PHYSICAL
- GLOBAL_LBOUNDS
1.10.7 Miscellaneous
This section contains miscellaneous release notes relevant to HPF.
1.10.7.1 What To Do When Encountering Unexpected Program Behavior
This section gives some guidelines about what to do when your program
displays unexpected behavior at runtime. The two most common problems
are incorrect programs that either segmentation fault or hang at
runtime.
Before attempting to debug parallel HPF programs, it is important to
verify first that the program runs correctly when compiled without the
-wsf
command line switch.
When the problem occurs only when compiled with the
-wsf
switch, the best way to debug these programs is to execute them with the
-debug
command line switch.
In addition, programs with zero sized arrays which were compiled with
-fast
or
-assume nozsize
may behave erratically or fail to execute.
1.10.7.1.1 Incompatible or Incomplete Libraries Installed
If your program displays unexpected behavior at runtime, your system
might have incomplete or incompatible libraries installed. You must
have PSE160 installed on your system to execute programs compiled with
the
-wsf
switch. PSE180 is not sufficient. In addition, for this release, you
must have first installed PSE160. Then you must have installed Fortran
V5.2, including the HPFLIBS170 subset.
Choose one of the following options to fix an incorrect installation:
- If you have installed Fortran V5.2 but are missing PSE160, then
install PSE160. Delete the HPFLIBS170 subset of Fortran V5.2 and then
reinstall the HPFLIBS170 subset.
- If you installed Fortran V5.2 first and then PSE160, then delete
the HPFLIBS170 subset of Fortran V5.2. Next, reinstall the HPFLIBS170
subset.
- If you already have Fortran V5.2 and PSE160 installed but did not
install the HPFLIBS170 subset of Fortran V5.2, then simply install the
HPFLIBS170 subset.
- If you deleted any old PSESHPF subset after installing Fortran
V5.2, this will also cause problems. In this case delete the HPFLIBS170
subset of Fortran V5.2 and then reinstall the HPFLIBS170 subset.
- If you have installed PSE180 but not PSE160, then begin to correct
this situation by deleting PSE180. Install PSE160. Next, reinstall
PSE180. You need both PSE160 and PSE180; PSE180 must be installed last.
Finish by deleting the HPFLIBS170 subset of Fortran V5.2 and then
reinstalling the HPFLIBS170 subset.
For more information about installing PSE160, see the Compaq
Parallel Software Environment Release Notes, Version 1.6.
For more information about installing PSE180, see the Compaq
Parallel Software Environment Release Notes, Version 1.8.
1.10.7.1.2 Segmentation Faults
When a program segmentation faults at runtime it can be confusing
because it may look like the program executed, even though no output is
produced. The PSE does not always display an error message when the
return status of the executed program is non zero. In particular, if
the program segmentation faults it does not display an error message,
the program just stops. In this example, program "bad" gets a
segmentation fault at runtime.
To see the execution status, type this
csh
command (other shells require different commands):
A status of
-117
indicates a segmentation fault. See the section about known problems in
the Parallel Software Environment (PSE) Version 1.6 release notes.
Alternatively, you can run the program in the debugger. This is better
because it shows what went wrong on each peer. To do this, use the
-debug
command line switch.
See Chapter 9 of the DIGITAL High Performance Fortran 90 HPF and PSE Manual for more information.
Note that some correct programs may segmentation fault at runtime due
to lack of stack space and data space. See Section 1.10.7.2 for further
details.
1.10.7.1.3 Programs that Hang
If your program hangs at runtime, rerun it in the debugger. You can type
<ctrl>/c
in the debugger to get it to stop. Then look at the stack frames to
determine where and why the program is hanging. Programs can hang for
many reasons. Some of the more common reasons are:
- Incorrect or incorrectly-spelled HPF directives
- Incorrect usage of extrinsic routines
- Templates not large enough
- Incorrect interfaces
- Missing interface blocks
- Allocatables aligned incorrectly
- Arrays aligned outside of template bounds
- Exceeding the available stack or data space (see Section 1.10.7.2)
It is always best to compile, run, and debug the program without the
-wsf
switch first to verify program correctness. Since it is easier to debug
scalar programs than parallel programs, this should always be done
first.
1.10.7.1.4 Programs with Zero Sized Arrays
Programs with zero sized arrays should not be compiled with the
-fast
or the
-assume nozsize
command line options; see Chapter 8 in the DIGITAL High Performance Fortran 90 HPF and PSE Manual. If you
incorrectly compile this way there are several different types of
behavior that might occur. The program might return an error status of
-122
or
-177
or
64
. It might also hang (or timeout when the
-timeout
switch is used). Try compiling the program without these options and
execute it to see if it works correctly. If it does, there is most
likely a zero-sized array in the program.
1.10.7.2 Stack and Data Space Usage
Exceeding the available stack or data space on a processor can cause
the program execution to fail. The failure takes the form of a
segmentation violation, which results in an error status of -117. (See
the section about known problems in the Parallel Software Environment
(PSE) Version 1.6 release notes.) This problem can often be corrected
by increasing the stack and data space sizes or by reducing the stack
and data requirements of the program. The following
csh
commands increase the sizes of the stack and data space up to system
limits (other shells require different commands):
limit stacksize unlimited
limit datasize unlimited
|
If your system limits are not sufficient, contact your system
administrator, and request that
maxdsiz
(the data space limit) and/or
maxssiz
(the stack limit) be increased.
1.10.7.3 Non-"-wsf" main programs
The ability to call parallel HPF subprograms from non-parallel (Fortran
or non-Fortran) main programs, is supported in this release. For more
information, see Chapter 6 of the DIGITAL High Performance Fortran 90 HPF and PSE Manual.
1.10.7.4 Using "-std" Disables HPF Directive Checking
Normally, all HPF directives are checked for syntactic and semantic
correctness regardless of whether or not the
-wsf
switch is specified. To disable this checking, specify the
-std
option.
1.10.7.5 Use the Extended Form of HPF_ALIGNMENT
Due to an anomaly in the High Performance Fortran Language
Specification, the extended version of the HPF_ALIGNMENT library
routine (High Performance Fortran Language Specification V.2
Section 12.2) is incompatible with the standard version (High
Performance Fortran Language Specification V.2 Section 7.7).
In particular, the DYNAMIC argument, which is valid only in the
extended version, is not the final argument in the argument list.
Because each compiler vendor must choose to implement only one version
of this library routine, programs that use this routine are not
portable from one compiler to another unless keywords are used for each
of the optional arguments.
Compaq chooses to support the extended version of this library routine.
1.10.7.6 EXTRINSIC(SCALAR) Changed to EXTRINSIC(HPF_SERIAL)
EXTRINSIC(SCALAR) was renamed to EXTRINSIC(HPF_SERIAL) to be compatible
with Versions 1.1 and later of the High Performance Fortran
Language Specification. EXTRINSIC(SCALAR) continues to be
supported in this release, but may not be supported in future releases.
1.10.8 Example Programs
The
/usr/examples/hpf
directory contains example Fortran programs. Most of these programs are
referred to in the HPF Tutorial section of the DIGITAL High Performance Fortran 90 HPF and PSE Manual. Others
are just there to show examples of HPF code and PVM code. The provided
makefile can be used to compile all these programs.
-
heat_example.f90
solves a heat flow distribution problem. It is referred to by the
Solving Nearest Neighbor Problems section of the DIGITAL High Performance Fortran 90 HPF and PSE Manual.
-
io_example.f90
implements a network striped file. It is referred to by the Network
Striped Files chapter of the DIGITAL High Performance Fortran 90 HPF and PSE Manual. This program is a good
example of how to use EXTRINSIC(HPF_LOCAL) routines.
-
lu.f90
implements a LU Decomposition. It is referred to by the LU
Decomposition chapter of DIGITAL High Performance Fortran 90 HPF and PSE Manual.
-
mandelbrot.f90
visualizes the Mandelbrot Set. It is referred to by the HPF Tutorial.
This program uses the PURE attribute and non-Fortran subprograms within
an HPF program. Mandelbrot also requires these files:
simplex.h, simplex.c
, and
dope.h
. Read the
readme.mandelbrot
file to see how to compile and execute Mandelbrot.
-
pi_example.f90
calculates pi using four different Fortran 90 methods. This program
contains a timing module which may be pulled out and used separately.
-
shallow.f90
is a optimized HPF version of the Shallow Water benchmark.
-
twin.f90
demonstrates Compaq Fortran's new non-wsf main program capability.
-
hpf_gexample.f
is a Fortran program with explicit calls to PVM. It demonstrates some
group and reduction operations in PVM. You must have PVM installed to
run this program.
-
hpf.tcl
is a TK-based HPF data distribution learning aid. It illustrates the
data distribution patterns represented by various data distributions,
such as (BLOCK, *), (*, CYCLIC), (BLOCK, CYCLIC), etc.
-
fft.f90
performs a fast Fourier transform, achieving parallelism by means of
EXTRINSIC(HPF_LOCAL) routines.
1.11 New Features and Corrections in Version 5.1
Version 5.1 is a major release that includes corrections to problems
discovered since Version 5.0 was released.
The following topics are discussed:
1.11.1 Version 5.1 New Features
The following new Compaq Fortran (DIGITAL Fortran 90) features are now
supported:
- DIGITAL Fortran 90 on UNIX contains full support for OpenMP. Here
are some details from the OpenMP web site (http://www.openmp.org).
The OpenMP application program interface (API) supports
multi-platform shared-memory programming on UNIX platforms and
Microsoft Windows NT architectures. Jointly defined by a group of major
computer hardware and software vendors, OpenMP is a portable, scalable
model that gives shared-memory programmers a simple and flexible
interface for developing parallel applications for platforms ranging
from the desktop to the supercomputer.
For more information on the
OpenMP Fortran API, see the revised user manual.
The following
directives in OpenMP are supported by DIGITAL Fortran 90 Version 5.1:
- !$OMP PARALLEL and !$OMP END PARALLEL
- !$OMP DO and !$OMP END DO
- !$OMP SECTIONS and !$OMP END SECTIONS and !$OMP SECTION
- !$OMP SINGLE and !$OMP END SINGLE
- !$OMP PARALLEL DO and !$OMP END PARALLEL DO
- !$OMP PARALLEL SECTIONS and !$OMP END PARALLEL SECTIONS
- !$OMP MASTER and !$OMP END MASTER
- !$OMP CRITICAL [(name)] and !$OMP END CRITICAL [(name)]
- !$OMP BARRIER
- !$OMP ATOMIC
- !$OMP FLUSH
- !$OMP ORDERED and !$OMP END ORDERED
- !$OMP THREADPRIVATE
The following clauses on directives in OpenMP are supported by
DIGITAL Fortran 90 Version 5.1:
- IF (exp)
- PRIVATE(list)
- SHARED(list)
- DEFAULT (PRIVATE | SHARED | NONE)
- FIRSTPRIVATE(list)
- LASTPRIVATE(list)
- REDUCTION({operator | intrinsic} : list)
- COPYIN(list)
- SCHEDULE(type[,chunksize])
- ORDERED
- The following new features are now supported:
- As of DIGITAL UNIX v4.0, constants in Fortran code are placed in
read-only memory. An attempt to modify a constant (as in the example
below) has always been an error but will now cause the program to abort:
CALL F (1)
...
SUBROUTINE F (I)
I = 2
|
- A change in the math library (
libm
) starting with DIGITAL UNIX v4.0B is that
MOD(3.0,0.0)
now returns "floating invalid"; it used to return "0".
- Several new intrinsics are now available in DIGITAL Fortran 90. For
more details, see the online Fortran 90 help file, located in:
/usr/lib/cmplrs/fort90/decfortran90.hlp
|
- ASM - execute in-line assembler code
- LEADZ and TRAILZ - count leading and trailing 0 bits in an integer
- POPCNT - count 1 bits in an integer
- POPPAR - parity of the bits in an integer
- MULT_HIGH - multiply two 64-bit unsigned integers
- The X-Open Standard followed by DIGITAL UNIX made a change to its
"pow" function that affects Fortran's "**" operation: (0.0)**Y for all
negative values of Y {single or DOUBLE PRECISION} will now return
"-Infinity" (using
-fpe3
); it used to return "+Infinity".
- The following new
f90
command options are now supported:
-
-align recnbyte
Requests that fields of records and components of derived types be
aligned on the smaller of:
- The size byte boundary (N) specified (N is 1, 2,
4, or 8)
- The boundary that will naturally align them
Specifying
-align recnbyte
does not affect whether common blocks are naturally aligned or packed.
-
-altparam
Specifies if the alternate form of parameter constant declarations
(without parenthesis) is recognized. The default is
-altparam
.
-
-assume minus0
Tells compiler to use Fortran 95 standard semantics for the
treatment of the IEEE® floating value -0.0 {of all KINDs}. There
are two places where Fortran 95 defines behavior on -0.0:
- SIGN (data, -0.0) is "data" with a negative sign, whereas the
Fortran 90 standard says SIGN (data, -0.0) is the same as SIGN (data,
+0.0) which is "data" with a positive sign
- Fortran 95 says that -0.0 prints as "-0.0", whereas Fortran 90 says
it prints as "0.0"
-assume nominus0
is the default {this is a change from DIGITAL Fortran 90 V5.0} and
means that SIGN (data, -0.0) is the same as SIGN (data, +0.0) {the
Fortran 90 and FORTRAN 77 standard semantics}
The
f95
command driver adds "
-assume minus0
" to the compiler command line (before any other options) so the
f95
command will get the Fortran 95 standard semantics.
-
-check omp_bindings
Provides run-time checking to enforce the OpenMP binding rules:
- It is an error to enter a DO, SINGLE, or SECTIONS if you are
already in a work-sharing construct, a CRITICAL SECTION, or a MASTER.
- It is an error to attempt to execute a BARRIER if you are already
in a work-sharing construct, a CRITICAL SECTION, or a MASTER.
- It is an error to attempt to execute a MASTER directive if you are
already in a work-sharing construct.
- It is an error to execute an ORDERED directive if you are already
in a CRITICAL SECTION.
- It is an error to execute an ORDERED directive unless you are
already in an ORDERED DO.
The default is
-check noomp_bindings
:
-
-omp
implies
-check omp_bindings
-
-fast -omp
implies
-check noomp_bindings
, regardless of the placement of
-fast
- If the user wants the checking done on
-mp
, specify
-check omp_bindings
explicitly
At run-time, the errors in example program
t.f
trigger an ASSERTION error and the program aborts:
Example program t.f:
real b(100)
x = 0
!$omp paralleldo
do i= 1, 100
b(i) = i
!$omp single
x = x + 1
!$omp end single
end do
print *, b, x
end
> f90 -omp t.f
> a.out
forrtl: severe (145): assertion error
|
-
-module directory
Requests that the compiler create module files in the specified
directory instead of the current directory.
-
-omp
Enables recognition of OpenMP directives.
-
-std95
Enables Fortran 95 standards checking (
-std90
or
-std
enable Fortran 90 standards checking).
-
-warn truncated_source
Requests that the compiler issues a warning diagnostic message
when it reads a source line with a statement field that exceeds the
maximum column width in fixed-format source files. The maximum column
width for fixed-format files is column 72 or 132, depending whether the
-extend_source
option was specified.
This option has no effect on truncation;
lines that exceed the maximum column width are always truncated.
This option does not apply to free-format source files. The default is
-warn notruncated_source
.
- Additional support has been provided for directed parallel
processing using the
-omp
and
-mp
options.
For more information on the parallel directives, see the
Compaq Fortran User Manual for Tru64 and Linux Alpha Systems.
To allow task-local thread storage, you must be using Version 4.0D
(code name PTmin) of the DIGITAL UNIX operating system.
The
following problem in the use of
-omp
and
-mp
parallel directives should be noted:
In the following example
test.f
, the user should add "firstprivate(k,m)" to initialize the private
variables k and m for use in the loop control expressions.
Example test.f:
dimension x(10)
k = 1
m = 10
!$omp parallel
!$omp do private(k,m)
do i = k,m
x(i) = i
enddo
!$omp end parallel
print *, x
end
> f90 -omp test.f
f90: Warning: test.f, line 8: Variable K is used before its value has been
defined
do i = k,m
------^
f90: Warning: test.f, line 8: Variable M is used before its value has been
defined
do i = k,m
------^
|
- The following Fortran 95 features are have been implemented in
Version 5.1:
- Zero-length formats
On output, when using I, B, O, Z, and F
edit descriptors, the specified value of the field width can be zero.
In such cases, the compiler selects the smallest possible positive
actual field width that does not result in the field being filled with
asterisks (*).
- The command-line options
-assume minus0
and
-std95
(described previously in this section).
1.11.2 Version 5.1 Corrections
Since Version 5.0, the following corrections have been made:
- Using ASSOCIATED with f90 pointer now gives correct answer.
- Using vector subscripts in MATMUL now gives correct answer.
- Passing %REF argument to a routine with explicit INTERFACE no
longer gets an internal error.
- CSHIFT of an array pointer contained within a derived type no
longer gets an internal error.
- Compiling files that contain very long routine names with
-v
no longer gets an internal error.
- Using assignments in a defined generic assignment subroutine when
the subroutine is not RECURSIVE now gets an error.
- Parameter constant is allowed as argument of a LOC intrinsic.
- Using UNION within derived type now gets correct result.
- Having EQUIVALENCEd character array elements within a MODULE no
longer gets internal error.
- Duplicate SAVE statement no longer gets an error.
- Parameter constant can be used as case-value in a SELECT CASE
statement.
- ALIAS attribute can now be specified in a cDEC$ ATTRIBUTE directive
for a variable that has not been declared EXTERNAL (EXTERNAL is
assumed).
- Interface with optional function argument is now resolved properly.
- Using record fields in multiply and add operations now produces
correct result.
- Using the following operators: ==, /=, <, >, <=, and >=
no longer get non-standard conforming warnings.
- Extra trailing blanks are now allowed and ignored when used in
specifier of OPEN statement, e.g., FORM='formatted '.
- Passing an array argument to a statement function now gets an error.
- INTEGER*2 array now gets correct result when compiled with
-integer_size 16
.
- Fix a bug related to module importing with modules that contain
PRIVATE statement.
- Parameter constant defined in a MODULE is now imported when its use
is only in a variable format expression.
- C attribute can be specified in a cDEC$ ATTRIBUTE directive for
module variables.
- Parameter constants are allowed in a structure constructor.
- A derived type component having the same name as a common block no
longer gets an internal error.
- IVDEP directive can be specified between PDO and DO statements.
- A non-standard warning is issued if the first argument of a GENERIC
assignment procedure is not INTENT(OUT) or INTENT(INOUT).
- $PACK directive and the
-align recnbyte
option now affect alignment of data items in a SEQUENCE derived-type.
- Using a structure constructor to initialize a multi-dimensional
array component of a derived-type no longer causes an internal error.
- Fix $omp parallel copyin (/common_block/) directive.
- The
-fpconstant
option now works correctly for assignment to double complex variables.
- Having a D line as the first non-comment line after a conditional
$ENDIF directive no longer gets an error.
- No longer flag ES format as non-standard.
- Remove an internal limit on the number of entries of a NAMELIST
- Using substring of a character array as argument of ICHAR intrinsic
no longer gets internal error
- Pointer assignment of an array of character substrings now gets
correct result. For example:
p=>a(:)(2:4)
)
- Using array transformation intrinsics such as PACK, SPREAD, and
RESHAPE with array of derived-type as argument in a PRINT statement now
gets correct results
- Allow an array with a name of TYPE
- Specifying $NOFREEFORM in a .f90 file now sets the line size to 72
columns
- Remove a limit of 256 number of arguments for subroutines and
functions
- An incorrect statement: "IF (ABS(I).GT 1) I=0" now gets an error
message
- An incorrect statement: "CHARACTER(LEN=1), PARAMETER :: CPSCLR = ''
''" now gets an error message
- Using record fields in multiply and subtract operations now
produces correct results
- Having a PRIVATE, EQUIVALENCE variable in a module no longer causes
compile time segmentation violation
- Specifying ONLY on one variable in a COMMON block now only declares
the one variable (not the entire variables) in the COMMON block
- Allow user-defined operator to be used as the format character
expression in a PRINT or READ statement
- Using modules and the AUTOMATIC statement in the same routine no
longer gets internal error
- Module variables with EXTERN attributes now work properly
- Increase an internal limit so that large programs no longer get the
"text handle table overflow" message
- Using record fields in exponentiation and subtract operations now
produce correct result
- Flag incorrect usage of an entry dummy argument in an executable
statement before its declaration in the entry statement
- Disallow optional return dummy argument following other OPTIONAL
dummy arguments
- An invalid WRITE statement no longer gets an internal error
- Allow passing NULL intrinsic function as argument to other routines
- Allow AUTOMATIC variables to be used in an EQUIVALENCE statement
- Using a structure constructor with scalar value to assign an array
element now produces correct result
- Using an array constructor with integer value to initialize a real
or complex array now produces correct result
- Flag common block name and routine name conflict
- Fix elemental character function with varying length
- Fix problem where
-assume dummy_aliases
wasn't being taken into account in checks for overlap in array
assignment.
- If !DEC$ ATTRIBUTES C is specified in an INTERFACE block, and an
argument is declared as having an array type, always pass that argument
by reference even if the actual argument is a single array element.
- Allow a concatenation expression as the first argument to TRANSFER.
- Implement
-std90
and
-std95
options.
- A STRUCTURE with no fields no longer causes a compiler failure.
- No longer issue standards warning for certain cases with a
relational operator followed by a unary minus.
- Do not give spurious "more variables than values" warning for
certain cases of data initialization of multi-dimensional arrays.
- User-defined generic interface for IDATE no longer causes internal
compiler error.
- LOC(funcname) as an actual argument when used inside function
"funcname" now properly returns the address of the return value
variable and not the entry point.
- The compiler no longer gives spurious errors (including internal
compiler failures) in certain cases where a module file cannot be
opened.
- Certain incorrect programs which include a reference to fields of
an undeclared STRUCTURE no longer cause an internal compiler error.
- Give error when ALLOCATED is used on a non-ALLOCATABLE object.
- Allow a recursive function name to be passed as an actual argument
inside the function.
- If an INCLUDE file includes a directive to change the source form,
revert to the original setting after returning to the including source
file.
The following limitations were fixed in Version 2.0 or
previous releases:
- The
f90
command option
-wsf
and its related options are now supported.
- Allocatable arrays that are allocated but not deallocated before
routine exit are now deallocated upon exit from routine.
- The
f90
command options
-cord
and
-feedback
described in the documentation have now been implemented.
1.11.3 HPF Version 5.1 New Features
1.11.3.1 SHADOW Directive Now Supported
The new SHADOW directive, as defined in Version 2.0 of the High
Performance Fortran Language Specification, is now supported.
SHADOW is now a separate HPF directive, rather than a keyword inside
the DISTRIBUTE directive.
1.11.3.2 Pointers Now Handled in Parallel
Mapped variables with the POINTER attribute are now handled in
parallel. This capability is an approved extension of the High
Performance Fortran Language Specification.
1.11.3.3 SHADOW Directive Required for Nearest-Neighbor POINTER or TARGET Arrays
The compiler will not generate shadow edges automatically for
arrays with the POINTER or TARGET attributes. In order to be eligible
for the compiler's nearest-neighbor optimization, POINTER or TARGET
arrays must explicitely be given shadow edges using the SHADOW
directive. If pointer assignment is done, both the POINTER and the
TARGET must have the same mapping, including shadow edges.
For More Information:
- On the conditions that must be satisfied for a statement to be
eligible for the nearest-neighbor optimization, see Section 1.10.1.4 of
these Release Notes.
1.11.3.4 Descriptive Mapping Directives are Now Obsolescent
In Version 1 of the HPF Language Specification, a special form of the
DISTRIBUTE and ALIGN directives was used in interfaces and procedures
when mapped arrays were passed to a procedure. Known as
descriptive mapping, it was specified by an asterisk (*)
appearing before the left parenthesis "(" in a DISTRIBUTE
directive, or after the WITH in an ALIGN directive. For example,
!HPF$ DISTRIBUTE R*(BLOCK, BLOCK)
!HPF$ ALIGN S WITH *R
|
Beginning with version 2.0 of the High Performance Fortran Language
Specification (DIGITAL Fortran 90 Version 5.0), the meaning of
descriptive syntax has changed. Descriptive mapping is now a weak
assertion that the programmer believes that no data communication is
required at the procedure interface. If this assertion is wrong, the
data communication will in fact occur.
Although there is now no semantic difference between the descriptive
form and the ordinary prescriptive form, there is still some benefit in
using the descriptive form. Compaq Fortran generates informational
messages when a descriptive directive is specified if the compiler is
unable to confirm that there will in fact be no communication. These
messages can uncover subtle programming mistakes that cause performance
degradation.
Existing programs with descriptive mapping directives will continue to
compile and run with no modification.
In the future, DIGITAL may provide a command-line option that specifies
that descriptive directives be treated as strong assertions that data
communication will not be necessary at the procedure interface. This
would allow the compiler to omit checking whether the mappings of the
actual and dummy agree, leading to performance improvement in some
cases.
1.11.3.5 New support for HPF Local Library Routines GLOBAL_LBOUND and GLOBAL_UBOUND
The following HPF Local Library routines are now supported:
- GLOBAL_LBOUND
- GLOBAL_UBOUND
1.11.3.6 REDUCTION Clause in INDEPENDENT Directives
The REDUCTION clause in INDEPENDENT directives is now supported.
1.11.3.7 HPF_SERIAL Restriction Lifted for Procedures Called from INDEPENDENT DO Loops
Previous versions required procedures called from inside INDEPENDENT DO
loops to HPF_SERIAL in order to obtain parallel execution. This
restriction is now lifted.
For More Information:
- On the requirements for parallel execution of INDEPENDENT DO loops
containing procedure calls, see Section 1.10.5.6 of these Release Notes.
1.11.4 HPF Version 5.1 Corrections
This section lists problems in previous versions that have been fixed
in this version.
- Some bugs in implementing whole structure references in IO and
assignment were fixed.
- Aligning components of derived types is now supported.
- The restriction that statements with scalar subscripts are not
eligible for the nearest-neighbor optimization is now removed.
Statements with scalar subscripts may now be eligible for the
nearest-neighbor optimization if that array dimension is (effectively)
mapped serially.
- Nearest-neighbor assignments with derived types are now eligible
for the nearest-neighbor optimization.
1.12 New Features and Corrections in Version 5.0
Version 5.0 is a major release that also includes corrections to
problems discovered since Version 4.1 was released.
The following topics are discussed:
1.12.1 Version 5.0 New Features
The following new Compaq Fortran (DIGITAL Fortran 90) features are now
supported:
- The
-mp
compiler option enables parallel processing using directed
decomposition. Parallel processing is directed by inserting !$PAR
directives in your source code. This type of parallel processing is for
shared memory multiprocessor systems.
To enable parallel processing
across clusters of servers or workstations with !HPF$ directives,
continue to use the
-wsf
compiler option.
On a shared memory system, you can use both the
-mp
and the
-wsf
options for the same program. This combination provides improved
performance for certain programs running mostly on shared memory
systems.
The new parallel directives:
- Use the !$PAR prefix
- Are recognized only if compiled with the
-mp
option
- Some of the parallel !$PAR directives include:
PARALLEL and END PARALLEL
PDO
PARALLEL DO
PSECTIONS
CRITICAL SECTION
TASK COMMON
- Environment variables control the run-time behavior. For example,
MP_THREAD_COUNT specifies how many threads to create.
To allow task-local thread storage, you must be using Version 4.0D
(code name PTmin) of the DIGITAL UNIX operating system.
For more
information on these directives, see the Compaq Fortran User Manual
for Tru64 UNIX and Linux Alpha Systems.
- The
-warning_severity keyword
compiler option allows you to:
- Specify
-warning_severity errors
to make all compiler warning messages error-level instead of
warning-level messages.
- Specify
-warning_severity stderrors
to make standards checking compiler warning messages (
-std
option) error-level instead of warning-level messages.
- The
-warn nogranularity
compiler option allows you to suppress the NONGRNACC warning message:
Unable to generate code for requested granularity
.
- An internal procedure can now be used as an actual argument.
- Support for certain new language extensions for compatibility with
Compaq Visual Fortran (and Microsoft® Fortran PowerStation). These
features include the following:
- # Constants--constants using other than base 10
- C Strings--NULL terminated strings
- Conditional Compilation And Metacommand Expressions ($define,
$undefine, $if, $elseif, $else, $endif)
- $FREEFORM, $NOFREEFORM, $FIXEDFORM--source file format
- $INTEGER, $REAL--selects size
- $FIXEDFORMLINESIZE--line length for fixed form source
- $STRICT, $NOSTRICT--F90 conformance
- $PACK--structure packing
- $ATTRIBUTES ALIAS--external name for a subprogram or common block
- $ATTRIBUTES C, STDCALL--calling and naming conventions
- $ATTRIBUTES VALUE, REFERENCE--calling conventions
- \ Descriptor--prevents writing an end-of-record mark
- Ew.dDe and Gw.dDe Edit Descriptors--similar to Ew.dEe and Gw.dEe
- 7200 Character Statement Length
- Free form infinite line length
- $DECLARE and $NODECLARE == IMPLICIT NONE
- $ATTRIBUTES EXTERN--variable allocated in another source file
- $ATTRIBUTES VARYING--variable number of arguments
- $ATTRIBUTES ALLOCATABLE--allocatable array
- Mixing Subroutines/Functions in Generic Interfaces
- $MESSAGE--output message during compilation
- $LINE == C's #line
- INT1 converts to one byte integer by truncating
- INT2 converts to two byte integer by truncating
- INT4 converts to four byte integer by truncating
- COTAN returns cotangent
- DCOTAN returns double precision cotangent
- IMAG returns the imaginary part of complex number
- IBCHNG reverses value of bit
- ISHA shifts arithmetically left or right
- ISHC performs a circular shift
- ISHL shifts logically left or right
The following new High Performance Fortran (HPF) features and
corrections have been added for DIGITAL Fortran Version 5.0:
- The new SHADOW directive, as defined in Version 2.0 of the HPF
specification, is now supported. SHADOW is now a separate HPF
directive, rather than a keyword inside the DISTRIBUTE directive.
- Mapped variables with the POINTER attribute are now handled in
parallel. This capability is an approved extension of the HPF
specification.
- Beginning with version 2.0 of the HPF specification (DIGITAL
Fortran Version 5.0), the meaning of descriptive syntax has changed.
Descriptive mapping is now a weak assertion that the programmer
believes that no data communication is required at the procedure
interface. If this assertion is wrong, the data communication will in
fact occur.
Existing programs with descriptive mapping directives
will continue to compile and run with no modification and no
performance penalty.
- The following HPF Local Library routines are now supported:
- GLOBAL_LBOUND
- GLOBAL_UBOUND
- The REDUCTION clause in INDEPENDENT directives is now supported.
- Previous versions required procedures called from inside
INDEPENDENT DO loops to HPF_SERIAL in order to obtain parallel
execution. This restriction is now lifted.
- Some bugs in implementing whole structure references in IO and
assignment were fixed.
- Aligning components of derived types is now supported.
- The restriction that statements with scalar subscripts are not
eligible for the nearest-neighbor optimization is now removed.
Statements with scalar subscripts may now be eligible for the
nearest-neighbor optimization if that array dimension is (effectively)
mapped serially.
- Nearest-neighbor assignments with derived types are now eligible
for the nearest-neighbor optimization.
1.12.2 Version 5.0 Corrections
Since Version 4.1, the following corrections have been made:
- Fix SIGN intrinsic to handle --0.
- Fix LOC intrinsic and %LOC of a derived type field.
- Fixed debug information for dynamic character variable (such as
character*(i) c
).
- Add debugging support for integer (Cray) pointers.
- Fix storing to the return value of a function returning character
in a containing internal routine.
- Fix Nullification of a character*n pointer argument.
- Fix using passed length argument in a containing internal routine.
- Fix compiler abort when a source line is longer than 1024
characters in freeform source file.
- Fix using IOLENGTH in a INQUIRE statement.
- Fix FORALL problem of the form "
X(X(I)) =
."
- Fix contained functions returning an implicitly initialized
derived-type.
- Better diagnostics for invalid programs.
- Fix compiler abort when using Nullification of a pointer in a
MODULE.
- Fix a certain type of USE of a MODULE with rename list.
- Fix using
-extend_source:80
and
-pad_source
.
- Fix compiler abort when using do-loop style implicitly initialized
derived-types in a MODULE.
- Sign-extending INTEGER*2 parameter constants.
- Flag invalid nested internal procedures.
- Fix compiler abort of USE of a MODULE with namelist variables in
rename list.
- Issue a warning message for a intrinsic with wrong argument type
and treat it as an external.
- Issue a warning message for having a SAVE common block data object.
- Fix compiler abort of USE of a MODULE with namelists.
- Fix using SIZEOF(common_block_array) in a PARAMETER statement.
- Fix using READONLY keyword as first keyword in an OPEN statement.
- Allow record name to be the same as a structure name.
- Fix parameter character constant with embedded NULL character.
- Fix compiler abort when same name used as a structure and derived
type.
- Allow BLOCKSIZE keyword in an INQUIRE statement.
- Allow a record in a SAVE statement.
- Allow a module to have the name "procedures".
- Do not flag IABS intrinsic function as nonstandard.
- Do not flag DOUBLE COMPLEX as nonstandard.
- Treat POPCNT, POPPAR, LEADZ as external functions.
- Put out an error message for
ptr => pack(...)
.
- Treat C$DOACROSS as a comment.
- Issue an error message for invalid derived type parameter constant.
- Fix compiler abort when passing an array constructor as an actual
argument.
- Fix using derived-type components that are same as intrinsic names.
- Fix an incorrect warning about "explicit-shaped array is being
passed to a routine that expects a pointer or assumed-shape array".
- Fix a problem with
-warn:errors
and
-stand:f90
options. Nonstandard messages should be error messages.
- Fix incorrect results when compiled a program with
-assume:dummy_aliasing
.
- Do not flag BOZ constant as nonstandard.
- Do not flag Z format as nonstandard.
- Allow 511 continuation lines.
- Put out a standard warning for using character constant in DATA
statement.
- Fix using TRANSFER in initialization.
- Fix a problem with user defined assignment statement.
- Issue an error message when passing or receiving an optional
argument by value.
- Fix an invalid message about return value of a function is not
defined when the function returns an initialized derived type.
- Fix a compiler abort with "text handle table overflow" message.
- Fix a compiler abort using a SAVE statement.
- Fix a problem when an existing operator is overloaded.
- Fix argument checking of intrinsic subroutines.
- Fix generic interface of elemental functions.
- Issue an argument mismatch warning message for using an integer
with a statement function that takes real argument.
- Fix compiler directives processing.
- Fix a compiler abort using an invalid PARAMETER array.
- Issue an error message for SAVE of an ENTRY result variable.
- Fix using UNION within derive type.
- Fix a compiler internal error when using C and REFERENCE attributes
on a function name.
- Fix a compiler internal error when using ASSOCIATED of a function
returning a pointer.
- Add support for passing complex by value.
- Fix pointer assignment with a character substring.
- Allow using ICHAR in an array constructor within the initialization
part of an array declaration.
- Fix a problem with using UNION declaration within the derived type.
- Allow exporting of a module procedure which has a name that is the
same as a generic name.
- Fix a problem with using user defined assignment operation.
- Allow specifying NaNs in the PARAMETER statement.
- Allow D source line to continue a non-D source line.
- Fix a problem in array initialization processing.
- Cray pointees that were being allocated statically are now
correctly given no storage class.
- Using assume shape array within a contained routine no longer
produces an internal compiler error.
- An error message is now given for invalid keyword values given for
an I/O statement's keyword.
- Declarations of the type "character, allocatable :: field*7(:)", in
which the array shape specifier comes after the length specification in
a deferred-shape character array no longer produces an internal
compiler error.
- When assigning a derived type variable with a structure
constructor, if a character scalar is supplied to an character array
component, every elements of the array is assigned with the character
scalar value.
- The MVBITS intrinsic now gives correct result if its 4th argument
is a non-lowerbound subscripted array element.
- Reference of a character function, where the length of its return
value is dependent on one or more of its arguments, no longer produces
an internal compiler error.
- Pointer assignment should now work properly when the target is a
component of an allocatable array with a lower bound different of 1.
- Long NAMELISTs no longer causes a compiler internal error.
- The compiler now prints out better error messages for the PDONE
directive.
- When initializing a derived type variable with a structure
constructor, if a scalar is supplied to an array component, every
elements of the array is initialized with the scalar value.
- Allow %fill in STRUCTURE declarations using F90 syntax, such as:
integer :: %fill
.
- Using unary "-" operator with record fields should now give correct
results.
- Use of NEAREST with two different KIND REAL arguments no longer
gets a nonstandard warning.
- Allow SIZEOF of assumed size record field.
- Module importing has been improved. If a module is USEd in both the
host and its internal procedure, the module is now only imported once
by the compiler.
- A module that contains "PRIVATE" followed by "PUBLIC variable" no
longer gets incorrect error message.
- Optional comma in DO with label, such as:
label: DO, JJ = 1, N, 1
no longer gets incorrect syntax error.
- Allow a dummy argument to have the same name as a structure field.
- A module that contains
USE module, ONLY : var
no longer gets internal compiler error.
- A component of a derived-type with a name that starts with FILL no
longer gets a syntax error.
- A PDONE directive in a statically-scheduled PDO loop no longer gets
an error message.
- Allow a variable with '_' in its name to be used in a variable
format expression.
- Fix for array references in CRITICAL SECTION directive.
- Set NOWAIT for paralleldo directive (the region waits, so do NOT
make the loop wait as well).
- Allow variables in COMMON/EQUIVALENCE on local, lastlocal, and
reduction lists. Create and use new local variables in parallel do
scopes for these variables.
- Allow c$copyin of EQUIVALENCE/COMMON variables.
- Fix
-mp
(ordered) bug.
- No longer import any definitions if a module is used with the "USE
module_name, ONLY:" statement.
- Fix a compile time stack overflow problem.
- Fix a "$IF DEFINED()" problem when a routine is defined between the
conditional compilation.
- Put out error message for an invalid use of "TYPE (type_name)"
statement.
- Allow RECORD in a NAMELIST.
- Fix using "# line_number" in DATA statement.
- The
-pad_source
option now properly pads Hollerith literals that are continued across
source records.
- Add standards warning for using two consecutive operators in an
expression.
- Allow POINTER attribute for character entities whose length is
specified by a variable expression or an * (assumed length character).
- Do not flag as nonstandard when all of the objects in the
EQUIVALENCE set are of type default integer, default real, double
precision, default complex, default logical, or numeric sequence type.
- Add standards warning for assignment to the host associated
variable in a PURE function.
- Add standards warning for using a dummy argument in a
specification-expr as the argument of one of the intrinsic functions
BIT_SIZE, KIND, LEN, or the numeric inquiry functions.
- Compiling BLOCK DATA with
-recursive
no longer causes a compiler internal error.
- A special usage of equivalenced variables in parallel no longer
causes a compiler internal error.
- DO loop variables are now set to be PRIVATE by default in a
parallel region.
- The scope of C$CHUNK and C$MP_SCHEDTYPE directives is restricted to
one program unit.
- Fix a bug in a special usage of passing internal procedure as
argument.
1.13 Additional Information
This section contains information that supplements the HP Fortran
documentation.
1.13.1 HP Fortran Home Page
The HP Fortran Web site is located at:
http://www.hp.com/software/fortran
|
1.13.2 Support for the Fortran 95 Standard Features
This section briefly describes the Fortran 95 language features that
have been added to Compaq Fortran:
- The FORALL statement and construct
In Fortran 95/90, you could
build array values element-by-element by using array constructors and
the RESHAPE and SPREAD intrinsics. The Fortran 95 FORALL statement and
construct offer an alternative method.
FORALL allows array
elements, array sections, character substrings, or pointer targets to
be explicitly specified as a function of the element subscripts. A
FORALL construct allows several array assignments to share the same
element subscript control.
FORALL is a generalization of WHERE.
They both allow masked array assignment, but FORALL uses element
subscripts, while WHERE uses the whole array.
Compaq Fortran
previously provided the FORALL statement and construct as language
extensions.
- PURE procedures
Pure user-defined procedures do not have side
effects, such as changing the value of a variable in a common block. To
specify a pure procedure, use the PURE prefix in the function or
subroutine statement. Pure functions are allowed in specification
statements.
Compaq Fortran previously allowed pure procedures as a
language extension.
- ELEMENTAL procedures
An elemental user-defined procedure is a
restricted form of pure procedure. An elemental procedure can be passed
an array, which is acted upon one element at a time. To specify an
elemental procedure, use the ELEMENTAL prefix in the function or
subroutine statement.
- Pointer initialization
In Fortran 95/90, there was no way to
define the initial value of a pointer or to assign a null value to the
pointer by using a pointer assignment operation. A Fortran 95/90
pointer had to be explicitly allocated, nullified, or associated with a
target during execution before association status could be determined.
Fortran 95 provides the NULL intrinsic function that can be used to
nullify a pointer.
- Derived-type structure default initialization
Fortran 95 lets
you specify, in derived-type definitions, default initial values for
derived-type components.
- Automatic deallocation of allocatable arrays
Arrays declared
using the ALLOCATABLE attribute can now be automatically deallocated in
cases where Fortran 95/90 would have assigned them undefined allocation
status.
Compaq Fortran previously provided this feature as a
language extension.
- CPU_TIME intrinsic subroutine
This new intrinsic subroutine
returns a processor-dependent approximation of processor time.
- Enhanced CEILING and FLOOR intrinsic functions
KIND can now be
specified for these intrinsic functions.
- Enhanced MAXLOC and MINLOC intrinsic functions
DIM can now be
specified for the MAXLOC and MINLOC intrinsic functions. DIM was
allowed previously as a Compaq Fortran language extension.
- Enhanced SIGN intrinsic function
The SIGN function can now
distinguish between positive and negative zero (if the processor is
capable of doing so).
- Enhanced WHERE construct
The WHERE construct has been improved
to allow nested WHERE constructs and a masked ELSEWHERE statement.
WHERE constructs can now be named.
- Comments allowed in namelist input
Fortran 95 allows comments
(beginning with !) in namelist input data. Compaq Fortran previously
allowed this as a language extension.
- Generic identifier to END INTERFACE statement
The END INTERFACE
statement of an interface block defining a generic routine now allows a
generic identifier.
- Zero-length formats
On output, when using I, B, O, Z and F edit
descriptors, the specified value of the field width can be zero (0). In
such cases, the compiler selects the smallest possible positive actual
field width that does not result in the field being filled with
asterisks.
- New obsolescent features
Fortran 95 deletes several language
features that were obsolescent in Fortran 90, and identifies new
obsolescent features:
- REAL and DOUBLE PRECISION DO variables
- Branching to an ENDIF from outside its IF
- PAUSE statement
- ASSIGN statement, assigned GOTO, and assigned FORMATs
- H edit descriptor
Compaq Fortran flags these deleted and obsolescent features, but
fully supports them.
1.13.3 Preliminary Information on Support for Big Objects
Big objects are data items whose size cannot be
represented by a signed 32 bit integer. Compaq Fortran supports larger
objects than Compaq Fortran 77.
Big objects are good for massive machines and clusters used for
numerical analysis, such as weather forecasting and high energy physics
problems. Both special knowledge and very large hardware configurations
are needed to use this feature.
Your system and its operating system must be configured to:
- Allow a very large stack space.
- Allow a very large data space.
- Allow large values for parameters, such as vm-maxvas.
- Unless huge amounts of physical memory are present, enable lazy
swapping.
- Check the size of page/swap files and create larger files if needed.
For more information, see the Compaq Tru64 UNIX system management
documentation. For Compaq Tru64 UNIX Version 4.0, you can use the
following check list:
- Either have a large swap space or use deferred swap allocation.
This involves either:
- Have more swap space than the address space used by the largest
program you want to run. The following command shows swap allocation:
- Use the deferred mode of swap allocation. The following command
displays the reference (man) page for swapon, which describes how to
change the swap allocation
- Reconfigure the UNIX kernel (for Version 4.0 or later) to change
the following parameters as desired. For example, on one system, all
values were set to 16 GB:
Parameter |
Explanation |
max-per-proc-address-space
|
Largest address space
|
max-per-proc-data-size
|
Largest data size
|
max-per-proc-stack-size
|
Largest stack size
|
vm-maxvas
|
Largest virtual-memory
|
Also set the following per-process values:
Parameter |
Explanation |
per-proc-address-space
|
Default address space
|
per-proc-data-size
|
Default data size
|
per-proc-stack-size
|
Default stack size
|
The per-process limits can be checked and increased with the
limit
or
ulimit
commands.
You can create big objects as static data, automatic data (stack), or
dynamically allocated data (ALLOCATE statement or other means).
The address space limitations depends on the Alpha processor generation
in use:
- Address space for ev4 Alpha generation processors is 2**42
- Address space for ev5 Alpha generation processors is 2**46
Although the compiler produces code that computes 63-bit signed
addresses, objects and addresses larger than the hardware limitations
will not work.
Limitations of using big objects include:
- Initializing big objects by using a DATA statement or a TYPE
declaration is not supported.
- Big objects cannot be passed by value as program arguments.
- Debug support for big objects is limited.
- I/O of entire big objects is not supported, but I/O of parts of an
array should work.
The following small example program allocates a big character object:
character xx(2_8**31+100_8)
integer*8 i
i = 10
xx(i) = 'A'
i = 2_8**31 + 100_8
xx(i) = 'B'
print *,xx(10_8)
print *,xx(i)
end
|
1.13.4 New Random Number Algorithm
A new random_number intrinsic (Version 4.0 or later) uses a different
algorithm than the one previously used.
The test program below shows the use of the random_seed and
random_number intrinsics.
program testrand
intrinsic random_seed, random_number
integer size, seed(2), gseed(2), hiseed(2), zseed(2)
real harvest(10)
data seed /123456789, 987654321/
data hiseed /-1, -1/
data zseed /0, 0/
call random_seed(SIZE=size)
print *,"size ",size
call random_seed(PUT=hiseed(1:size))
call random_seed(GET=gseed(1:size))
print *,"hiseed gseed", hiseed, gseed
call random_seed(PUT=zseed(1:size))
call random_seed(GET=gseed(1:size))
print *,"zseed gseed ", zseed, gseed
call random_seed(PUT=seed(1:size))
call random_seed(GET=gseed(1:size))
call random_number(HARVEST=harvest)
print *, "seed gseed ", seed, gseed
print *, "harvest"
print *, harvest
call random_seed(GET=gseed(1:size))
print *,"gseed after harvest ", gseed
end program testrand
|
When executed, the program produces the following output:
% testrand
size 2
hiseed gseed -1 -1 171 499
zseed gseed 0 0 2147483562 2147483398
seed gseed 123456789 987654321 123456789 987654321
harvest
0.6099895 0.9807594 0.2936640 0.9100146 0.8464803
0.4358687 2.5444610E-02 0.5457680 0.6483381 0.3045360
gseed after harvest 375533067 1869030476
|
1.13.5 Compaq Fortran 77 Pointers
Compaq Fortran 77 pointers are CRAY® style pointers, an extension
to the Fortran 90 standard. The POINTER statement establishes pairs of
variables and pointers, as described in the Compaq Fortran Language Reference Manual.
1.13.6 Extended Precision REAL (KIND=16) Floating-Point Data
The X_float data type is a little endian IEEE-based format that
provides extended precision. It supports the REAL*16 Compaq Fortran Q
intrinsic procedures. For example, the QCOS intrinsic procedure for the
generic COS intrinsic procedure.
The value of REAL (KIND=16) data is in the approximate range:
6.475175119438025110924438958227647Q-4966 to
1.189731495357231765085759326628007Q4932.
Unlike other floating-point formats, there is little if any performance
penalty from using denormalized extended-precision numbers, since
accessing denormalized numbers do not result in an arithmetic trap
(extended-precision is emulated in software). (The smallest normalized
number is 3.362103143112093506262677817321753Q-4932.)
The precision is approximately one part in 2**112 or typically 33
decimal digits.
The X_float format is emulated in software. Although there is no
standard IEEE little endian 16-byte REAL data type, the X_float format
supports IEEE exceptional values.
For more information, see the revised Compaq Fortran User Manual for Tru64 UNIX and Linux Alpha Systems and the
Compaq Fortran Language Reference Manual.
1.13.7 Variable Format Expressions (VFEs)
By enclosing an arithmetic expression in angle brackets, you can use it
in a FORMAT statement wherever you can use an integer (except as the
specification of the number of characters in the H field). For example:
For more information, see the Compaq Fortran Language Reference Manual.
1.13.8 Notes on Debugger Support
Compaq Tru64 UNIX provides both the
dbx
and the Compaq Ladebug (formerly DECladebug) debuggers in the
programming environment subsets.
These debuggers are very similar and use almost identical set of
commands and command syntax. Both have a command-line interface as well
as a Motif® windowing interface.
A character-cell Ladebug (ladebug) interface is provided with Ladebug
in the Compaq Tru64 UNIX operating system Programmer's Development
Toolkit. To use the character-cell interface, use the
ladebug
command.
When using Ladebug with certain versions of the UNIX operating system,
be aware that a trailing underscore may be needed to display module
variables. For example, to display variable X in module MOD, type:
The Parallel Software Environment supports debugging parallel HPF
programs (see the DIGITAL High Performance Fortran 90 HPF and PSE Manual). This section addresses scalar
(nonparallel) debugging.
When using the
f90
command to create a program to be debugged using
dbx
or
ladebug
, consider using the following options:
- Specify
-g
or
-g2
to request symbol table and traceback information needed for debugging.
- Avoid requesting optimization. When you specify
-g
or
-g2
, the optimization level is set to
-o0
by default. Debugging optimized code is neither easy nor recommended.
- When using the Ladebug debugger, you should specify the
-ladebug
option. The
-ladebug
option allows you to print and assign to dynamic arrays using standard
Fortran syntax.
For example, the following command creates the executable program
proj_dbg.out
for debugging with Ladebug:
% f90 -g -ladebug -o proj_dbg.out file.f90
|
You invoke the character-cell Ladebug debugger by using the
ladebug
command.
For more information, see the debugger chapter in the revised
Compaq Fortran User Manual for Tru64 UNIX and Linux Alpha Systems (Chapter 4).
1.13.8.1 Ladebug Debugger Support Notes
The following improvements in Ladebug support for the Compaq Fortran
language were added for DIGITAL UNIX Version 4.0:
- Ladebug now includes a graphical window interface.
- Ladebug now supports the display of array sections.
- Ladebug now displays Fortran data types using Fortran 90 name
syntax rather than C names (such as integer rather than int).
- Ladebug provides improved support for debugging mixed-language C
and Fortran applications.
- These and other improvements are described in the debugger chapter
(Chapter 4) of the Compaq Fortran User Manual for Tru64 UNIX and Linux Alpha Systems.
The following improvements in Ladebug support for the Fortran 90
language were added for DEC OSF/1 Version 3.2 (DECladebug V3.0-16):
- Fortran and Fortran 90 language expression evaluation is built into
the Ladebug command language, including:
- Case-insensitive identifiers, variables, program names, and so on
- Logical expressions, including:
Relational operators (.LT., .LE., .EQ., .NE., .GT., .GE.)
Logical operators (.XOR., .AND., .OR., .EQV., .NEQV., .NOT.)
- Fortran 90 pointers
- Fortran 90 array support, including:
- Explicit-shape arrays
- Assumed-shape arrays
- Automatic arrays
- Assumed-size arrays
- Deferred-shape arrays
- COMMON block support, including:
- Display of whole common block
- Display of (optionally-qualified) common block members
- COMPLEX variable support, including the display, assignment, and
use of arithmetic expressions involving COMPLEX variables
- Alternate entry points, including breakpoints, tracepoints, and
stack tracing (
where
command)
- Mixed-language debugging
For more information on using Ladebug, see the debugger chapter in the
revised Compaq Fortran User Manual for Tru64 UNIX and Linux Alpha Systems (Chapter 4).
1.13.8.2 dbx Debugger Support Notes
When using
dbx
with HP Fortran programs, certain differences exist. For example, in
dbx
, assumed-shape arguments, allocatable arrays, and pointers to arrays
are printed as a derived type. Consider the following program:
module foo
real x
contains
subroutine bar(a)
integer a(:)
a(1) = 1
end subroutine bar
end module foo
use foo
integer b(100)
call bar(b)
end
|
If the above program were stopped inside BAR, the following would occur:
(dbx) print a
common /
dim = 1
element_length = 4
ptr = 0x140000244
ies1 = 4
ub1 = 10
lb1 = 1
/
|
The meaning of the fields are:
dim - dimension of the object
element_length - the length of each element in bytes
ptr - the address of the object
iesn - distance (in bytes) between elements in the
nth dimension
ubn - upper bound in the nth dimension
lbn - lower bound in the nth dimension
1.13.9 Notes on Fast Math Library Routines
The
f90
option
-math_library fast
provides alternate math routine entry points to the following:
- SQRT, EXP, LOG, LOG10, SIN, and COS intrinsic procedures
- Power (**) in arithmetic expressions
1.13.10 The HP Fortran Array Descriptor Format
In the Compaq Fortran User Manual for Tru64 UNIX and Linux Alpha Systems, Chapter 10, Section 10.1.7 describes the Compaq
Fortran array descriptor format.
These notes are an initial attempt to provide a template for those C
programmers creating an a .h file that lays out the Fortran array
descriptor format.
There are two varying parameters for this descriptor format:
- The element type (shown in this section as <ELEMENT_TYPE> )
- The rank (shown in this section as <RANK> )
Common information for all descriptors is the general layout of the
header and the information for each dimension.
One possible C @codefont(struct) definition for the per-dimension
information is:
struct _f90_array_dim_info {
int inter_element_spacing;
int pad1;
int upper_bound;
int pad2;
int lower_bound;
int pad3;
};
|
The inter-element spacing is measured in 8-bit bytes, not in array
elements. This presents a challenge in designing array descriptor
definitions in C, since there is no completely clean way to interact
with C's pointer arithmetic.
One way to design the struct definition for an array descriptor is to
use the template:
struct _f90_array_desc_rank<RANK>_<NAME_TOKEN> {
unsigned char dim;
unsigned char flags;
unsigned char dtype;
unsigned char class;
int pad;
long length;
<ELEMENT_TYPE> * pointer;
long arrsize;
void * addr_a0;
struct _f90_array_dim_info dim_info[<RANK>];
};
|
Where <RANK>, <NAME_TOKEN> and <ELEMENT_TYPE> are the
template parameters. Often <NAME_TOKEN> and <ELEMENT_TYPE>
can be the same, but in cases where <ELEMENT_TYPE> has
non-identifier characters in it (for example, space or star) then a
suitable <NAME_TOKEN> should be devised.
The problem with this approach is that the element addressing, which
uses the inter-element spacing, generates an offset in bytes. In order
to use C's native pointer arithmetic, either casts need to be done or a
division. For example:
- Casting:
*((<ELEMENT_TYPE> *) (((char *) desc->pointer) + byte_offset))
|
- Division:
(desc->pointer)[byte_offset/sizeof(<ELEMENT_TYPE>)]
|
Another way to design the struct definition for an array descriptor is
to use the template:
struct _f90_array_desc_rank<RANK>_general {
unsigned char dim;
unsigned char flags;
unsigned char dtype;
unsigned char class;
int pad;
long length;
char * pointer;
long arrsize;
void * addr_a0;
struct _f90_array_dim_info dim_info[<RANK>];
};
|
An advantage to this approach is that the same definition can be used
for all arrays of the same rank. The problem with this approach is that
it forces the programmer to cast:
*((<ELEMENT_TYPE> *) (desc->pointer + byte_offset))
|
Another approach is to remove <RANK> from the template as well,
yielding:
struct _f90_array_desc_general {
unsigned char dim;
unsigned char flags;
unsigned char dtype;
unsigned char class;
int pad;
long length;
char * pointer;
long arrsize;
void * addr_a0;
struct _f90_array_dim_info dim_info[7];
};
|
On the last line, 7 is used since that is the maximum rank allowed by
Fortran. Since the dim field should be checked, this definition can be
used in many (perhaps most) of the places a rank-specific definition
would be used, provided the programmer is aware that the dim_info
fields beyond the actual rank are undefined.
One place such a definition should NOT be used is when an object of
this definition is used as part of an assignment. This usage is
considered rare. For example:
void
ptr_assign_buggy(struct _f90_array_desc_general * ptr,
struct _f90_array_desc_general * tgt)
{
*ptr = *tgt;
}
|
Example of Array Descriptor Format Use
In this example, we have a 'struct tree' and a procedure
prune_some_trees_() that takes a descriptor of a rank=3 array of such
structs and calls prune_one_tree_() on each individual tree (by
reference):
void
prune_some_trees(struct _f90_array_desc_general * trees)
{
if (trees->dim != 3) {
raise_an_error();
return;
} else {
int x,y,z;
int xmin = trees->dim_info[0].lower_bound;
int xmax = trees->dim_info[0].upper_bound;
int xstp = trees->dim_info[0].inter_element_spacing;
int ymin = trees->dim_info[1].lower_bound;
int ymax = trees->dim_info[1].upper_bound;
int ystp = trees->dim_info[1].inter_element_spacing;
int zmin = trees->dim_info[2].lower_bound;
int zmax = trees->dim_info[2].upper_bound;
int zstp = trees->dim_info[2].inter_element_spacing;
int xoffset,yoffset,zoffset;
for (z = zmin, zoffset = 0; z <= zmax; z+= 1, zoffset += zstp) {
for (y = ymin, yoffset = 0; y <= ymax; y+= 1, yoffset += ystp) {
for (x = xmin, xoffset = 0; x <= xmax; x+= 1, xoffset += xstp) {
struct tree * this_tree =
(struct tree *) (trees->pointer + xoffset+yoffset+zoffset);
prune_one_tree_(this_tree);
}
}
}
}
}
|
Compaq would appreciate feedback on which definitions of array
descriptors users have found most useful.
Note that the format for array descriptors used by HPF is more
complicated and is not described at this time.