HP 3000 Manuals

Resolving Incompatibilities between MPE V and MPE/iX: the HP3000_16 [ HP FORTRAN 77/iX Programmer's Guide ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Programmer's Guide

Resolving Incompatibilities between MPE V and MPE/iX: the HP3000_16 

Directive

This section describes how to use the HP3000_16 compiler directive.  This
directive helps resolve some of the incompatibilities between the MPE V
and MPE/iX operating systems and architectures.  The differences between
the systems are:

   *   Data alignment

   *   Floating point data

   *   Overlapping character substring moves

This is the syntax of the HP3000_16 compiler directive:

[FFN9]
Do not use the HP3000_16 compiler directive if the application that is ported from MPE V to MPE/iX is not affected by any of the above incompatibilities. Likewise, if the application has only one of the incompatibilities, specify only the appropriate option in the directive. Table 7-2 summarizes the options. Table 7-2. HP3000_16 Directive Options -------------------------------------------------------------------------------- | | | | Option | Description | | | | -------------------------------------------------------------------------------- | | | | ON | Turns on all three options (ALIGNMENT, REALS, and | | | STRING_MOVE). | | | | -------------------------------------------------------------------------------- | | | | OFF | Turns off all three options (ALIGNMENT, REALS, and | | | STRING_MOVE). | | | | -------------------------------------------------------------------------------- | | | | ALIGNMENT | Emulates MPE V data alignment. | | | | -------------------------------------------------------------------------------- | | | | REALS | Emulates MPE V floating point data. | | | | -------------------------------------------------------------------------------- | | | | STRING_MOVE | Emulates a ripple move (which is used on MPE V) for | | | overlapping character substrings. | | | | --------------------------------------------------------------------------------
NOTE In this chapter, the term "HP3000 floating point" refers to Hewlett-Packard proprietary floating point data used on the 16-bit HP3000 systems. Floating point data used on the 32-bit HP3000 systems is IEEE standard.
The compiler options degrade performance, as described below. Because of the performance degradation, only use the options that are necessary. The ON Option This option turns on the ALIGNMENT, REALS, and STRING_MOVE options. Use the ON option only if all three options are needed. The OFF Option This options turns off the ALIGNMENT, REALS, and STRING_MOVE options. This is the default. The ALIGNMENT Option MPE V aligns noncharacter data on 16-bit boundaries and character data on 8-bit boundaries. MPE/iX aligns data on 8-, 16-, 32-, and 64-bit boundaries, depending on the data type. Table 7-3 shows the corresponding data alignments. Table 7-3. Data Alignment on MPE V and MPE/iX ------------------------------------------------------------------------------------ | | | | | Alignment | MPE V | MPE/iX | | | | | ------------------------------------------------------------------------------------ | | | | | 8-bit | CHARACTER | CHARACTER, LOGICAL*1, BYTE | | | | | ------------------------------------------------------------------------------------ | | | | | 16-bit | COMPLEX*8, COMPLEX*16, | INTEGER*2, LOGICAL*2 | | | INTEGER*2, INTEGER*4, | | | | LOGICAL*2, LOGICAL*4, REAL*4, | | | | REAL*8 | | | | | | ------------------------------------------------------------------------------------ | | | | | 32-bit | | COMPLEX*8 INTEGER*4, | | | | LOGICAL*4, REAL*4 | | | | | ------------------------------------------------------------------------------------ | | | | | 64-bit | | COMPLEX*16, REAL*8, REAL*16 | | | | | ------------------------------------------------------------------------------------ Use the ALIGNMENT option if your application assumes MPE V data packing for common and equivalence data or if the application makes calls to database intrinsics. Alternatively, the application can be modified to use MPE/iX alignment. The following is an example of an equivalence structure that assumes 16-bit data alignment: INTEGER*2 int_array(10) INTEGER*4 var1, var2 EQUIVALENCE (var1, int_array(2)), (var2, int_array(5)) Figure 7-1 shows how the structure is stored in memory on the MPE V system.
[FFN10]
Figure 7-1. MPE V Structure Figure 7-2 shows how the structure is stored in memory on the MPE/iX system.
[FFN11]
Figure 7-2. MPE/iX Structure Because the INTEGER*2 (2-byte) and INTEGER*4 (4-byte) integers are stored on 16-bit boundaries on the MPE V system, the above EQUIVALENCE statement is not a problem (as shown in Figure 7-1 ). However, on MPE/iX, the compiler will have trouble aligning the variable var1 on the array int_array(2) because var1 should be 32-bit aligned and int_array(2) is on a 16-bit boundary. At this point, the compiler shifts the array int_array 16 bits so that it can align the variable var1 on a 32-bit boundary. However, now the variable var2 is not aligned on a 32-bit boundary (as shown in Figure 7-3 ), so the compiler issues an error message.
[FFN12]
Figure 7-3. Shifted MPE/iX Structure Using the MPE/iX default alignment yields the best performance (see Table 7-2 ). Using the ALIGNMENT option of the HP3000_16 directive to force 16-bit alignment of noncharacter data does not noticeably affect performance, even though three instructions for LOAD and STORE operations are needed for misaligned data versus one instruction for aligned data. Also note that all of the data in the program is not misaligned. The REALS Option MPE/iX uses the IEEE floating point standard for representing REAL*4, REAL*8, REAL*16, COMPLEX*8, and COMPLEX*16 types. MPE V uses proprietary HP3000 floating point to represent these types. The REALS option reads, writes, and executes all floating point numbers in the proprietary HP3000 floating point format. Use the REALS option if your program accesses a binary flat file or accesses a database that contains proprietary HP3000 floating point. This option is not necessary if the flat files are ASCII files. When using the REALS option, all floating point data is in proprietary HP3000 floating point. Therefore, real parameters passed to external routines are in the proprietary HP3000 floating point format. If the REALS option is specified and a system intrinsic is called that requires a real parameter, a proprietary HP3000 floating point number is passed. FREAD or FWRITE can be called because the files that are being accessed contain proprietary HP3000 floating point. Some modifications might have to be made if a system intrinsic is called that expects an IEEE floating point number. The PAUSE intrinsic and some Compiler Library, Scientific Library, V/3000, and DSG routines expect IEEE floating point real numbers. If the Compiler Library routines are declared as external or declared by the SYSTEM INTRINSIC statement, use the more efficient FORTRAN intrinsic functions instead of the compiler library routines. If you use the REALS option, the compiler calls the FORTRAN intrinsic function, which expects a proprietary HP3000 floating point number. The compiler makes the following emulation routines available: em_extin' em_inext' em_hpextin (same as em_extin') em_hpinext (same as em_inext') em_pause If your program calls the Compiler Library routines INEXT' or EXTIN' or calls the PAUSE system intrinsic, the easiest code change is to call the above routines. If your program calls the Scientific Library, V/3000, DSG, and IFS routines that expect IEEE floating point, the real parameters passed to these routines must be converted to IEEE floating point. Upon return, the real parameters or function return values must be converted from IEEE to the proprietary HP3000 floating point. The FPCONVERT routine converts floating point numbers in either direction. When you use the REALS option of the HP3000_16 directive, the floating point emulation routines must be used on proprietary HP3000 floating point numbers. There can be major performance degradation if your program uses a lot of floating point arithmetic. The STRING_MOVE Option The STRING_MOVE option should only be used when the application assumes that overlapping character substring moves have a ripple effect, as on MPE V. MPE/iX does not ripple the overlapping character substring moves and therefore increases performance on character moves. For example, the result of the program fragment character ch*10 ch(1:1) = '* ' ch(2:10) = ch(1:9) depends on the operating system. On MPE V, the character string ch is filled with asterisks (*). On MPE/iX, the first and second positions contain asterisks and the remainder of the string is undefined. Do not use this option if your program does not rely on the ripple effect of character substring moves. If there are overlapping character substrings when you use the STRING_MOVE option, the string is moved one byte at a time. Without this option, a fast move is used. For example, in a fast move of 20 characters, two sets of eight characters are moved, followed by one set of four characters.


MPE/iX 5.0 Documentation