open-mpiMPI stands for Message Passing Interface, something you would have to learn if you want to use parallel programming. You don’t have to program yourself, but there are some programs that can be run much quicker, that is, run in parallel, for example, on your dual core, quad core, or hexa-core processor. That’s where MPI comes to the rescue. OpenMPI is a type of MPI implementation, obviously open source (free) high performance computing,  developed by a bunch of academic, research, and other independent parties.

If you are a linux user, and especially if you a computer science researcher like me, chances are you have come across some codes that can be parallelized. That’s great, because science codes usually take time to finish, and if you can run them in parallel, you could save a lot of time.

List of Features of OpenMPI

  • MPI-2 standard
  • Dynamic process spawning
  • Thread safety
  • Network and process fault tolerance
  • Reliable job management
  • Single library support
  • Many job schedulers
  • Component-based design
  • Run-time instrumentation

At the moment of writing this post, the latest release of OpenMPI is 1.10.2.

This is a brief guide to installing Open MPI, version 1.10.2, in Ubuntu 14.04

  • Make sure first that you have no other MPI compilers already installed. If you do, remove them before proceeding with the next step to avoid possible conflict.
  • Download the latest stable package from the openmpi website. You can install manually, or just use wget for this:
wget https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.2.tar.gz
  • Install libibnetdisc-dev. This library is used in high-performance computing. It bring low latency and high throughput. It is also  designed to be scalable.
sudo apt-get install libibnetdisc-dev
  • Decompress the downloaded file and change directory
gunzip openmpi-1.10.2.tar.gz 
tar -xvf openmpi-1.10.2.tar
cd openmpi-1.10.2
  •  Configure the installation file according to your system configuration
./configure --prefix="/home/$USER/.openmpi"
  • Install OpenMPI (Note that it may take quite some time for this operation to finish, depending on the speed of your computer)
make
sudo make install
  • Setup path in Environment Variable
export PATH="$PATH:/home/$USER/.openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/"
  • Test if install was successful
mpirun

If everything has been installed fine, you should now be able to see the ‘How to use’ message.

At the end, check the version of your newly installed openmpi implementation by running the following command:

ompi_info

The first several lines will give you the info about the mpi version.

You are trying to exit your Linux terminal, and the following message appears:

exit
There are stopped jobs.

That happens to me from time to time on my Ubuntu machine. I know that my bash shell is reminding me that I have stopped jobs.

I could type “exit” again and this time I would be allowed to exit the shell.That’s when the jobs are terminated.

But what if I wanted to kill the jobs myself?

Here’s the deal:

All stopped jobs are no longer running. They are temporarily put in the background.

But, and this is a big but, they still use memory and other resources of your computer. Obviously, you would want to kill them if you no longer need them.

First, let’s see them:

In bash, you can type the “jobs” command, just like I did below:

jobs
[1]+  Stopped                 python 101-slab-relax.py

If you changed your mind you could try to resume your stopped job. In some cases, it is easy, just type the “fg” command followed by the number of the job, like this:

fg 1
python 101-slab-relax.py

Note that some complicated jobs won’t be able to resume after being stopped.

In the case that you wanted to kill the jobs yourself, you could use the “kill” command with the corresponding PID numbers of your stopped jobs. For example, type ps first to find their PID number(s):

ps
  PID TTY          TIME CMD
24496 pts/20   00:00:00 bash
24866 pts/20   00:05:32 python
24867 pts/20   00:00:00 python2 
24868 pts/20   00:00:00 sh 
24986 pts/20   00:00:00 ps

Then type, e.g., “kill 24867”:

kill 24867
[1]+  Killed                  python 101-slab-relax.py

The alternative way to kill your jobs is by using the jobspec, which is the number 1 in this case preceded by the percent (%) sign, like this:

kill %1

That’s all the magic you need to kill or resume the jobs you’ve stopped previously with “Ctrl+z”. Enjoy!