[Contents] [Chapter 1] [Chapter 3] [Index]



Compiling and Linking MPI Programs

This chapter provides a description of how you compile and link MPI programs. The chapter consists of the following sections:

2.1 Compiling and Linking C Programs

You need to use the appropriate include files and libraries in your make process in order to compile MPI programs.

To compile C programs, follow these steps:

  1. Enter the following code into the program:

    include <mpi.h>

    This include file is installed in the standard location under /usr/include and does not need additional compiler directives.

  2. Use the following library option:

    Include -lmpi in your link command, for example,

    cc -o myprog myprog.c -lmpi -lrt -pthread

2.2 Compiling and Linking Fortran Programs

You need to use the appropriate include files and libraries in your make process in order to compile MPI programs.

To compile Fortran programs, follow these steps:

  1. Enter the following code into the program:

    include 'mpif.h'

    This include file is installed in the standard location under /usr/include and does not need additional compiler directives.

  2. Use the following library option:

    Include -lfmpi and -lmpi in your link command, for example,

    f77 -o myprog myprog.f -lfmpi -lmpi -lrt -pthread


[Contents] [Chapter 1] [Chapter 3] [Index]


mpi@ilo.dec.com

Copyright © 1999, Digital Equipment Corporation. All rights reserved. Unpublished rights reserved under the copyright laws of the United States.