Installing dolfin-adjoint

Note: If you are looking to install the (deprecated) dolfin-adjoint/libadjoint library, visit the dolfin-adjoint/libadjoint webpage.

What is the difference between dolfin-adjoint/pyadjoint and dolfin-adjoint/libadjoint?

Docker images (all platforms)

Docker allows us to build and ship consistent high-performance dolfin-adjoint installations with FEniCS for almost any platform. To get started, follow these 2 steps:

  1. Install Docker. Mac and Windows users should install the Docker Toolbox (this is a simple one-click install) and Linux users should follow these instructions.

If running on Mac or Windows, make sure you run the following commands inside the Docker Quickstart Terminal.

dolfin-adjoint with FEniCS:

First the FEniCS Docker script:

curl -s https://get.fenicsproject.org | bash

Once both Docker and the FEniCS Docker script have been installed, you can easily start a FEniCS session with dolfin-adjoint by running the following command:

fenicsproject run quay.io/dolfinadjoint/pyadjoint:2018.1.0

A Jupyter notebook instance with a user defined name (here myproject) can be started with:

fenicsproject notebook myproject quay.io/dolfinadjoint/pyadjoint
fenicsproject start myproject

The FEniCS Docker script can also be used to create persistent sessions:

fenicsproject create myproject quay.io/dolfinadjoint/pyadjoint
fenicsproject start myproject

To create a session that has access to the current folder from the host:

docker run -ti -v $(pwd):/home/fenics/shared quay.io/dolfinadjoint/pyadjoint

dolfin-adjoint development version with FEniCS:

The development version of dolfin-adjoint and FEniCS is available with:

fenicsproject run quay.io/dolfinadjoint/pyadjoint:latest

To update the development container, run:

fenicsproject pull quay.io/dolfinadjoint/pyadjoint:latest

To see all the options run:

fenicsproject help

dolfin-adjoint development version with Firedrake:

The development version of dolfin-adjoint and Firedrake is available with:

docker run -it -v `pwd`:/home/firedrake/shared quay.io/dolfinadjoint/pyadjoint-firedrake:latest

To update the development container, run:

docker pull quay.io/dolfinadjoint/pyadjoint-firedrake:latest

PIP (all platforms)

Install dolfin-adjoint and its Python dependencies with pip:

pip install git+https://bitbucket.org/dolfin-adjoint/pyadjoint.git@2018.1.0

Test your installation by running:

python3 -c "import fenics_adjoint"

Firedrake-adjoint with their Firedrake installation script

If you already have installed firedrake with their installation script, pyadjoint can be installed by simply running:

firedrake-update --install pyadjoint

Optional dependencies:

Source code

The source code of pyadjoint is available on https://bitbucket.org/dolfin-adjoint/pyadjoint.