Message Passing Interface (MPI) is a specification for an API that allows many computers to communicate with one another. It is used in computer clusters and supercomputers. Read more about MPI.
Several popular implementation of MPI includes: LAM/MPI, MPICH. Some comparisons have been made: see [1] [2].
At Lehigh University, we have MPICH and MPICH-2 installed on the Leaf and Altair clusters. The Corona cluster has three versions of MPI installed. If you need to use other MPI implementations, please feel free to contact us.
Before reading following sections, please make sure that you have accounts and know how to access our servers.
Firstly, use any SSH tools to log onto Leaf node. See more here.
Without set up your environment path, you cannot compile and run your MPI programs. After logging onto the Leaf, Please type:
| export PATH=/usr/local/mpi/bin/:$PATH |
This command will set up MPICH path for MPI compilation and running. If you want to use MPICH-2, please type:
| export PATH=/usr/local/mpi2/bin/:$PATH |
The following discussion is based on MPICH. To verify if correct version of MPI is being used. Do:
| which mpirun |
It should display /usr/local/mpi/bin/mpirun as the output. The user should proceed only when this has been done and the correct output is visible. If you make a mistake while exporting the path, you should log out and log in again. This will reset the PATH variable.
For example, if you want to compile "helloworld.c" (download this example from our web site), just type:
| mpicc -o helloworld helloworld.c |
See more detail information about MPI compilers: mpicc, mpiCC, f77.
After successfully compiling your jobs, you can type "mpirun" to run your jobs.
For example, you want to run the example program we provide on 4 machines, use "-np" option to specify the number of machines:
| mpirun -np 4 helloworld |
This is the possible output you will get.
| Hello, world! I am 1 of 4 Hello, world! I am 2 of 4 Hello, world! I am 3 of 4 Hello, world! I am 0 of 4 |
See more detail information about "mpirun".
Although MPI is designed for multi-processor programming, we have some limitations of MPI on Leaf nodes.
First, you cannot run jobs that cross multiple nodes. For example, if you logon to the Leaf, you will be at one particular node. All your MPI jobs will be run on that node no matter how may machines you specify using "-machines" option.
Second, there is one upbound limitation of how many processors you can specify using "-np" option. Currently, this number is 38. However, this does not infer that there are 38 CPUs in one particular Leaf node. In fact every Leaf node only has 4 true CPUs with hyper-thread support, which indicates that you can see 8 "hyper" CPUs. Here, you could think about 38 is the number of threads or processes MPI used on one machine. Remember, that is not the real number of CPUs. Please do not be surprised that you cannot get a high speedup with 38 "processors".
Firstly, use any SSH tools to log onto Altair. See more here.
Without set up your environment path, you cannot compile and run your MPI programs. After logging onto the Leaf, Please type:
| export PATH=/usr/local/mpi/bin/:$PATH |
This command will set up MPICH path for MPI compilation and running. If you want to use MPICH-2, please type:
| export PATH=/usr/local/mpi2/bin/:$PATH |
The following discussion is based on MPICH. To verify if correct version of MPI is being used. Do:
| which mpirun |
It should display /usr/local/mpi/bin/mpirun as the output. The user should proceed only when this has been done and the correct output is visible. If you make a mistake while exporting the path, you should log out and log in again. This will reset the PATH variable.
For example, if you want to compile "helloworld.c" (download this example from our web site), just type:
| mpicc -o helloworld helloworld.c |
See more detail information about MPI compilers: mpicc, mpiCC, f77.
After successfully compiling your jobs, you can type "mpirun" to run your jobs.
For example, you want to run the example program we provide on 4 machines, use "-np" option to specify the number of machines:
| mpirun -np 4 helloworld |
This is the possible output you will get.
| Hello, world! I am 1 of 4 Hello, world! I am 2 of 4 Hello, world! I am 3 of 4 Hello, world! I am 0 of 4 |
See more detail information about "mpirun".
There are plenty of materials you can learn about MPI programming. Here, we just list some of them.
Last Modified: April 28, 2009