| Previous | Contents |
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:
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:
$ /usr/sbin/swapon -s |
$ man swapon |
| 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 |
| Parameter | Explanation |
|---|---|
| per-proc-address-space | Default address space |
| per-proc-data-size | Default data size |
| per-proc-stack-size | Default stack size |
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:
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:
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
|
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 |
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.11.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.11.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:
J = 5 FORMAT (I<J+1>) |
For more information, see the Compaq Fortran Language Reference Manual.
1.11.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:
print $MOD$X$_ |
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:
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.11.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:
The following improvements in Ladebug support for the Fortran 90 language were added for DEC OSF/1 Version 3.2 (DECladebug V3.0-16):
Relational operators (.LT., .LE., .EQ., .NE., .GT., .GE.)
Logical operators (.XOR., .AND., .OR., .EQV., .NEQV., .NOT.)
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.11.8.2 dbx Debugger Support Notes
When using dbx with Compaq 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
The f90 option -math_library fast provides alternate math routine entry points to the following:
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:
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:
*((<ELEMENT_TYPE> *) (((char *) desc->pointer) + byte_offset)) |
(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.
This chapter summarizes the new features for Compaq Fortran Versions prior to Version 5.0:
Version 4.1 is a maintenance release that contains a limited number of new features and corrections to problems discovered since Version 4.0 was released.
For additional information added to these release notes for Version 4.1, see Section 1.11.3.
The following new features have been added for DIGITAL Fortran 90 Version 4.1:
The following new High Performance Fortran features have been added for DIGITAL Fortran 90 Version 4.1:
/usr/examples/HPF |
These new features are described in the DIGITAL High Performance Fortran 90 HPF and PSE Manual.
The corrections made for DIGITAL Fortran 90 Version 4.1 include the following:
The following are corrections for HPF users in this version:
These new corrections are described in more detail in the Parallel Software Environment (PSE) release notes.
| Previous | Next | Contents |