Docs: Installation: UNIX
Required Software:
Prior to installing PETSc, the machine must have:
- An implementation of MPI. Parallel machines come with one provided by the vendors;
check with your support staff. We recommend
using the vendor-provided implementation of MPI if it has been installed,
since this usually provides better performance than the freeware versions. Otherwise, we
recommend MPICH, which is available at http://www.mcs.anl.gov/mpi/mpich.
If MPI is not yet installed on your system, retrieve a version of MPI, install it, and run
the example programs before proceeding further.
For users who are
interested ONLY in running PETSc sequentially, we have included a stripped-down version of
MPI that allows PETSc to be compiled without installing an external version of MPI. This
setup allows the user to run ONLY uniprocessor PETSc programs, not parallel ones.
- A copy of the BLAS and LAPACK. Many machines provide math libraries that contain BLAS or
LAPACK. For example, the DEC alpha provides DXML, and the IBM rs6000 provides
ESSL. Check with your support staff. The BLAS library on some
machines may be found as /usr/lib/libblas.a. If these libraries are not already installed
on the target architecture, they can be obtained from ftp://ftp.mcs.anl.gov/pub/petsc/fblaslapack.tar.gz. We recommend using the vendor-provided BLAS when
possible.
Optional Packages:
PETSc provides an interface to several software
packages.. These should be installed before installing PETSc. These packages are not
developed, maintained, or supported by the PETSc team; we merely provide an interface to
them. More details on installing for optional
packages.
Installing PETSc:
- Obtain the installation file.
- The PETSc distribution can be unbundled with
gunzip -c petsc.tar.gz | tar xof -
By default, this will create a directory called petsc-2.1.3 and unpack the software
there.
- Refer to http://www.mcs.anl.gov/petsc/petsc-patches.html
for fixes for the latest PETSc release.
- Set the environmental variable PETSC_DIR to the full path
of the PETSc home directory, for example,
setenv PETSC_DIR
/home/username/petsc-2.1.3
- Set the environmental variable PETSC_ARCH, which indicates
the architecture on which PETSc will be configured. For example, use
setenv PETSC_ARCH solaris_gnu
setenv PETSC_ARCH rs6000_sp
setenv PETSC_ARCH `$PETSC_DIR/bin/petscarch`
Note that using the petscarch command will only work if you are
using the default installation compilers on your machine.
- Edit the file ${PETSC_DIR}/bmake/${PETSC_ARCH}/packages to indicate the local
installation of MPI, LAPACK, BLAS, X-windows, and the
optional software packages. More details on
installing for optional packages.
Note: If installing ONLY a
uniprocessor version of PETSc, then installation of an MPI implementation is not required.
Instead, the following MPI locations can be used in the ${PETSC_DIR}/bmake/${PETSC_ARCH}/packages file:
MPI_LIB =
${PETSC_DIR}/lib/lib${BOPT}/${PETSC_ARCH}/libmpiuni.a
MPI_INCLUDE = -I${PETSC_DIR}/src/sys/src/mpiuni
MPIRUN = ${PETSC_DIR}/src/sys/src/mpiuni/mpirun
- It may also be necessary to edit the following file ${PETSC_DIR}/bmake/${PETSC_ARCH}/variables to change the names of the C, C++, or
Fortran compilers from their defaults:
- Solaris using the GNU compilers: use PETSC_ARCH=solaris_gnu
- IBM rs6000 using the GNU compilers: use PETSC_ARCH=rs6000_gnu
- CRAY t3d: make sure the enviornmental variable TARGET is set to cray-t3d
Installing PETSc using
configure:
Instead of using the traditional method of modifying files in bmake/${PETSC_ARCH} in order to configure
PETSc, the GNU autoconfiguration system may also be used. To use this
approach do the following:
- set the PETSC_DIR environment variable to the location of PETSc
setenv PETSC_DIR
/home/username/petsc-2.1.3
- set the PETSC_ARCH environment variable using config/configarch
setenv PETSC_ARCH `${PETSC_DIR}/config/configarch`
- run the script ${PETSC_DIR}/bin/bootstrap. This sets up the initial
makefiles so that make can be used with configure
${PETSC_DIR}/bin/bootstrap
- now specify the configure options in the file config/configure_options.${PETSC_ARCH}
For example, if PETSC_ARCH is determined by confg/configarch as linux-gnu,
then specify the options to configure in the file config/configure_options.linux-gnu.
All options requiring quotes should use single quotes only.
- now configure and build the libraries using the make target 'all'
make
Notes:
- We have tested configure only on linux, solaris, irix machines. Check
config/configure_options.* for some of the defaults.
- The build defaults to building BOPT=g version of libraries. If a
different version is required, one can use the appropriate BOPT with
make.
- configure script can be used directly, by specifying options on the
command line, but we recommend using the above method.
- If errors occur, one can check configure_log.petsc for additional
information.
- The PETSC_ARCH should match configarch output - otherwise configure
will abort the build.
- There are two make targets which may be useful . The configure_petsc target forces
execution of configure with the user-specified options, after first checking all the depedencies and rebuilding
configure if necessary. The configure target will merely recreate
configure if necessary.
- There is a bug in the most prevelant version of Autoconf, 2.13, which concerns macros taking arguments. We
encourage you to upgrade to Autconf 2.52 which will eliminate this problem.
Test programs:
- If the installation went smoothly, then try running some test examples with the command
make BOPT=g testexamples >& examples_log
- If only the uniprocessor version of PETSc has been installed (i.e., MPI has not been
installed), then use the following command to run only sequential examples:
make BOPT=g testexamples_uni >& examples_log
- Examine the file examples_log for any obvious errors or problems.
- The examples can be manually built and run one at a time by changing to the appropriate
directory (for instance, ${PETSC_DIR}/src/sles/examples/tutorials) and running commands
such as
make BOPT=g ex1
make runex1 (or, for example, mpirun ex1)
This alternative may be preferable if "make BOPT=g testexamples" fails for some
reason.
- The automatic tests may not work on systems that use a queue and special commands to run
parallel jobs. Instead, the user can compile and run the examples manually as
discussed above.
- To test the graphics examples, move to ${PETSC_DIR}/src/sys/src/draw/examples/tests;
then make and run the examples manually. These examples will open an X window and draw
some graphics.
Fortran Users:
The PETSc Fortran libraries are built automatically during the installation outlined
above. Before testing the fortran examples, please make sure that the c-version of the examples work correctly.
- To compile and test the Fortran examples, use the command
make BOPT=g testfortran >& fortran_log
PETSc Fortran programs can use the suffix .F rather than the traditional suffix .f, so
that the PETSc header files can be easily included in Fortran programs. See the Fortran
chapter within the users manual for additional details regarding the Fortran interface. In
order to use the suffix .f instead of .F, the user must edit the file ${PETSC_DIR}/include/foldinclude/petsc.h
to hardwire the path for the local MPI include file. See the chapter 'PETSc Fortran Users'
in the users manual for more information.
Multiple Installations:
When building PETSc for two or more machine types that share a common filesystem, for
example sun4 and hpux, multiple PETSc directory trees are NOT needed.
Only a single PETSc directory can (and should) be used; PETSc automatically places the
libraries for each machine in a different location. In particular, the libraries for a
given BOPT and PETSC_ARCH are installed in the directory,
${PETSC_DIR}/lib/lib${BOPT}/${PETSC_ARCH}.
Shared Libraries:
PETSc supports the use of shared libraries for the machines
solaris, alpha, IRIX, IRIX64, freebsd, and linux to
enable faster linking and smaller executables. These libraries are built
automatically during installation. In addition, PETSc now defaults to using these
libraries as dynamic libraries on these machines. For most users this does not matter.
Machines without Fortran compiler: On
machines that do not have a fortran compiler, like BeOS, MacOS-X, please
download and install f2c version of blas and lapack - f2cblaslapack.tar.gz.
Special Blas and Lapack. Some
machines have special blas and lapack. These have some missing symbols
missing or define prototypes for certain functions differently. When using
ESSL on AIX machines, you might want to use the following additional flag in
'packages file' BLASLAPACK_LIB = -lessl
PETSC_BLASLAPACK_FLAGS = -DPETSC_BLASLAPACK_ESSL_ONLY
PETSC_HAVE_ESSL = -DPETSC_HAVE_ESSL
When using cray T3E use: BLASLAPACK_LIB
=
PETSC_BLASLAPACK_FLAGS = -DPETSC_BLASLAPACK_CRAY_ONLY
|