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 four options- download and install via Git (recommended)
- download and install via mercurial
- access tarballs directly from 'master' branch.
- access the nightly tarball snapshot at http://ftp.mcs.anl.gov/pub/petsc/petsc-dev.tar.gz
1. Using Git
Install Git if it is not already installed on your machine. Once Git is installed obtain petsc-dev with the following:git clone https://bitbucket.org/petsc/petsc
cd petsc
git pull
./$PETSC_ARCH/conf/reconfigure-$PETSC_ARCH.py
make
- git help [or]
- man git
- [developer instructions at our wiki]
- [Pro Git book]
2. Using Mercurial
To use mercurial - first install the software-
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 https://bitbucket.org/petsc/petsc-hg
cd petsc-hg
hg pull -u
./$PETSC_ARCH/conf/reconfigure-$PETSC_ARCH.py
make
- hg help [or]
- man hg
- http://hginit.com [mercurial tutorial]
3. Tarball of 'master'
One can obtain the current petsc-dev repositories as
tarball from the git server using the following URL:
Note 1:
This mode is useful if you are on a machine where you cannot install Git or if it has a firewall blocking http downloads.
After the tarballs is obtained - do the following:tar zxf petsc-petsc-CHANGESET.tar.gz
mv petsc-petsc-CHANGESET petsc-dev
To update this copy of petsc-dev, re-download the above tarball. The URL above gets the latest changes immediately when they are pushed to the repository.
4. Nightly tarball
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