Chapter 2. Building MPI Applications
Prev |  | Next

## Chapter 2. Building MPI Applications

This chapter provides procedures for building MPI applications on IRIX and Linux systems.

After you have added MPI function calls to your program, as described in Step 1, you can compile and link the IRIX or Linux program, as described in the following sections.

## Compiling and Linking IRIX Programs

To use the 64-bit MPI library, choose one of the following commands:

    CC -64 compute.C -lmpi++ -lmpi

    cc -64 compute.c -lmpi

    f77 -64 compute.f -lmpi

    f90 -64 compute.f -lmpi

To use the 32-bit MPI library, choose one of the following commands:

    CC -n32 compute.C -lmpi++ -lmpi

    cc -n32 compute.c -lmpi

    f77 -n32 compute.f -lmpi

    f90 -n32 compute.f -lmpi

If the Fortran 90 compiler version 7.2.1 or later is installed, you can add the `-auto_use` option as follows to get compile-time checking of MPI subroutine calls:

    f90 -auto_use mpi_interface -64 compute.f -lmpi

    f90 -auto_use mpi_interface -n32 compute.f -lmpi

## Compiling and Linking Linux Programs

The default locations for the include files, the `.so` files, the `.a` files, and the `mpi_launch` and `mpirun` commands are pulled in automatically. Once the MPT RPM is installed as default, the commands to build an MPI-based application using the `.so` files are as follows:

To use the 64-bit MPI library on Linux IA64 systems, choose one of the following commands:

    g++ -o myprog myproc.C -lmpi++ -lmpi

    gcc -o myprog myprog.c -lmpi

    sgif90 -o myprog -I/usr/include myprog.f -lmpi

To use the 32-bit MPI library on Linux IA32 systems, choose one of the following commands:

    g++ -o myprog myproc.C -lmpi++ -lmpi

    gcc -o myprog myprog.c -lmpi

    g77 -o myprog -I/usr/include myprog.f -lmpi

Prev | Table of Contents | Next
Chapter 1. Overview |  | Chapter 3. Using mpirun to Execute Applications