What goes into babel limits what can come out of babel-dependent
packages like cca-spec-babel and Ccafe on the other end of long
build processes. The key to most CCA success is getting babel
built correctly. Babel is normally built by:
./configure --prefix=/where/you/want/it/installed {other options}
make install
See also: README and INSTALL from the babel source code.
Often we discover, in the end, that the sanest way to
handle babel is to install several different configurations
of it, each with a different prefix.
The devil is in the other options details and in environment
variables. If you need fully static-linked executables
(often needed for performance or profiling runs or weird HPC
queue systems), you should add
--enable-pure-static-runtime --disable-shared
to the configure
options. This has the side effect of disabling dynamic loading
and thus python and java code.
We will now discuss java, python, mpi, 64 bit-ness, and the
more traditional performance-oriented languages.
You
must have a java compiler on your system.
Babel is implemented in Java. A 1.4 Java is best, while java 1.3
will work but limits the command-line options available to
babel which in turn may limit how you organize your code generation.
Specifically, older Java may not have the regex package used
for wildcard arguments to babel.
Babel also has an
optional Java binding ; this binding
allows java code to be included in multi-language executables.
If you do not need java support in your programs, simply
add
--disable-java
to the babel configure.
Babel has a
python binding. But it will not be built in
most unix environments because it
requires the Numeric library
for handling arrays and it
requires a libpython.so. So, before building babel,
if you want python support go get Numeric and a libpython.so and install
it in your python environment. If you do not need python,
simply add
--disable-python
Numeric is a bit of a football
in the python world. As of this writing, Numeric source could be
found at
Source Forge. Building and installing Numeric is simple, though it
will require root privileges on most systems. Just follow the
README instructions. A note for the HPCers: Numeric has the
ability to use your system's optimized BLAS and LAPACK.
If you want this feature, you must edit the setup.py before
running it. The README explains this as well. By default you
get a simple BLAS replacement implementation that comes with numeric.
A shared libpython.so can be obtained by rebuilding python
(but who wants to do that) with some additional options.
Alternatively on most Linux environments, you can make a
libpython.so by taking this Makefile code and adjusting/applying
it to your system. You may need to be root to make install.
PYROOT=/usr
INSTALLROOT=/usr
SRCLIB=$(PYROOT)/lib/python2.2/config/libpython2.2.a
build: $(SRCLIB)
mkdir -p scratch
(cd scratch; ar x $(PYROOT)/lib/python2.2/config/libpython2.2.a)
(cd scratch; g++ -shared -o libpython2.2.so -lpthread -lutil -ldl *.o)
install: scratch/libpython2.2.so
mkdir -p $(INSTALLROOT)/lib/python2.2/config
install -m 755 scratch/libpython2.2.so $(INSTALLROOT)/lib
install -m 755 scratch/libpython2.2.so $(INSTALLROOT)/lib/python2.2/config
This makefile fragment works on the assumption that libpython2.2.a
was compiled with the PIC options. This is usually the case
with python and thus all we need to do is rearchive the .a
into the .so format.
Babel (as of version 0.10.2) does not use or require MPI.
However, down-stream CCA codes often do. The easiest way
to correctly build all MPI codes down stream from babel is to
tell babel to use the mpi-supporting compilers or compiler wrappers
that come with most MPI implementations. Babel's autoconf/automake-based build will not use the MPI compilers by default. They key to getting the right compilers is to
set the corresponding environment variables. Most commonly, the
following environment variables will help babel get it right
if set before running configure and installing babel.
CC MPI C compiler command
F77 MPI Fortran 77 compiler command
CXX MPI C++ compiler command
FC MPI Fortran 90 compiler command
On 64 bit platforms, and often with Fortran compilers, there
are compiler flags that control the memory (byte) sizes of
pointers, floating point, and integer variables. To work correctly,
these flags must be used consistently throughout the build process.
Tests in the babel configuration process compile code to check
these sizes, so if a size-adjusting flag is going to be used
in later code, babel must be configured to match. The following
environment variables will help babel get it right if set
before running configure and installing babel. These flags may
also be needed to control MPI compilation.
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>
FFLAGS Fortran 77 compiler flags
CXXFLAGS C++ compiler flags
FCFLAGS Fortran compiler flags
After babel is installed, these variables do not need to remain
in the environment. Down-stream tools will query babel-config
to discover what compilers and options babel was installed with.
FORTRAN 90 support in babel requires the CHASM interop library
available from source forge and Los Alamos National Labs.
If you don't need fortran90 support, simply skip it when configuring babel:
--disable-fortran90
Otherwise, you may need to additionally specify the CHASMPREFIX
environment variable to help babel locate chasm.
Additional help on environment variables that influence
the babel build and additional switches can be obtained by
reading the output of:
./configure --help
in the babel source directory.