Examples of Compiling and Linking HP-MPI Applications
The following examples show how to compile and link your application code by invoking a compiler utility.
If you have not already loaded the mpi compiler utilities module , load it now as follows:
$ module load mpi
To compile and link a C application using the mpicc command:
$ mpicc
To compile and link a Fortran application using the mpif90 command:
$ mpif90 -o mycode hello.f
In the above examples, the
Developing Libraries
This section discusses developing shared and archive libraries for HP XC applications. Building a library generally consists of two phases:
•Compiling sources to objects
•Assembling the objects into a library
•Using the ar archive tool for archive (.a) libraries
•Using the linker (possibly indirectly by means of a compiler) for shared (.so) libraries.
For sufficiently small shared objects, it is often possible to combine the two steps.
A common technique is to build the archive library first, and then build the shared library from the archive library (using the linker's
For libraries that do not use
For libraries that do use
$ mpicc -c -g foo.c
To assemble an archive library, use the ar archive tool as you would on other
Once the library is built, it can be used to build applications, just as other libraries are used, for both serial applications (with the standard compilers) and parallel applications (with the
Note that for shared libraries it is necessary to use LD_LIBRARY_PATH to include the directory containing the shared library, just as you would on other
Designing Libraries for the CP4000 Platform
This section discusses the issues surrounding the design of libraries for CP4000 platform on the HP XC system.
A user designing a library for use on an HP XC CP4000 platform can supply a
It is the library designer's responsibility to make sure
Different compilers have different ways to select
For released libraries, dynamic and archive, the usual custom is to have a ../lib directory that contains the libraries. This, by itself, will work if the
Developing Libraries | 43 |