Contributing to PETSc#
As you gain experience in building, using, and debugging with PETSc, you will be able to contribute!
Before contributing code to PETSc, please read PETSc Style and Usage Guide. You may also be interested to read about The Design of PETSc.
PETSc uses Git, GitLab, and it’s testing system, for its source code management. All new code in PETSc is accepted via merge requests (MRs).
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.
How-Tos#
Some of the source code is documented to provide direct examples/templates for common contributions, adding new implementations for solver components:
Setting up Git#
We provide some information on common operations here; for more details, see git help
, man git
, or the Git book.
Install Git if it is not already installed on your machine, then obtain PETSc with the following:
Set up your Git environment to establish your identity.
To stay oriented when working with branches, we encourage configuring git-prompt.
To get tab-completion for Git commands, one can download and then source git-completion.bash.
Obtaining the development version of PETSc#
If you have write access to the PETSc GitLab repository, use
git clone git@gitlab.com/petsc/petsc
(or use a clone you already have).Otherwise, Create a fork (your own copy of the PETSc repository).
You will be asked to “Select a namespace to fork the project”; click the green “Select” button.
If you already have a clone on your machine of the PETSc repository you would like to reuse
$ git remote set-url origin [email protected]:YOURGITLABUSERNAME/petsc.git
otherwise
$ git clone [email protected]:YOURGITLABUSERNAME/petsc.git
PETSc can now be configured as specified on the Installation page
To update your copy of PETSc
$ git pull
Once updated, you will usually want to rebuild it completely
$ make reconfigure all
This is equivalent to
$ $PETSC_DIR/$PETSC_ARCH/lib/petsc/conf/reconfigure-$PETSC_ARCH.py && make all