| United States-English |
|
|
|
![]() |
Parallel Programming Guide for HP-UX Systems > Chapter 2 MPICompiling and Linking |
|
The compiler you use to build HP MPI applications depends upon which programming language you use. The HP MPI compiler utilities are shell scripts that invoke the appropriate native compiler. You can pass the pathname of the MPI header files using the -I option and link an MPI library (for example, the diagnostic or thread-compliant library) using the -Wl, -L or -l option. By default, HP MPI compiler utilities include a small amount of debug information in order to allow the TotalView debugger to function. However, certain compiler options are incompatible with this debug information. Use the -notv option to exclude debug information. The -notv option will also disable TotalView usage on the resulting executable. The -notv option applies to archive libraries only. HP MPI 2.0 now offers a -show option to compiler wrappers. When compiling by hand, run as mpicc -show and a line will print displaying exactly what the job was going to do. HP MPI provides separate compilation utilities and default compilers for the languages shown in the following tables. Table 2-1 Default compilers for HP-UX
If aCC is not available, mpiCC uses CC as the default C++ compiler. Table 2-2 Default compilers for Linux Itanium2
Table 2-3 Default compilers for Linux IA-32
Table 2-4 Default compilers for Tru64UNIX
Even though the mpiCC and mpif90 compilation utilities are shipped with HP MPI, all C++ and Fortran 90 applications use C and Fortran 77 bindings respectively. If you want to use a compiler other than the default one assigned to each utility, set the corresponding environment variables shown in Table 2-5 “Compilation environment variables”. Table 2-5 Compilation environment variables
HP MPI 2.0 supports Fortran programs compiled 64-bit with any of the following options: For HP-UX:
For Linux Itanium2:
For Tru64UNIX:
The decision of how the Fortran arguments will be interpreted by the MPI library is made at link time. If the mpif90 compiler wrapper is supplied with one of the above options at link time, the necessary object files will automatically link, informing MPI how to interpret the Fortran arguments.
The following MPI functions accept user-defined functions:
The user-defined callback passed to these functions should accept normal-sized arguments. These functions are called internally by the library where normally-sized data types will be passed to them. HP-UX 11.i and higher is available as a 32- and 64-bit operating system. You must run 64-bit executables on the 64-bit system (though you can build 64-bit executables on the 32-bit system). HP MPI supports a 64-bit version of the MPI library on platforms running HP-UX 11.i and higher. Both 32- and 64-bit versions of the library are shipped with HP-UX 11i and higher. For HP-UX 11i and higher, you cannot mix 32-bit and 64-bit executables in the same application. The mpicc and mpiCC compilation commands link the 64-bit version of the library if you compile with the +DA2.0W or +DD64 options. Use the following syntax: [mpicc | mpiCC] [+DA2.0W | +DD64] -o filename filename.c When you use mpif90, compile with the +DA2.0W option to link the 64-bit version of the library. Otherwise, mpif90 links the 32-bit version. For example, to compile the program myprog.f90 and link the 64-bit library enter: % mpif90 +DA2.0W -o myprog myprog.f90 HP MPI provides a thread-compliant library. By default, the non thread-compliant library (libmpi) is used when running HP MPI jobs. Linking to the thread-compliant library (libmtmpi) is now required only for applications that have multiple threads making MPI calls simultaneously. In previous releases, linking to the thread-compliant library was required for multithreaded applications even if only one thread was making a MPI call at a time. Application types that no longer require linking to the thread-compliant library include:
This example shows how to build hello_world.c prior to running.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||