Exercise 5: Install OpenMPI
Open a console as a normal user in the usual way and create a directory in your home called for instance compile
. Now login as root
$ su
the password is 12compaq34.
Install the opemmpi with the command
$ apt-get install openmpi-bin libopenmpi-dev
Now open a new user shell and check that the OpenMPI binaries are correctly put in your path by typing
$ mpif90 -v
If this command reports the same output as gcc -v
everything is OK.
Test OpenMPI
To test that the OpenMPI distribution is working we will install a test software provided by Intel and called Intel MPI Benchmark or IMB. Download from this link IBM-3.2.
Once the file is downloaded you should untar it and enter the IMB_3.2/src
directory that will be created. Now you will need to modify the makefile in order to compile the test. Open the make_mpich
file in your favorite editor and edit the second line by adding the path to your OpenMPI installation. It should look like this
MPI_HOME=/usr
Exit the file editor and type
$ make -f make_mpich
to compile the test.
When the compiling procedure ends you will be ready to run your first MPI program. To run MPI programs you need the special command mpirun
that creates the correct environment for the parallel executables to run. Try first to run the IMB test as a regular program by typing
$ ./IMB-MPI1 > imb.out
Take a look at the output file produced and notice that the program ran on only 1 processor even though your machine is capable of running up to two processes in parallel. Note: Some test weren't even performed.
Now run the test in the proper way by typing
$ mpirun -np 2 ./IMB-MPI1 > imb2.out
And see that all the tests were performed using both processors available. The -np
option indicates to mpirun how many MPI processes it should generate to run the indicated executable.
Try to run the benchmark using more mpi processes by varying the -np
parameter and observe the variation in the timings.
Added optional exercise no. 1 (by Martin)
Optional exercise N.1
SORRY!! but the optional exercise just work in 64 bit. This machines are 32 bit :-(.
You can now run a part of a NASA benchmark that tests parallel performance of a well known application, which is the LU factorization.
Download the binaries from this link lu-mpitest
and untar the files somewhere in your home directory.
The binaries are ready to run, the suffix indicates the number of processes the executable was designed to run with. So for example type
$ mpirun -np 2 ./lu.A.2
to run with 2 processes. Try to see how the benchmark runs with a different number of processes.