These pages are for people interested in using the development copy of PETSc (called petsc-dev) or contributing to the PETSc libraries. This information is intended only for people who are experienced with building, using, and debugging PETSc. If you cannot use makefiles, a debugger, and EMACS etags, then please don't access these pages.
Consider joining petsc-dev mailing-list.How to:
- browse sources in the repository
- obtain petsc-dev (the development version)
- compile petsc-dev
- build documentation for petsc-dev
- add code/patches to the master copy of petsc-dev
- check nightlybuild logs
- add a new PC type
- add a new KSP type
- add a new subclass of a matrix type (implementation inheritence)
Browsing source:
One can browse the development repositories at the following locationObtaining the development version of PETSc:
You have three options- download and install mercurial (recommended)
- access tarballs directly from our mercurial server.
- access the nightly tarball snapshot at http://ftp.mcs.anl.gov/pub/petsc/petsc-dev.tar.gz
-
Linux:
- Debian and Ubuntu:
apt-get install mercurial
- Fedora:
yum install mercurial
- Gentoo:
emerge mercurial
- Debian and Ubuntu:
-
MacOS:
- Download prebuilt binaries.
- Macports:
port install mercurial
- Windows:
-
Source:
- Download source tarball. Install with instructions. On Linux this requires that python be built with zlib and include the python C include files. You may need to ask your sysadmin to install python-devel, zlib-devel [or equivalnet] packages before building Mercurial.
hg clone http://petsc.cs.iit.edu/petsc/petsc-dev
cd petsc-dev
edit .hg/hgrc and the two lines
[hooks] post-pull = "$HG" $HG_ARGS -u $@ --cwd config/BuildSystem
hg clone http://petsc.cs.iit.edu/petsc/BuildSystem config/BuildSystem
cd petsc-dev
hg pull -u
cd petsc-dev
./$PETSC_ARCH/conf/reconfigure-$PETSC_ARCH.py
make
- hg help [or]
- man hg
- http://hginit.com [mercurial tutorial]
2) One can obtain the current petsc-dev and BuildSystem repositories as tarballs from the mercurial server using the following URLs:
- http://petsc.cs.iit.edu/petsc/petsc-dev/archive/tip.tar.gz
- http://petsc.cs.iit.edu/petsc/BuildSystem/archive/tip.tar.gz
Note 1:
This mode is useful - if you are on a machine where you cannot install mercurial - or if it has a firewall blocking http downloads.
Note 2:
If using a web browser to download - the tarballs will get the names petsc-dev-CHANGESET.tar.gz and BuildSystem-CHANGESET.tar.gz. However, ifwget
or curl
is used - both tarballs will get
the name 'tip.tar.gz'. In this case rename the tarballs [to avoid the
name conflict].
After both the tarballs are obtained - do the following:
tar zxf petsc-dev-CHANGESET.tar.gz
mv petsc-dev-CHANGESET petsc-dev
cd petsc-dev/config
tar zxf BuildSystem-CHANGESET.tar.gz
mv BuildSystem-CHANGESET BuildSystem
To update this copy of petsc-dev, re-download the above two tarballs. Each time the repository gets new changesets, the above url will give the tarballs including the new changes.
3) The nightly tarball will be equivalent to the release tarball - with all the doumentation built. To use the nightly tarball snapshot, simply download http://ftp.mcs.anl.gov/pub/petsc/petsc-dev.tar.gz and extract it.
tar zxf petsc-dev.tar.gz
Compiling and using the development copy (petsc-dev):
Use ./configure to install PETSc, (trouble? please contact us petsc-maint@mcs.anl.gov). And subscribe to the petsc mailing lists.Experimental build systems
-
CMake: The main reasons for using CMake are parallel builds,
dependency analysis, and IDE integration. The following instructions
assume that you have CMake version 2.6 or later installed.
- Configure as usual with ./configure, provide --with-cmake=/path/to/cmake if the CMake executable is not in your PATH.
- Run make in the build directory ($PETSC_DIR/$PETSC_ARCH), the value of the environment variables is not important.
- The generator for the build directory can be changed (e.g. to Eclipse, XCode, Visual Studio) after running configure.
- Multiple builds can run at once.
- If new files are added, the CMake build files can be quickly updated with bin/maint/cmakegen.py. This is done automatically when reconfiguring for any PETSC_ARCH (e.g. $PETSC_ARCH/conf/reconfigure-$PETSC_ARCH.py).
- The CMake build creates the same libraries as PETSc's standard build, the object files are stored privately in the build directory so multiple PETSC_ARCHs can be built simultaneously.
-
builder.py: Run
config/builder.py
Building documentation:
The documentation tools listed below (except for pdflatex) are automatically downloaded and installed by ./configure.
- Sowing: a text processing tool developed by bill gropp.
- C2html: A text processing package required to generate the PETSc documentation.
- A version of pdflatex (for example in teTeX): This package might already be installed on most systems. It is required to generate the users manual (part of the PETSc documentation)
Once pdflatex (from teTeX) is in your PATH you can build the documentation with:
make alldoc LOC=${PETSC_DIR}
Sending patches to update the master copy of petsc-dev:
By submitting code, the contributor gives irretrievable consent to the redistribution and/or modification of the contributed source code as described in the PETSc open source license.
Please read the code standards chapter of the developer guide before sending patches.
One can send us changes to PETSc [perhaps bug fixes or new feature additions] via e-mail. One easy way to do this [if no new files get created] is:
- [get the latest version of petsc-dev using mercurial as descrbed above]
- [make edits]
hg diff > patchfile
- [email patchfile to petsc-maint@mcs.anl.gov]
To undo the changes, one can do 'hg revert' so that subsequent 'hg pull' or 'make pull' will continue to work.
Alternatively, one can send us patches using hg bundle
as
described at
CommunicatingChanges
Once you have gained experience with developing PETSc source code, you can become an active member of our development and push changes directly to the petsc-dev repository. Send mail to petsc-maint@mcs.anl.gov to arrange it.
Developer guide:
The developer guide gives an overview of the design and detailed style specifications.Nightly builds:
The logs for the nightly builds at http://ftp.mcs.anl.gov/pub/petsc/nightlylogs
PETSc developers can automatically log into any PETSc test directory with ${PETSC_DIR}/bin/maint/petscgoto arch-of-test-system
The coverage(what lines of source code are tested in the nightly builds) can be found at http:/www.mcs.anl.gov/petsc/petsc-dev/index_gcov1.html