next up previous contents
Next: Creating a machinefile Up: Getting Started With Previous: Setting Up to

Compilation

MPI allows you to have your source code in any directory. For convenience, you should probably put them in subdirectories under ~yourusername/mpi. To compile your source code, you should first copy the makefile in Appendix A available as ~pollock/public/Makefile on porsche into the directory of your source code. This makefile will compile the sample programs, the hello world and Mandelbrot Renderer, and place the executables in the current directory. (It also shows how to compile another program that is NOT given to you. This is just to demonstrate different parts of a Makefile.) To compile your own programs, you will find it easiest to simply change the names in the Makefile.

As you can see from the Makefile, you can compile simple C programs that call MPI routines with:

mpicc -o program_name program_name.c -lm
(where -lm links in the math library)

For simple C programs that use MPE graphics, you can compile with:

mpicc -o program_name program_name.c -lmpe -lX11 -lm

Fortran compilation is performed similarly; exchange mpif77 for mpicc and program_name.f for program_name.c. Type man mpicc or man mpif77 for additional information.



Lori Pollock
Wed Feb 4 14:18:58 EST 1998