Hypre: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 69: | Line 69: | ||
CXXFLAGS="-DMPIPP_H" | CXXFLAGS="-DMPIPP_H" | ||
</source> | </source> | ||
=== Mac Snow Leopard Server === | |||
To get Hypre built on a Snow Leopard server, I needed to do some kind of fishy things with configure (see [[#Duplicate symbol start]] in [[#Installation Errors]] section below): | |||
<source lang="bash"> | |||
#!/bin/sh | |||
# | |||
# run configure | |||
# make | |||
# make install | |||
# make test | |||
./configure \ | |||
--with-MPI \ | |||
--with-MPI-include=${HOME}/pkg/openmpi/1.4.3_bigmac/include \ | |||
--with-MPI-libs=mpi \ | |||
--with-MPI-lib-dirs=${HOME}/pkg/openmpi/1.4.3_bigmac/lib \ | |||
--prefix=${HOME}/pkg/hypre/2.0.0_bigmac \ | |||
--enable-shared \ | |||
\ | |||
CC="/usr/bin/gcc" \ | |||
CXX="/usr/bin/g++" \ | |||
F77="/usr/local/bin/gfortran" \ | |||
\ | |||
FLIBS="-L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0 | |||
-L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0/../../.. | |||
-lgfortran -lgcc_ext.10.5 -lSystem" \ | |||
\ | |||
CXXFLAGS="-DMPIPP_H -arch x86_64" \ | |||
CFLAGS="-DMPIPP_H -arch x86_64" | |||
</source> | |||
'''IMPORTANT''': I have broken up the FLIBS variable into three lines, but I only did that so this page would look pretty. You should probably reformat it if/when you use it to be a single line. | |||
== Installation Errors == | == Installation Errors == | ||
Revision as of 20:36, 24 May 2011
Hypre is a massively parallelizable linear solver library written and designed for use in C++. It provides many nice features and objects beyond simple "matrix" or "vector" objects - these include grids, meshes, and stencils. It was developed at Lawrence Livermore National Lab.
Installation
Installing Hypre can be tricky. The documentation will give much more in-depth details than this page. Links to the documentation are available at https://computation.llnl.gov/casc/hypre/software.html .
Dependencies
Hypre will require an installation of MPI on your machine. I use LAM MPI, but you can also use OpenMPI.
Configuration
Download the hypre tarball and decompress it. Put your configure wrapper into the src/ directory of the decompressed Hypre tarball.
Mac Leopard (OS X 10.5)
This configure line has been used to build hypre 2.0.0 with LAM MPI on Mac Leopard.
#!/bin/sh
#
# run configure
# make
# make install
# make test
./configure \
--with-MPI-include=/path/to/mpi/include \
--with-MPI-lib-dirs=/path/to/mpi/lib \
--with-MPI-libs="mpi lam pmpi util" \
--prefix=/path/to/hypre/2.0.0 \
\
F77=/usr/local/bin/gfortran \
\
CFLAGS=-DMPIPP_H \
CXXFLAGS=-DMPIPP_H
The -DMPIPP_H compiler flags are only required for LAM MPI and OpenMPI; they are not needed if you use any other MPI install (e.g. MPICH).
Also see Gfortran.
Red Hat Linux
I was able to successfully install Hypre on a Red Hat Linux workstation with OpenMPI with the following configure line:
#!/bin/sh
#
# run configure
# make
# make install
# make test
./configure \
--with-MPI \
--with-MPI-include=/path/to/openmpi/1.4.3/include \
--with-MPI-libs=mpi \
--with-MPI-lib-dirs=/path/to/openmpi/1.4.3/lib \
--prefix=/path/to/hypre/2.0.0 \
--with-blas-lib-dirs=/usr/lib \
--with-lapack-lib-dirs=/usr/lib \
--enable-shared \
\
CC="/usr/bin/gcc" \
CXX="/usr/bin/g++" \
\
CFLAGS="-DMPIPP_H" \
CXXFLAGS="-DMPIPP_H"
Mac Snow Leopard Server
To get Hypre built on a Snow Leopard server, I needed to do some kind of fishy things with configure (see #Duplicate symbol start in #Installation Errors section below):
#!/bin/sh
#
# run configure
# make
# make install
# make test
./configure \
--with-MPI \
--with-MPI-include=${HOME}/pkg/openmpi/1.4.3_bigmac/include \
--with-MPI-libs=mpi \
--with-MPI-lib-dirs=${HOME}/pkg/openmpi/1.4.3_bigmac/lib \
--prefix=${HOME}/pkg/hypre/2.0.0_bigmac \
--enable-shared \
\
CC="/usr/bin/gcc" \
CXX="/usr/bin/g++" \
F77="/usr/local/bin/gfortran" \
\
FLIBS="-L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0
-L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0/../../..
-lgfortran -lgcc_ext.10.5 -lSystem" \
\
CXXFLAGS="-DMPIPP_H -arch x86_64" \
CFLAGS="-DMPIPP_H -arch x86_64"
IMPORTANT: I have broken up the FLIBS variable into three lines, but I only did that so this page would look pretty. You should probably reformat it if/when you use it to be a single line.
Installation Errors
Error with dlamch.o
If you see an error like this:
/usr/bin/ld: /path/to/hypre/src/utilities/dlamch.o: relocation R_X86_64_32S against 'a local symbol' can not be used when making a shared object; recompile with -fPIC /path/to/hypre/src/utilities/dlamch.o: could not read symbols: Bad value collect2: ld returned 1 exit status
Then you need to edit /path/to/hypre/src/lapack/Makefile, and add an -fPIC flag, as shown below:
dlamch.o : dlamch.c ${LAPACK_HEADERS}
${CC} -c -fPIC dlamch.c
Duplicate symbol start
When I tried to build Hypre on a 64-bit Mac server, I saw the following error while running configure:
checking whether we are using the GNU Fortran 77 compiler... yes checking whether /usr/local/bin/gfortran accepts -g... yes checking how to get verbose linking output from /usr/local/bin/gfortran... -v checking for Fortran libraries of /usr/local/bin/gfortran... -lcrt1.10.5.o -L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0 -L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0/../../.. -lgfortran -lgcc_ext.10.5 -lSystem checking for dummy main to link with Fortran libraries... unknown configure: error: linking to Fortran libraries from C fails See `config.log' for more details.
The underlying error, appearing in config.log, is this:
configure:6444: /usr/bin/gcc -o conftest -mmacosx-version-min=10.7.0 -DMPIPP_H -arch x86_64 -L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0 -L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0/../../.. -lgfortran -lgcc_ext.10.5 -lSystem conftest.c -lcrt1.10.5.o -L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0 -L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0/../../.. -lgfortran -lgcc_ext.10.5 -lSystem >&5 ld: duplicate symbol start in /usr/lib/crt1.10.5.o and /usr/lib/crt1.10.6.o collect2: ld returned 1 exit status
And the underlying problem with that is the -lcrt1.10.5.o flag. This somehow gets parsed from the system and put into the FLIBS variable. So, this variable needs to be re-defined in the configure script to be the same thing except without -lcrt1.10.5.o:
FLIBS="-L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0
-L/usr/local/lib/gcc/x86_64-apple-darwin10.4.0/4.6.0/../../..
-lgfortran -lgcc_ext.10.5 -lSystem"
After changing that, everything worked fine.
Examples
Resources
Hypre home page - http://acts.nersc.gov/hypre/