Back to Gabriel Altay's Homepage
Gabriel Altay's Fortran 90 Linux Software Installation Notes
These are notes I made on my journey to install software that would allow me
to compute fast fourier transforms on distributed memory machines. I use
Fortran 90 as my main programming language and so these notes are geared
towards that goal. If you install these three pieces of software in the order
described here, you should be able to run parallel FFT jobs on distributed
memory clusters.
- Find a link to the free non-comercial download here. (I
installed version 10.1, you might find a different version by following
the link)
- You will be asked for an email address and be given a seriel number.
Afterwards you can choose the appropriate tar file for your system. A
set of confusing letters and numbers label the different files. Use
the excerpt below to find the correct file for your computer. (For me
it was IA-32 so I'll make that assumption in the rest of this document)
*IA-32*
IA-32 Architecture refers to systems based on 32-bit processors
generally compatible with the Intel Pentium(R) II processor, (for
example, Intel(R) Pentium(R) 4 processor or Intel(R) Xeon(R) processor),
or processors from other manufacturers supporting the same instruction
set, running a 32-bit operating system ("Linux x86").
*Intel(R) 64 *
Intel(R) 64 Architecture refers to systems based on IA-32 architecture
processors which have 64-bit architectural extensions, (for example,
Intel(R) Core(TM)2 processor family), running a 64-bit operating system
("Linux x86_64"). If the system is running a 32-bit version of the
Linux operating system, then IA-32 architecture applies instead.
Systems based on AMD* processors running a "Linux x86_64" operating
system are also supported by Intel compilers for Intel(R) 64
architecture applications.
*IA-64*
Refers to systems based on the Intel(R) Itanium(R) processor running a
64-bit operating system.
- Move the tar file to a directory where you have write access. I
usually put these kind of things in ~/usr (~/ is shorthand for your
home directory).
Untar the file,
tar xvfz l_fc_p_10.1.015_ia32.tar.gz
This will create the directory l_fc_p_10.1.015_ia32 .
Move into this directory and run the install script.
cd l_fc_p_10.1.015_ia32
sudo ./install.sh
If you dont have root access, you can omit the sudo command. The install
shell will ask you if want to do a root user install and you just select
no. This just means it will install the files into your home directory
instead of the default ( /opt/intel ). Follow the on screen
prompts until it asks you for your serial number. This should be in an
email that was sent to the address you gave them. It also appears on the
download page after you give them your email. Follow the rest of the on
screen prompts and you should be good to go.
- Find a link to the download page
here . The latest
release (when I wrote this) was MPICH2 1.0.7. Download the tar file
mpich2-1.0.7.tar.gz .
- Move the tar file to a directory where you have write access. I
usually put these kinds of things in a directory called
usr
in my home directory.
Now untar the file ( tar xvfz mpich2-1.0.7.tar.gz ).
- This will create the source directory
mpich2-1.0.7
Before we start, we are going to create two other directories which
will be useful. (These instructions are taken from the install guide).
So we can put everything (intel compiler, mpich2, and fftw) in the same
place, we will create a build and an install directory in
/opt . Note that you will probably need root access
to do this. If you dont have root access, just make these directories
somewhere in your home directory.
mkdir /opt/mpich2-1.0.7-build
mkdir /opt/mpich2-1.0.7-install
These directories should be present on each machine that
you will be sending jobs to. This will happen automatically if you
are using a shared file system. If not, you will have to create the
directories on each machine.
- Move to the build directory and execute the configure script in the
source directory, using
-prefix to tell it where to
install the files. We will also want to set the environment variables
F77 and F90 to ifort. (Note <username>
means your username with no angular brackets.)
cd /opt/mpich2-1.0.7-build
export F77=ifort
export F90=ifort
/home/<username>/usr/mpich2-1.0.7/configure
-prefix=/opt/mpich2-1.0.7-install
2>&1 | tee configure.log
The configure script ran for a couple minutes on my machine. If it is
successful ( if the last line is configuration completed. )
you can build and install the libraries.
make 2>&1 | tee make.log
make install 2>&1 | tee install.log
When these steps are complete all of the MPICH2 executables should be in
/opt/mpich2-1.0.7-install/bin and you should add this
directory to your path. The two makes took on the order of fifteen
minutes to run on my machine. You can check that the executables are
in your path by using the following commands,
which mpd
which mpicc
which mpif90
which mpiexec
which mpirun
- Last thing you have to do before running tests is to create a file
called
.mpd.conf in your home directory. Add the line
secretword=<your_secret_word> to this file where
<your_secret_word> is a string you make up. Execute
the command chmod 600 .mpd.conf to make this file only
visible to you.
- Sanity checks,
mpd &
mpdtrace
mpdallexit
Which should return your local host name.
mpd &
mpiexec -n 1 /bin/hostname
mpdallexit
Which should also return your local host name, perharps in a slightly
different format. Now we are going to bring up a ring of mpd daemons.
Create a file named mpd.hosts , and add one entry per
machine that you want to run jobs on. The number of processors on each
machine should be indicated using :nproc . For example,
if I have four machines on my cluster with names node1 - node4 and they
each have a quad core processor, my mpd.hosts file would have the
following lines,
nodel:4
node2:4
node3:4
node4:4
Now we can bring up the ring of mpd daemons. Continuing with the example
above, the command would be,
mpdboot -n 5 -f mpd.hosts
This brings up five daemons. One for the machine where the
command is run, and one for each of the machines in the hosts file.
You can run jobs using mpiexec . Some usefull flags,
-1 (thats the number one) will override the default
behaviour of trying to place the first process locally.
-l (thats the letter el) will preface each line of output
with the process that produced it.
-machinefile < file_name > will run processes on
the machines listed in < file_name > in the order
that they appear in that file.
I've found that it is important to put all the optional flags before the
-n < nprocs > flag when using mpiexec .
Thats it, now you're good to go. Don't forget to take down the mpd
daemons when your done with mpdallexit .
- Find a link to the download page
here . The latest
release (when I wrote this) was FFTW 3.1 which the site says has an
experimental new MPI interface. I know the FFTW 2.1.5 MPI routines work
so I chose that version. Scroll down on the download page to find a link
to the file
fftw-2.1.5.tar.gz .
- Move the tar file to a directory where you have write access. I
usually put these kind of things in ~/usr (~/ is shorthand for your
home directory).
Now untar the file ( tar xvfz fftw-2.1.5.tar.gz ).
- We want to accomplish a couple things with this install. First we want
to compile both the single and double precision versions of the
libraries. We also want MPI support enabled and we want the Fortran
wrappers to work with the intel compiler. First we will install the
double precision libraries with the following set of commands.
export F77=ifort
./configure --enable-type-prefix --enable-mpi
--prefix /opt/fftw-2.1.5
make
make install
make clean
I have chosen to put these libraries in /opt/fftw-2.1.5
but you can put them where you like by changing the argument to
--preix (for example your home directory). When these
steps are finished, we can install the single precision libraries in the
same location.
export F77=ifort
./configure --enable-float --enable-type-prefix --enable-mpi
--prefix /opt/fftw-2.1.5
make
make install
Now to link to the double precision libraries you would use
-L/opt/fftw-2.1.5/lib -ldrfftw -ldfftw , and to link to
the single precision libraries you would use
-L/opt/fftw-2.1.5/lib -lsrfftw -lsfftw .
- In the source directory
(
/home/<username>/usr/fftw-2.1.5 ) there is a
directory called fortran in which you will find an include
file ( fttw_f77.i ) which contains parameter definitions.
You need to include this file at the top of your Fortran 90 programs.
Also in this directory is example Fortran code (in Fortran 77) in the
file f77_test.F . See that file for examples of how the
calls to the fftw library work. Now you should be on your way to doing
parallell fast fourier transforms. Have fun.