next previous contents
Next: Creating a machinefile Previous: Startup file modifications


MPI allows you to have your source code in any directory. For convenience, you could probably put them in subdirectories under ~yourusername/aca319/. To compile your source code, you should first copy the Makefile from the mpi sample directory /usr/local/appl/mpich/examples/ into the directory of your source code. To compile your own programs, you may 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, you can compile with:

   mpicc -o program_name program_name.c -lm

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

   mpicc -o program_name program_name.c -lmpe -lm

You can in fact compile mpi program with any compiler, such as gcc, as long as you use the appropriate command-line flags (for specifying the location of header and library files, etc). mpicc and mpiCC are just "wrappers" which put together all the options needed and then call a standard compiler. You can have a look at mpicc (it is at /usr/local/appl/mpich/bin/mpicc) if you want to see what it does.