                     SUNDIALS Installation Instructions
                        Release 2.3.0, August 2006  


These are generic installation instructions. For complete installation instructions, 
consult the user guide for any of the SUNDIALS solvers.

Contents:
1. Basic Installation
2. Installation Names
3. Compilers and Options
  3.1. General options
  3.2. Options for Fortran support
  3.3. Options for MPI support
  3.4. Options for library support
  3.5. Options for Matlab support
  3.6. Environment variables
4. Configuration examples

1. Basic Installation
=====================

The SUNDIALS suite (or individual solvers) are distributed as compressed archives
(.tgz). The name of the distribution archive is of the form 'solver'-x.y.z.tgz,
where 'solver' is one of: 'sundials', 'cvode', 'cvodes', 'ida', or 'kinsol',
and x.y.z represents the version number (of the SUNDIALS suite or of the individual 
solver).

To begin the installation, first uncompress and expand the sources, by issuing

   % tar xzf solver-x.y.z.tgz

This will extract source files under a directory 'solver'-x.y.z.

The installation procedure outlined below will work on commodity linux/unix 
systems without modification. However, users are still encouraged to carefully read 
the entire chapter before attempting to install the SUNDIALS suite, in case
non-default choices are desired for compilers, compilation options, or the like.
In lieu of reading the option list below, the user may invoke the configuration
script with the help flag to view a complete listing of available options, which
may be done by issuing 

   % ./configure --help 

from within the directory created above.

In the remainder of this chapter, we make the following distinctions:

'srcdir' 

  is the directory 'solver'-x.y.z created above; i.e., the 
  directory containing the SUNDIALS sources.

'builddir'

  is the directory under which SUNDIALS is built; i.e., the directory from within 
  which the configure command is issued. Usually, this is the same as 'srcdir'.

'instdir'

  is the directory under which the SUNDIALS exported header files and libraries will 
  be installed. Typically, header files are exported under a directory 'instdir'/include 
  while libraries are installed under 'instdir'/lib, with 'instdir' specified with the 
  --prefix flag to configure. See below for more details on the installation directories, 
  including the special cases of the SUNDIALS examples and the sundialsTB toolbox.

Note: The installation directory 'instdir' should NOT be the same as the source directory 
      'srcdir'.

The installation steps for SUNDIALS can be as simple as 

   % tar xzf solver-x.y.z.tgz
   % cd solver-x.y.z
   % ./configure
   % make
   % make install

in which case the SUNDIALS header files and libraries are installed under /usr/local/include
and /usr/local/lib, respectively. Note that, by default, neither the example programs nor the 
{\sundialsTB toolbox are built and installed.

If disk space is a priority, then to delete all temporary files created by building SUNDIALS, issue

   % make clean

To prepare the SUNDIALS distribution for a new install (using, for example, different options and/or
installation destinations), issue

   % make distclean


2. Installation Names
=====================

By default, 'make install' will install the SUNDIALS libraries under 'libdir' and the public 
header files under 'includedir'. The default values for these directories are 'instdir'/lib 
and 'instdir'/include, respectively, but can be changed using the configure script options
--prefix, --exec-prefix, --includedir, and --libdir (see below). For example, a global 
installation of SUNDIALS on a *NIX system could be accomplished using

   % ./configure --prefix=/opt/sundials-2.3.0

Although all installed libraries reside under 'libdir', the public header files are further 
organized into subdirectories under 'includedir'.

The installed libraries and exported header files are listed for reference in the table below.

A typical user program need not explicitly include any of the shared SUNDIALS header files 
from under the 'includedir'/sundials directory since they are explicitly included by the 
appropriate solver header files (e.g., cvode_dense.h includes sundials_dense.h). 
However, it is both legal and safe to do so (e.g., the functions declared in 
sundials_smalldense.h could be used in building a preconditioner.

The SUNDIALS libraries and header files are summarized below (names are relative to 'libdir' 
for libraries and to 'includedir' for header files)

SHARED module
  header files: sundials/sundials_types.h     sundials/sundials_math.h
                sundials/sundials_config.h    sundias/sundials_nvector.h
                sundials/sunials_smalldense.h sundials/sundials_dense.h
                sundials/sundials_iterative.h sundials/sundials_band.h
                sundials/sundials_spbcgs.h    sundials/sundials_sptfqmr.h
                sundials/sundials_spgmr.h


NVECTOR_SERIAL module
  libraries:    libsundials_nvecserial.{a,so} libsundials_fnvecserial.a
  header files: nvector/nvector_serial.h


NVECTOR_PARALLEL module
  libraries:    libsundials_nvecparallel.{a,so} libsundials_fnvecparallel.a
  header files: nvector/nvector_parallel.h


CVODE module
  libraries:    libsundials_cvode.{a,so} libsundials_fcvode.a
  header files: cvode/cvode.h
                cvode/cvode_dense.h    cvode/cvode_band.h
                cvode/cvode_diag.h     cvode/cvode_spils.h
                cvode/cvode_bandpre.h  cvode/cvode_bbdpre.h
                cvode/cvode_spgmr.h    cvode/cvode_spbcgs.h
                cvode/cvode_sptfqmr.h  cvode/cvode_impl.h


CVODES module
  library:      libsundials_cvodes.{a,so}
  header files: cvodes/cvodes.h
                cvodes/cvodes_dense.h     cvodes/cvodes_band.h
                cvodes/cvodes_diag.h      cvodes/cvodes_spils.h
                cvodes/cvodes_bandpre.h   cvodes/cvodes_bbdpre.h
                cvodes/cvodes_spgmr.h     cvodes/cvodes_spbcgs.h
                cvodes/cvodes_sptfqmr.h   cvodes/cvodes_impl.h
                cvodes/cvodea_impl.h

IDA module
  library:      libsundials_ida.{a,so}
  header files: ida/ida.h
                ida/ida_dense.h    ida/ida_band.h
                ida/ida_spils.h    ida/ida_spgmr.h
                ida/ida_spbcgs.h   ida/ida_sptfqmr.h
                ida/ida_bbdpre.h   ida/ida_impl.h


KINSOL module
  libraries:    libsundials_kinsol.{a,so} libsundials_fkinsol.a
  header files: kinsol/kinsol.h
                kinsol/kinsol_dense.h   kinsol/kinsol_band.h
                kinsol/kinsol_spils.h   kinsol/kinsol_spgmr.h
                kinsol/kinsol_spbcgs.h  kinsol/kinsol_sptfqmr.h
                kinsol/kinsol_bbdpre.h  kinsol/kinsol_impl.h



3. Compilers and Options
========================

Some systems require unusual options for compilation or linking that the `configure' 
script does not know about.  Run `./configure --help' for details on some of the 
pertinent environment variables.

You can give `configure' initial values for these variables by setting them in the 
environment.  You can do that on the command line like this:

     % ./configure CC=gcc CFLAGS=-O2 F77=g77 FFLAGS=-O

Here is a detailed description of the configure options that are pertinent to SUNDIALS. 
In what follows, 'build_tree' is the directory from where 'configure' was invoked.

3.1. General options
--------------------

--help
-h

  print a summary of the options to `configure', and exit.

--quiet
--silent
-q

  do not print messages saying which checks are being made.  To
  suppress all normal output, redirect it to `/dev/null' (any error
  messages will still be shown).


--prefix=PREFIX

  Location for architecture-independent files.
  Default: PREFIX=/usr/local

--exec-prefix=EPREFIX

  Location for architecture-dependent files.
  Default: EPREFIX=/usr/local
  
--includedir=DIR

  Alternate location for header files.
  Default: DIR=PREFIX/include
  
--libdir=DIR

  Alternate location for libraries.
  Default: DIR=EPREFIX/lib

--disable-solver

  Although each existing solver module is built by default, support for a
  given solver can be explicitly disabled using this option. 
  The valid values for solver are: cvode, cvodes, 
  ida, and kinsol.

--enable-examples

  Available example programs are not built by default. Use this option
  to enable compilation of all pertinent example programs. Upon completion of 
  the 'make' command, the example executables will be created under solver-specific
  subdirectories of 'builddir'/examples:

    'builddir'/examples/'solver'/serial :         serial C examples
    'builddir'/examples/'solver'/parallel :       parallel C examples
    'builddir'/examples/'solver'/fcmix_serial :   serial Fortran examples
    'builddir'/examples/'solver'/fcmix_parallel : parallel Fortran examples

  Note: Some of these subdirectories may not exist depending upon the
  solver and/or the configuration options given.

--with-examples-instdir=EXINSTDIR

  Alternate location for example executables and sample output files (valid only if
  examples are enabled). Note that installtion of example files can be completely disabled
  by issuing EXINSTDIR=no (in case building the examples is desired only as a test of
  the sundials libraries).

  Default: DIR=EPREFIX/examples

--with-cppflags=ARG

  Specify additional C preprocessor flags 
  (e.g., ARG=-I<include_dir> if necessary header files are located in nonstandard locations).

--with-cflags=ARG

  Specify additional C compilation flags.

--with-ldflags=ARG

  Specify additional linker flags 
  (e.g., ARG=-L<lib_dir> if required libraries are located in nonstandard locations).

--with-libs=ARG

  Specify additional libraries to be used 
  (e.g., ARG=-l<foo> to link with the library named libfoo.a or libfoo.so).

--with-precision=ARG

  By default, sundials will define a real number (internally referred to as
  realtype) to be a double-precision floating-point numeric data type (double
  C-type); however, this option may be used to build sundials with realtype
  alternatively defined as a single-precision floating-point numeric data type
  (float C-type) if ARG=single, or as a long double C-type if ARG=extended.

  Default: ARG=double

3.2. Options for Fortran support
--------------------------------

--disable-f77

  Using this option will disable all F77 support. The fcvode, fkinsol and
  fnvector modules will not be built regardless of availability.

--with-fflags=ARG

  Specify additional F77 compilation flags.


The configuration script will attempt to automatically determine the
function name mangling scheme required by the specified F77 compiler, but the
following two options may be used to override the default behavior.

--with-f77underscore=ARG

  This option pertains to the fkinsol, fcvode and fnvector F/C interface 
  modules and is used to specify the number of underscores to append to 
  function names so F77 routines can properly link with the associated
  sundials libraries. Valid values for ARG are: none, one, and two.

  Default: ARG=one

--with-f77case=ARG

  Use this option to specify whether the external names of the fkinsol,
  fcvode and fnvector F/C interface functions should be lowercase
  or uppercase so F77 routines can properly link with the associated sundials
  libraries. Valid values for ARG are: lower and upper.

  Default: ARG=lower

3.3. Options for MPI support
----------------------------

The following configuration options are only applicable to the parallel sundials packages:

  
--disable-mpi

  Using this option will completely disable MPI support.

--with-mpicc=ARG
--with-mpif77=ARG

  By default, the configuration utility script will use the MPI compiler
  scripts named mpicc and mpif77 to compile the parallelized
  sundials subroutines; however, for reasons of compatibility, different
  executable names may be specified via the above options. Also, ARG=no
  can be used to disable the use of MPI compiler scripts, thus causing
  the serial C and F compilers to be used to compile the parallelized
  sundials functions and examples.

--with-mpi-root=MPIDIR

  This option may be used to specify which MPI implementation should be used.
  The sundials configuration script will automatically check under the
  subdirectories MPIDIR/include and MPIDIR/lib for the necessary
  header files and libraries. The subdirectory MPIDIR/bin will also be
  searched for the C and F MPI compiler scripts, unless the user uses
  --with-mpicc=no or --with-mpif77=no.

--with-mpi-incdir=INCDIR
--with-mpi-libdir=LIBDIR
--with-mpi-libs=LIBS

  These options may be used if the user would prefer not to use a preexisting
  MPI compiler script, but instead would rather use a serial complier and
  provide the flags necessary to compile the MPI-aware subroutines in
  sundials.

  Often an MPI implementation will have unique library names and so it may
  be necessary to specify the appropriate libraries to use (e.g., LIBS=-lmpich).

  Default: INCDIR=MPIDIR/include, LIBDIR=MPIDIR/lib and LIBS=-lmpi

--with-mpi-flags=ARG

  Specify additional MPI-specific flags.

3.4. Options for library support
--------------------------------

By default, only static libraries are built, but the following option
may be used to build shared libraries on supported platforms.

--enable-shared

  Using this particular option will result in both static and shared versions
  of the available sundials libraries being built if the systsupports
  shared libraries. To build only shared libraries also specify --disable-static.

  Note: The fcvode and fkinsol libraries can only be built as static
  libraries because they contain references to externally defined symbols, namely
  user-supplied F77 subroutines.  Although the F77 interfaces to the serial and
  parallel implementations of the supplied nvector module do not contain any
  unresolvable external symbols, the libraries are still built as static libraries
  for the purpose of consistency.

3.5. Options for Matlab support
-------------------------------

The following options are relevant only for configuring and building 
the sundialsTB Matlab toolbox:

--enable-sundialsTB

  The sundialsTB Matlab toolbox is  not built by default. Use this option
  to enable configuration and compilation of the mex files. Upon completion
  of the make command, the following mex files will be created:
    'builddir'/sundialsTB/cvodes/cvm/cvm.'mexext'
    'builddir'/sundialsTB/idas/idm/idm.'mexext'
    'builddir'/sundialsTB/kinsol/kim/kim.'mexext'
  where 'mexext' is the platform-specific extension of mex files.
  
--with-sundialsTB-instdir=STBINSTDIR

  Alternate location for the installed sundialsTB toolbox (valid only if
  sundialsTB is enabled). As for the example programs, installation of sundialsTB can 
  be completely disabled by issuing STBINSTDIR=no (in case building the toolbox is desired 
  but its installtion will be done manually afterwards). Otherwise, all required sundialsTB 
  files will be installed under the directory STBINSTDIR/sundialsTB.

  Default: DIR=MATLAB/toolbox  (see below for the definition of MATLAB).

--with-matlab=MATLAB

  This option can be used to specify the locatin of the Matlab installation. 
  If it is defined, the environment variable MATLAB will be used. Otherwise,
  the configure system will attempt to infer MATLAB from the location of
  the matlab executable.

--with-mex=ARG

  Specify the mex compiler to be used.

  Default: ARG=MATLAB/bin/mex

--with-mexopts=ARG

  Specify the mex options file to be used.

  Default: Standard Matlab mex options file.

3.6. Environment variables
--------------------------

The following environment variables can be locally (re)defined for use during the 
configuration of sundials. See the next section for illustrations of these.

CC

F77

  Since the configuration script uses the first C and F77 compilers found in
  the current executable search path, then each relevant shell variable (CC
  and F77) must be locally (re)defined in order to use a different compiler. 
  For example, to use xcc (executable name of chosen compiler) as the C
  language compiler, use CC=xcc in the configure step.

CFLAGS

FFLAGS

  Use these environment variables to override the default C and F77 compilation flags.

4. Configuration examples
=========================

The following examples are meant to help demonstrate proper usage of the configure options.

To build SUNDIALS using the default C and Fortran compilers, and default mpicc and mpif77 
parallel compilers, enable compilation of examples, build the Matlab mex files for sundialsTB, 
and install it under /home/myname/matlab/sundialsTB, use

   % ./configure --prefix=/home/myname/sundials --enable-examples \
                 --enable-sundialsTB --with-sundialsTB-instdir=/home/myname/matlab

To disable installation of the examples, use:
   % ./configure --prefix=/home/myname/sundials \
                 --enable-examples --with-examples-instdir=no \
                 --enable-sundialsTB --with-sundialsTB-instdir=/home/myname/matlab


The following example builds SUNDIALS using gcc as the serial C compiler, g77 as the serial 
Fortran compiler, mpicc as the parallel C compiler, mpif77 as the parallel Fortran compiler, 
and appends the -g3 compilaton flag to the list of default flags:

   % ./configure CC=gcc F77=g77 --with-cflags=-g3 --with-fflags=-g3 \
                 --with-mpicc=/usr/apps/mpich/1.2.4/bin/mpicc \ 
                 --with-mpif77=/usr/apps/mpich/1.2.4/bin/mpif77

The next example again builds SUNDIALS using gcc as the serial C compiler, but the 
--with-mpicc=no option explicitly disables the use of the corresponding MPI compiler 
script. In addition, since the  --with-mpi-root option is given, the compilation flags
-I/usr/apps/mpich/1.2.4/include and -L/usr/apps/mpich/1.2.4/lib are passed to gcc when 
compiling the MPI-enabled functions. 
The --disable-examples option explicitly disables the examples (which means a Fortran 
compiler is not required).
The --with-mpi-libs option is required so that the configure script can check if gcc 
can link with the appropriate MPI library.

   % ./configure CC=gcc --disable-examples --with-mpicc=no \
                 --with-mpi-root=/usr/apps/mpich/1.2.4 \
                 --with-mpi-libs=-lmpich
