Monday, October 8, 2012

Setting up the Message Passing Interface (MPI)

After configuring SSH with public/private key pairs, and setting up aliases for in /etc/hosts for each PI node, one more useful thing is to update the command prompt to make it easy to know which machine you are working with.  I altered the .bashrc profile on each machine like this:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# JB - Put the machine name in the prompt to make it easier to know which
# machine we are running on.
export PI_NODE=R1


...

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@$PI_NODE\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@$PI_NODE:\w\$ '
fi

...


Not only does this make the node name apparent in the prompt, it gives us a handle on each machine to use if we want to write tools:

pi@R1 ~ $ echo $PI_NODE
R1
pi@R1 ~ $


Now it's time to install the message passing software - MPI-2.  I'm going to build this form the source, just to get the latest version.  Thanks to Phil Leonard for the pointers to everything.
  1. sudo apt-get install fort77
  2. wget http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.4.1p1/mpich2-1.4.1p1.tar.gz
  3. tar zxfv mpich2-1.4.1p1.tar.gz
  4. cd mpich2-1.4.1p1
  5. sudo ./configure
  6. sudo make
  7. sudo make install  
Step 1 was to install the Fortran compiler (fort77), which is no big deal.  Then the rest of it built and installed without any problem.  As Phil mentions in his blog (install option 3), this takes a while - at least a couple of hours, so you may want to plan accordingly.

I got this to build and install properly on my first Pi node, so now I'm off to replicate this on the other machines.  I can install of these machines in parallel of course, but it will still take some time.

No comments:

Post a Comment