Before installing ParFlow on the Ubuntu system, I first had to make sure the prerequisite software was included and prepared on my system, including compilers and scripting language. Once that portion was completed, I was able to build ParFlow using various combinations of compilers. The end result is a working full version of ParFlow that passes (almost) all of the test cases. In writing this narrative of the trials and tribulations doing this install, I’m going to assume the reader holds a basic knowledge of file-system navigation by command line on a Linux system, what a compiler is and does, how to operate the vi text editor, and has already installed Ubuntu.
I installed a full version of ParFlow (r375) that includes CLM, supports MPI, supports SILO output and includes Hypre, a high-performance solver pre-conditioner. I also installed VisIt, a visualization platform that uses the SILO output files, but there is a compatibility issue between VisIt and Ubuntu that I have yet to resolve, so I will not detail that installation here.
This is the order of operations for installing ParFlow that I would use if I were to do it again. I shall spare the reader the loops and repetitions from my maiden voyage.
Install GNU Compilers
Download the following:
Install OpenMPI*
Install Intel Compilers
Install Tcl/Tk
Set environmental variables
Build Silo
Build Hypre
Build Parflow
*If you are not using a multi-core processor, multiple processors or a cluster, MPI is probably not needed.
**Intel compilers are available for free download for non-commercial use.
GNU Compilers
There are several GNU compilers that need to be available:
The GNU compiler collection can be installed via “apt-get” or the Synaptic Package Manager included in Ubuntu. I used the Synaptic Package Manager found in the System menu > Administration > Synaptic Package Manager. You will need to have administrative privileges to do this. Use the “Quick Search” to find gcc, gdc, g++ and gfortran, then install them.
MPI
The machine on which I installed ParFlow uses a dual-core processor, so I decided to install MPI to take full advantage of the processor. I downloaded OpenMPI and installed it according to the included instructions to the default directory (/usr/local/mpi) by leaving the “--prefix” flag off the ./configure line. This directory requires administrative privileges and the use of the “sudo” command.
sudo ./configure
sudo make all install
Intel Compilers
I was not able to get ParFlow to build using the GNU compilers alone, so I installed the Intel C and Fortran Compilers. The installers for the compilers make the installation process nearly fool-proof. I installed to the default directory (/opt/intel). During installation of the second compiler, I received a warning message about overwriting a library installed with the first. This is not a problem as the two compilers share the same library.
Tcl/Tk
Tcl/Tk provides the scripting support needed to initiate ParFlow. It is available through the Synaptic Package Manager and “apt-get,” however when installing with the Synaptic Package Manager, I was unable to figure out the correct pieces to get Tcl/Tk configured correctly. By downloading and installing the latest versions of Tcl and Tk from the source code, you get a complete installation. Tcl and Tk must be installed separately. I installed the Unix versions of Tcl and Tk to the default directory (/usr/local/). I used two flags on the configure line to specify a shared library and 64-bit support. If you are not using a 64-bit processor, the “--enable-64bit” flag is unecessary. Again, this installation requires administrative privileges.
sudo ./configure --enable-shared --enable-64bit
sudo make
sudo make install
sudo make test
I used the same procedure to install Tk. In the event that either portion must be reinstalled, it is important to run “sudo make distclean” first to completely remove the previous installation. Not doing this turned out to cause problems in running ParFlow.
The “make test” command runs several thousand tests. One test failed on Tcl. Several tests failed on Tk. ParFlow works in spite of the test failures, so I'm not going to worry about them much.
Setting Environmental Variables
This is the part of the process that allows the programs to find each other, essentially, and is thus important. This is also the part where you assign directories for ParFlow, Silo, Hypre and VisIt. I made a ParFLow directory, ~/parflow, in my home directory. From now on, I will call this directory “~PF.” I unpacked each *.tar.gz file in my ~PF directory, and renamed each simply “ParFlow,” “Silo” and “Hypre.”
Environmental variables can be set from the terminal command line or saved in the .bash_aliases file (so you only have to do it once). The terminal in Ubuntu does not load .bash_aliases by default. In fact, the file does not exist. To enable bash to load the .bash_aliases, I edited the ~/.bashrc file, located in my home directory.
vi ~/.bashrc
I found the following section in the .bashrc file and uncommented the boldface lines (delete “#” signs):
# Alias definitions. # You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi
Next I created the .bash_aliases file and added the following entries to it (numbers not included):
vi ~/.bash_aliases
export PARFLOW_DIR=~PF/parflow
export SILO_DIR=~PF/silo
export HYPRE_DIR=~PF/hypre
export PATH=$PATH:/opt/intel/Compiler/11.0/083/bin/intel64*
export LD_LIBRARY_PATH=/opt/intel/Compiler/11.0/083/lib/intel64*
export FC=ifort
export F77=ifort
export F90=ifort
export CC=icc
export CFLAGS='-no-multibyte-characters'
*This path may be different depending on version and installation path.
1-3 set the directories for ParFlow, Silo and Hypre. 4 and 5 configure the Intel compilers to run from the command line. 6-9 make the Intel compilers default. 10 circumvents a compiler error.
This is the setup to build ParFlow. Silo does not compile correctly using the Intel C Compiler, so I reset the C compiler to gcc by entering the following on the command line.
export CC=gcc
export CFLAGS=
This setting is only valid in the current terminal window for the current session. Starting a new session will load the .bash_aliases file and revert to the Intel C Compiler.
Installing Silo
With the C compiler set to gcc, the installation of Silo went according to the instructions contained in the INSTALL file included in the package. I used a “--disable-silex” flag on the ./configure line. This disables a utility that ParFlow does not use that would complicate the installation.
./configure --prefix=$SILO_DIR --disable-silex
make
make check
make install
The “make check” line runs a series of tests. These should all pass. During my installation, I had plenty of problems getting the program to compile, but once it did, the tests passed.
Installing Hypre
I installed Hypre using the same set of compilers as Silo, and it worked. In the interest of leaving well-enough alone, I did not try it with other combinations of compilers. The autoconf package for Hypre is located in the “src” subfolder (~PF/hypre/src). Like Silo, the installation of Hypre went according to the instructions contained in the INSTALL file. I used the “--with-MPI” flag. If MPI is to be enabled in ParFlow, MPI must be enabled in Hypre as well. For ParFlow builds without MPI, a “--without-MPI” flag is necessary. MPI must be capitalized.
./configure --prefix=$HYPRE_DIR --with-MPI (or “--without-MPI”)
make install
That is all.
Installing ParFlow
Now I'm ready to install a full version of ParFlow with Hypre and Silo support and coupled with CLM. This installation is completed in three parts.
Before beginning, ParFlow seems to compile using the Intel compilers, but not the GNU compilers. If your .bash_aliases file has the same 10 lines as mine above, the easiest way to set the correct compilers is to open a new terminal window and work there. Otherwise, entering lines 10 and 11 from the .bash_aliases above on the command line will make the necessary settings.
1. Installing ParFlow: the autoconf package for ParFlow is located in the ~PF/parflow/pfsimulator directory. I used many flags in the ./configure line to enable all of my extensions.
./configure --prefix=$PARFLOW_DIR --with-amps=mpi1 (or --with-amps=seq, if you're not running MPI) --with-clm --with-silo=$SILO_DIR --with-hypre=$HYPRE_DIR --enable-timing
You're only going to want to type that once, so don't close your terminal window until you're done.
make install
2. If that worked, now it's time to install “pftools,” located in ~PF/parflow/pftools. I used the same ./configure line as above by pressing the up arrow. The autoconf for pftools ignores the flags that do not apply.
make install
3. If that worked, the last step is to test ParFlow. Tests are located in ~PF/parflow/test
make check
One test run, the “forsyth2” test did not pass. ParFlow appears to have completed the problem, but the output does not match the correct output. The remaining fourteen tests passed.
That completes installation of ParFlow with CLM, with Silo and Hypre support, and MPI enabled on an Ubuntu 9.04 Jaunty Jackalope system.