Skip to content

Commit 8070ef0

Browse files
authored
Update Firedrake installation instructions and workflow (#125)
Closes #112. The Firedrake installation approach moved away from the `firedrake-install` script and is now clearly separated in three distinct steps that are described in https://www.firedrakeproject.org/install.html and that are very easy for users to follow. We follow their instructions almost exactly as described, except that we pass some extra flags to PETSc's `configure` (`--download-parmmg` etc.). So here I removed a lot of our own installation instructions, as well as related files that we used to aid the installation process.
1 parent 8971908 commit 8070ef0

5 files changed

Lines changed: 44 additions & 182 deletions

File tree

.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/test_firedrake_install.yml

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: 'Test Firedrake Installation'
22

33
on:
4-
# Trigger when this or any file in the install directory changes
4+
# Trigger when this workflow changes in an open PR
55
pull_request:
66
paths:
7-
- 'install/**'
87
- '.github/workflows/test_firedrake_install.yml'
98

109
# Trigger the workflow on the 1st day of every month at midnight
@@ -26,53 +25,54 @@ jobs:
2625
container:
2726
image: ubuntu:24.04
2827
options: --user root
28+
env:
29+
OMPI_ALLOW_RUN_AS_ROOT: 1
30+
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
2931

3032
steps:
31-
- name: 'Install required packages'
33+
- name: Fix HOME
34+
# GitHub sets HOME to /github/home (https://github.com/actions/runner/issues/863)
35+
run: echo "HOME=/root" >> "$GITHUB_ENV"
36+
37+
- name: 'Install system dependencies'
3238
run: |
3339
apt-get update
3440
apt-get -y dist-upgrade
35-
apt-get install -y --no-install-recommends tzdata curl vim docker.io \
36-
openssh-client build-essential autoconf automake cmake gfortran git \
37-
libopenblas-serial-dev libtool python3-dev python3-pip python3-tk \
38-
python3-venv python3-requests zlib1g-dev libboost-dev sudo gmsh bison flex \
39-
ninja-build libocct-ocaf-dev libocct-data-exchange-dev swig graphviz \
40-
libcurl4-openssl-dev libxml2-dev
41+
apt-get -y install curl python3 python3-pip python3-venv
42+
curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-configure
43+
apt-get -y install $(python3 firedrake-configure --show-system-packages)
4144
42-
- name: 'Download necessary files'
45+
- name: 'Install PETSc'
4346
run: |
44-
curl -O https://raw.githubusercontent.com/mesh-adaptation/mesh-adaptation-docs/main/install/Makefile
45-
curl -O https://raw.githubusercontent.com/mesh-adaptation/mesh-adaptation-docs/main/install/petsc_configure_options.txt
47+
git clone --depth 1 --branch $(python3 firedrake-configure --show-petsc-version) https://gitlab.com/petsc/petsc.git
48+
cd petsc
49+
python3 ../firedrake-configure --show-petsc-configure-options | xargs -L1 ./configure --with-make-np=8 --download-eigen --download-parmetis --download-mmg --download-parmmg
50+
make PETSC_DIR=$(pwd) PETSC_ARCH=arch-firedrake-default all
51+
make check
4652
4753
- name: 'Install Firedrake'
4854
run: |
49-
yes | make install
50-
cd firedrake-*/
51-
echo "FIREDRAKE_ENV=$(pwd)" >> $GITHUB_ENV
52-
53-
- name: 'Upload firedrake-install.log as an artifact'
54-
if: ${{ !cancelled() }}
55-
uses: actions/upload-artifact@v4
56-
with:
57-
name: firedrake-install-log
58-
path: firedrake-install.log
59-
retention-days: 1
60-
overwrite: true
55+
python3 -m venv venv
56+
. venv/bin/activate
57+
export $(python3 firedrake-configure --show-env)
58+
pip cache remove petsc4py
59+
pip install --no-binary h5py --src . -e git+https://github.com/firedrakeproject/firedrake.git#egg=firedrake[check]
6160
61+
# Do not call `make test` here since we need --use-hwthread-cpus for nprocs=3 tests
6262
- name: 'Install and test Animate'
6363
run: |
64-
. $FIREDRAKE_ENV/bin/activate
65-
cd $FIREDRAKE_ENV/src
64+
. venv/bin/activate
6665
git clone https://github.com/mesh-adaptation/animate.git
6766
cd animate
6867
make install_dev
69-
make test
68+
python3 -m pytest -v -k "parallel[1] or not parallel" test
69+
mpiexec -n 2 python3 -m pytest -v -m parallel[2] test
70+
mpiexec -n 3 --use-hwthread-cpus python3 -m pytest -v -m parallel[3] test
7071
7172
- name: 'Install and test Goalie'
7273
if: ${{ !cancelled() }}
7374
run: |
74-
. $FIREDRAKE_ENV/bin/activate
75-
cd $FIREDRAKE_ENV/src
75+
. venv/bin/activate
7676
git clone https://github.com/mesh-adaptation/goalie.git
7777
cd goalie
7878
make install_dev
@@ -81,8 +81,7 @@ jobs:
8181
- name: 'Install and test Movement'
8282
if: ${{ !cancelled() }}
8383
run: |
84-
. $FIREDRAKE_ENV/bin/activate
85-
cd $FIREDRAKE_ENV/src
84+
. venv/bin/activate
8685
git clone https://github.com/mesh-adaptation/movement.git
8786
cd movement
8887
make install_dev

install/Makefile

Lines changed: 0 additions & 93 deletions
This file was deleted.

install/petsc_configure_options.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

wiki/Installation-Instructions.md

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,36 @@
11
The following installation instructions assume a Linux or Windows Subsystem for Linux (WSL) operating system.
2-
The mesh adaptation modules are dependent on a custom setup for Firedrake with PETSc from either a [Makefile](#default-approach) or a [Docker image](#installing-firedrake-via-docker-image).
2+
The mesh adaptation modules are dependent on a custom setup for Firedrake with PETSc from either a [local installation](#local-firedrake-installation) or a [pre-built Docker image](#installing-firedrake-via-docker-image).
33
Once Firedrake is installed (or if you already have a working installation), see the section on [installing Animate, Goalie, or Movement](#installing-animate-goalie-or-movement).
44

5-
## Installing Firedrake with custom PETSc
5+
## Local Firedrake installation
66

7-
Firedrake and PETSc are required by Animate, Goalie, and Movement. Choose from the following installation approaches for these packages.
7+
As described on the [Firedrake installation page](https://www.firedrakeproject.org/install.html#), a native installation of Firedrake is accomplished in 3 steps:
8+
1. Installing systems dependencies
9+
2. Installing PETSc
10+
3. Installing Firedrake itself.
811

9-
### Default approach
10-
11-
The first approach uses the default MPI packages found in the path.
12-
Run the following code to download and install Firedrake and PETSc using the associated Makefile and bespoke PETSc options:
13-
```
14-
curl -O https://raw.githubusercontent.com/mesh-adaptation/mesh-adaptation-docs/main/install/Makefile
15-
curl -O https://raw.githubusercontent.com/mesh-adaptation/mesh-adaptation-docs/main/install/petsc_configure_options.txt
16-
make install
17-
```
18-
19-
The `make install` command accepts several optional arguments:
20-
* `FIREDRAKE_ENV` for setting the Firedrake virtual environment name. Defaults to `firedrake-mmmyy`, where `mmm` is the first three letters of the current month and `yy` are the last two digits of the current year.
21-
* `BUILD_DIR` for setting the build directory. Defaults to the current directory.
22-
* `PETSC_CONFIGURE_FILE` for setting the PETSc configure options. Defaults to `petsc_configure_options.txt`.
23-
These options may be combined, e.g.:
24-
```
25-
make install FIREDRAKE_ENV=firedrake-dev BUILD_DIR=/scratch PETSC_CONFIGURE_FILE=my_configure_file.txt
26-
```
27-
28-
### Custom MPI approach
29-
30-
The second approach allows customisation of the MPI packages by passing arguments to the associated Makefile. First, download the Makefile and bespoke PETSc options using `curl`:
31-
```
32-
curl -O https://raw.githubusercontent.com/mesh-adaptation/mesh-adaptation-docs/main/install/Makefile
33-
curl -O https://raw.githubusercontent.com/mesh-adaptation/mesh-adaptation-docs/main/install/petsc_configure_options.txt
34-
```
35-
When running `make install`, pass arguments for `MPICC`, `MPICXX`, `MPIF90`, and `MPIEXEC`:
12+
To use the mesh adaptation modules, we can install system dependencies (step 1) and Firedrake (step 3) exactly as described, but we must [customise the PETSc installation](https://www.firedrakeproject.org/install.html#id29) (step 2) to install additional packages: Eigen, ParMETIS, MMG, and ParMMG. We do that simply by passing the `--download-<PACKAGE>` flags when running PETSc `configure`:
3613
```
37-
make install MPICC=/path/to/mpicc MPICXX=/path/to/mpicxx MPIF90=/path/to/mpif90 MPIEXEC=/path/to/mpiexec
14+
python3 ../firedrake-configure --show-petsc-configure-options | xargs -L1 ./configure --download-chaco --download-eigen --download-parmetis --download-mmg --download-parmmg
3815
```
3916

4017
## Docker container approach
4118

42-
A bespoke Firedrake Docker container exists and can be downloaded and installed as an alternative to the above:
19+
A bespoke Firedrake Docker image exists and can be downloaded and run as an alternative to the above:
4320
```
4421
docker pull ghcr.io/mesh-adaptation/firedrake-parmmg:latest
45-
docker run --rm -it -v ${HOME}:${HOME} ghcr.io/mesh-adaptation/firedrake-parmmg:latest
22+
docker run -it ghcr.io/mesh-adaptation/firedrake-parmmg:latest
4623
```
4724

48-
NOTE: by installing via a Docker image with ``${HOME}`` you are giving Docker access to your home space.
25+
For more information on how to run docker containers, see the [official documentation](https://docs.docker.com/engine/containers/run/). For example, since all data inside a container is only accessible from inside the container, it is useful to create [filesystem mounts](https://docs.docker.com/engine/containers/run/#filesystem-mounts) to be able to access data from outside the container.
4926

5027
## Installing Mesh Adaptation modules
5128

5229
The Mesh Adaptation packages can be installed through the following options, denoting the package of interest by `<PACKAGE>`.
5330
In both cases, make sure that you have activated the Python virtual environment that was created when you installed Firedrake.
5431
Ensure that you have activated the Python virtual environment associated with your Firedrake installation before following the steps below:
5532
```
56-
source /path/to/firedrake/bin/activate
33+
source /path/to/venv/bin/activate
5734
```
5835

5936
### Cloning via HTTPS
@@ -76,9 +53,6 @@ make install
7653

7754
It is highly recommended to keep your Firedrake installation and Mesh Adaptation software stack up to date.
7855
**We recommend updating the full stack at least once every two months.**
79-
The quickest way to do this is to use the `firedrake-update` command from within an active virtual environment.
80-
This approach works well when there have been small changes to Firedrake and/or its associated dependencies and add-ons, but sometimes fails when there have been major changes.
81-
See https://www.firedrakeproject.org/download.html for details on updating Firedrake.
8256

83-
If the `firedrake-update` approach fails then we recommend creating a whole new Firedrake installation using one of the approaches described above.
84-
Note that the `--venv-name` command line option for the `firedrake-install` script can be useful for differentiating between different builds.
57+
* To update Firedrake and PETSc, follow the [official Firedrake instructions](https://www.firedrakeproject.org/install.html#updating-firedrake) on how to do so.
58+
* To update Animate/Goalie/Movement, simply change directory to where each one is located (`cd /path/to/package`) and run `git pull`.

0 commit comments

Comments
 (0)