| United States-English |
|
|
|
![]() |
HP-UX Floating-Point Guide: HP 9000 Computers > Chapter 1 IntroductionOverview of HP-UX Math Libraries |
|
Basic operations such as addition and multiplication are specified by the IEEE standard. More complex mathematical operations such as logarithmic and trigonometric functions are provided by math library routines. The high-level operations of math library routines are specified not by the IEEE standard but by individual language standards (such as ISO/ANSI C) and by programming environment specifications (such as X/Open and SVID). C math library functions are located in the libm math library. The libm functions operate according to the C standard and the latest versions of the System V Interface Definition (currently SVID3) and of the X/Open Portability Guide (currently XPG4.2). The XPG4.2 specification is a superset of the POSIX.1 standard (IEEE Std 1003.1-1990). The SVID3 and XPG4.2 specifications are compatible. The libm library also supports many functions and macros that the ISO/ANSI C committee has included in the C9X draft standard (the proposed new ISO/ANSI C standard). Fortran and Pascal intrinsic functions are located in the libcl library. In addition, Basic Linear Algebra Subroutine (BLAS) library routines are provided in the libblas library (provided with the HP Fortran 90 and HP FORTRAN/9000 products only). Table 1-1 “HP-UX Math Libraries” lists the math libraries available on HP-UX systems and shows the option you specify to the compiler or linker in order to link in each library. Table 1-1 HP-UX Math Libraries
At Release 11.0, HP-UX systems provide math libraries that run on two different architectures:
The HP-UX math libraries in the directory /usr/lib are 32-bit libraries targeted to PA1.1 and PA2.0 systems. The math libraries in the directory /usr/lib/pa20_64 are 64-bit libraries targeted to PA2.0 systems, and run only on those systems. The HP Fortran 90 and HP FORTRAN/9000 products supply two versions of the BLAS library, one specially tuned for PA1.1 systems, the other specially tuned for PA2.0 narrow mode. When you compile a program on a PA2.0 system at HP-UX Release 11.0, the compiler by default generates PA2.0N code. To generate PA2.0W code, you need to specify the +DA2.0W option (see “Selecting Different Versions of the Math Libraries”). All HP 9000 systems except the oldest Series 800 systems are PA1.1-based or PA2.0-based. If you do not know your system's architecture type, see “Determining Your System's Architecture Type”. For complete information about the math libraries, see Chapter 4 “HP-UX Math Libraries on HP 9000 Systems”. There are two main ways to find the architecture type of your system. To do it from the command line:
You can also learn the system architecture type at run time. A simple program that gives you useful information follows. Example 1-1 Sample Program: get_arch.c
The uts.release is the release of HP-UX on the system where you run the program. The _SYSTEM_ID is the kind of code the compiler generated. The _CPU_REVISION is the architecture type. If you compile this program on a PA1.1 system, then run it on a PA2.0 system running HP-UX Release 11.0, you get results like the following:
The release, 11.00, is easy to decipher. To decode the other results, search the file /usr/include/sys/unistd.h:
The compiler generated PA1.1 code, which is running on a PA2.0 system. If you use a compilation command (f90, cc, and so on) to invoke the link editor (ld), the selection of math libraries is driven by the +DA compiler option. By default, the compiler generates code for the kind of system on which you are running the compiler. This ensures the best possible performance on that system. If you compile on a PA2.0 system, by default the compiler generates narrow-mode code. Table 1-2 “Code-Generation Compiler Options at HP-UX Release 11.0” describes the code-generation compiler options. Table 1-2 Code-Generation Compiler Options at HP-UX Release 11.0
If your application must run on both PA1.1 and PA2.0 systems, compile with +DA1.1. Code compiled with +DA2.0 or +DA2.0W will run only on PA2.0 systems. The +DA option determines not only the code generated by the compiler but also the library search path chosen by the linker. For example, if you invoke the HP Fortran 90 compiler with +DA2.0, it contains the following:
Not all HP-UX compilers support the generation of 64-bit code. The following compilers support the +DA2.0W option:
The following compilers support +DA1.1 and +DA2.0, but not +DA2.0W:
At Release 11.0, the main HP-UX math libraries are in the directory /usr/lib. The BLAS library is in both /opt/fortran90/lib and /opt/fortran/lib. The obsolete vector library exists only in /opt/fortran/old/lib. Table 1-3 “Math Library Path Names” shows the math library path names. Table 1-3 Math Library Path Names
Figure 1-1 “Math Library Directory Hierarchy at Release 11.0” illustrates the directory hierarchy for the math libraries. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||