Docs: Installation: Configure
PETSc's New Configure
For version 2.1.5, we have rewritten the standard configure script in
Python. This greatly increased its
modularity and extensibility. All standard autoconf functionality is replicated, so that there is no division
between the generation and execution of the configuration script.
This Python configure outputs files identical to those in the current PETSc
bmake system. Thus, the
user may edit these after configuration if necessary, and all current bmake configurations will continue to function
properly. The Python Configure is currently a beta product and we do expect problems on some architectures. Please report
all failures to petsc-maint@mcs.anl.gov along with the configure.log file from the directory in which
configure was run, usually ${PETSC_DIR}. Please note that this configure requires
python version 2.2 or newer.
Installing PETSc with Python Configure
setenv PETSC_DIR path_to_petsc_localtion
cd $PETSC_DIR
setenv PETSC_ARCH `bin/configarch`
./config/configure.py --help
./config/configure.py [configure options]
make BOPT=g all
To install PETSc with python configure - one has to set the PETSC_ARCH to the value detected by
$PETSC_DIR/bin/configarch script. It is recommended to run the Python configure script from
${PETSC_DIR}.
Options can be specified to this script exactly as with the familiar configure.
config/configure.py will
create files in bmake/$PETSC_ARCH dir. With these files, PETSc can now be build as usual with the command:
make BOPT=g all
Notes
You must specify the PETSC_ARCH environment variable using $PETSC_DIR/bin/configarch , before running
configure. You may also specify this variable as an argument to configure itself. The value of PETSC_ARCH must contain
the configure guess for the architecture as a prefix, in order to prevent clashes with existing PETSc bmake files.
If it does not, you will receive and error message like the following:
PETSC_ARCH (linux) does not have our guess (linux-gnu) as a prefix!
To output the full list of configure options, use configure.py --help. All options are valid with single or
double dashes, so -help would also work.
In order to simplify this process, PETSc provides helper scripts for several architectures in the
config directory. These scripts are intended as templates, for which you
fill in the appropriate variables for your own system. For instance, on a Linux system, you might use
config/configure.linux-gnu, changing the arguments in the script to reflect the locations of BLAS, LAPACK, and
MPI on your system.
Specifying Packages
Currenlty configure can detect BLAS, LAPACK, MPI.
Configure will look for standard packages in many well-known locations, however exhaustive searches are not only
impractical, but can often locate an inappropriate version of the package. Therefore, it is often necessary to indicate
the location of a given package on the system. We will take MPI as our example. Most packages can be specified by giving
the include directory and a library, as in
configure.py --with-mpi-include=/usr/local/mpich/include --with-mpi-lib=/usr/local/mpich/lib/libmpich.a
Notice that the library argument indicates the actual library file rather than the directory. In the case of MPI, we
also need an additional argument to indicate that it is active:
configure.py --with-mpi --with-mpi-include=/usr/local/mpich/include --with-mpi-lib=/usr/local/mpich/lib/libmpich.a
In addition, MPI installations often have a predictable interior structure, in which case it is enough to specify the
root directory of the installation:
configure.py --with-mpi --with-mpi-dir=/usr/local/mpich
Some packages, such as BLAS and LAPACK, are primarily Fortran and thus have no include directory.
Maintaining Multiple Configurations
You may maintain multiple configurations in the same way as the current PETSc. Each configuration is assigned a
different PETSC_ARCH, and stored in a different bmake directory. For instance:
cd $PETSC_DIR
./config/configure_linux-gnu.py -PETSC_ARCH=linux-gnu
./config/configure_linux-gnu.py -PETSC_ARCH=linux-gnu-intel --with-cc=icc
Coping with Failures
It will not be unusual in this beta phase of the Python configure for configuration failures to occur. The most
important source of information in these instances is the configure.log file, written in the directory from
which configure was run. This file is always appended to, so make sure to first locate the banner corresponding to the
last configure run. This banner contains the time of the run, configure options, and current working directory. Each
test begins with a separator line. Then its name and module are given, followed by a general documentation
line. Afterwards can be several lines of specific information, such as shell actions, specific headers, libraries, or
functions involved, and so on. If a compile or link fails, we attempt to provide the error message in this log.
Additional Notes
The core modules exist in the
BuildSystem.config package, whereas the custom PETSc configuration is present in the PETSc.Configure
module. Users may augment the system with custom modules specified using the -configModules flag.