Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install firedrake #4011

Draft
wants to merge 75 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
272b8c4
Begin work on new installation process
connorjward Feb 5, 2025
279ff3a
try again, force a container build
connorjward Feb 5, 2025
26714ce
fixup
connorjward Feb 5, 2025
a8494ba
fixup
connorjward Feb 5, 2025
a0b6f1f
fixup
connorjward Feb 5, 2025
778e57f
fixup
connorjward Feb 5, 2025
dfb995a
path hacking
connorjward Feb 5, 2025
36d250a
noodling
connorjward Feb 5, 2025
a597456
noodling
connorjward Feb 5, 2025
b026e3f
wip
connorjward Feb 5, 2025
50fb89b
wip
connorjward Feb 5, 2025
eaa080a
globbing
connorjward Feb 5, 2025
778f335
wip
connorjward Feb 5, 2025
fcc0417
testing things out
connorjward Feb 7, 2025
1693e66
Merge remote-tracking branch 'origin/master' into connorjward/pip-ins…
connorjward Feb 10, 2025
1e7acad
Add support for ARM
connorjward Feb 10, 2025
f23b443
noodling
connorjward Feb 10, 2025
34eb8d3
fixup
connorjward Feb 10, 2025
65a7ce4
fixup
connorjward Feb 10, 2025
9263612
fixup
connorjward Feb 10, 2025
0a79641
fixup
connorjward Feb 10, 2025
d8ed518
use single petsc arch for the moment
connorjward Feb 10, 2025
eac1caa
fixup
connorjward Feb 10, 2025
b1b1309
fixup
connorjward Feb 10, 2025
a19ccbd
can I at least build a container
connorjward Feb 10, 2025
5171259
wip
connorjward Feb 11, 2025
6687ca1
improvements
connorjward Feb 11, 2025
52e6fcc
fixup
connorjward Feb 11, 2025
ba8bf58
fixup
connorjward Feb 11, 2025
18600ac
cleanup
connorjward Feb 11, 2025
a612f14
fixup
connorjward Feb 11, 2025
c627662
fixup
connorjward Feb 11, 2025
7b705bd
fixup
connorjward Feb 11, 2025
efc536b
bad hypre
connorjward Feb 11, 2025
31594f3
fixup
connorjward Feb 11, 2025
2ddb8b5
fixup
connorjward Feb 11, 2025
af81e35
fixup
connorjward Feb 11, 2025
9b0680d
DUMB
connorjward Feb 11, 2025
9e1bbc6
firedrake-configure lives
connorjward Feb 12, 2025
3d61458
improvements
connorjward Feb 12, 2025
50168d4
small tweak
connorjward Feb 12, 2025
d9b3181
Use new script in CI
connorjward Feb 12, 2025
1ffa65d
finally fix petsc4py nightmare?
connorjward Feb 12, 2025
48be846
fixup?
connorjward Feb 12, 2025
1b7d7aa
fixup?
connorjward Feb 12, 2025
bdfed2b
fixup?
connorjward Feb 12, 2025
836e0e5
Use a venv
connorjward Feb 12, 2025
cf04bed
Merge remote-tracking branch 'origin/master' into connorjward/pip-ins…
connorjward Feb 12, 2025
be6c7f0
backslash
connorjward Feb 12, 2025
b628d5e
Abandon setup-python
connorjward Feb 13, 2025
2b9646a
gah
connorjward Feb 13, 2025
74d9b27
Lots of tweaks
connorjward Feb 13, 2025
ddffbfc
fixups
connorjward Feb 13, 2025
ba01f68
Less strict cleanup
connorjward Feb 13, 2025
5c39fc0
remove make check for now
connorjward Feb 13, 2025
0a11857
tidy up and no hypre in complex and macos bison
connorjward Feb 13, 2025
dd8a600
fix strings and add wait in old install script
connorjward Feb 13, 2025
6c42019
update CI timeouts
connorjward Feb 14, 2025
b9310b4
Fix paths
connorjward Feb 14, 2025
27c5d68
less aggressive homebrew management
connorjward Feb 14, 2025
b9879a2
Merge remote-tracking branch 'origin/master' into connorjward/pip-ins…
connorjward Feb 14, 2025
6c65d08
fixup
connorjward Feb 14, 2025
e643e5f
Dockerfile changes
connorjward Feb 17, 2025
22afa3a
yucky, undo a bunch of linting rules
connorjward Feb 17, 2025
6e554c0
fixups
connorjward Feb 17, 2025
000ccc3
some changes, no skips allowed
connorjward Feb 17, 2025
982dbe8
lots of tweaks
connorjward Feb 18, 2025
45d63e8
fixups
connorjward Feb 18, 2025
dc92716
fixups
connorjward Feb 18, 2025
924ae85
fixup
connorjward Feb 18, 2025
4663559
docs noodling
connorjward Feb 18, 2025
bd2abca
WIP
connorjward Feb 18, 2025
b26f44f
Install instructions nearly done
connorjward Feb 18, 2025
d0532e6
docs tweaks
connorjward Feb 18, 2025
fcde36d
Merge remote-tracking branch 'origin/master' into connorjward/pip-ins…
connorjward Feb 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 52 additions & 20 deletions .github/workflows/build-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,73 @@ jobs:
# Only run this action if we are pushing to master or the PR is labelled "macOS"
if: ${{ (github.ref == 'refs/heads/master') || contains(github.event.pull_request.labels.*.name, 'macOS') }}
env:
# TODO: Are these needed any more?
FIREDRAKE_CI_TESTS: 1 # needed to symlink the checked out branch into the venv
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
steps:
- name: Add homebrew to PATH
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path
run: echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
- uses: actions/checkout@v4

- name: Pre-run cleanup
if: ${{ always() }}
# Make sure the current directory is empty
run: find . -delete

# Uninstall existing packages so there are no conflicts (e.g. OpenMPI vs MPICH)
- name: Remove all existing homebrew packages
# If there are no homebrew packages installed then this command will fail even
# though nothing is wrong.
continue-on-error: true
run: brew remove --formula --force $(brew list --formula)

- uses: actions/checkout@v4
with:
path: repo

- name: Install system dependencies
run: |
cd ..
rm -rf firedrake_venv
- name: Install Python
run: brew install python python-setuptools
- name: Build Firedrake
: # We need Python before we can run firedrake-configure
brew install python
brew install $(python3 ./repo/scripts/firedrake-configure --arch default --show-system-dependencies)

- name: Install PETSc
run: |
cd ..
"$(brew --prefix)/bin/python3" \
firedrake/scripts/firedrake-install \
--venv-name firedrake_venv \
--disable-ssh \
|| (cat firedrake-install.log && /bin/false)
- name: Install test dependencies
git clone https://github.com/firedrakeproject/petsc.git
cd petsc
./configure \
$(python3 ../repo/scripts/firedrake-configure --arch default --show-petsc-configure-options) \
--with-make-np=4
make
# TODO: Does this pass?
# make check

- name: Install Firedrake
id: install
run: |
. ../firedrake_venv/bin/activate
python -m pip install pytest-timeout
export PETSC_DIR=$PWD/petsc PETSC_ARCH=arch-firedrake-default
export HDF5_MPI=ON
export CC=mpicc CXX=mpicxx
export MPICC=$CC
python3 -m venv venv
. venv/bin/activate
: # Force a rebuild of petsc4py as the cached one will not link to the fresh
: # install of PETSc. A similar trick may be needed for compiled dependencies
: # like h5py or mpi4py if changing HDF5/MPI libraries.
pip cache remove petsc4py
pip install --verbose --no-binary h5py ./repo[test]
firedrake-clean
: # Extra test dependencies
pip install pytest-timeout
pip list

- name: Run smoke tests
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
make check CHECK_PYTEST_ARGS="--timeout 60"
timeout-minutes: 10

- name: Post-run cleanup
if: ${{ always() }}
if: always()
run: |
cd ..
rm -rf firedrake_venv
find . -delete
196 changes: 83 additions & 113 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Install and Test Firedrake
name: CI

on:
# Push to master or PR
push:
branches:
- master
Expand All @@ -11,7 +10,7 @@ on:
- cron: '0 0 1 * *' # Monthly release

concurrency:
# Cancels jobs running if new commits are pushed
# Cancel running jobs if new commits are pushed
group: >
${{ github.workflow }}-
${{ github.event.pull_request.number || github.ref }}
Expand All @@ -22,152 +21,123 @@ env:

jobs:
test:
name: "Run Firedrake tests (Linux)"
runs-on: [self-hosted, Linux]
container:
image: firedrakeproject/firedrake-env:latest
name: Install and test Firedrake (Linux)
strategy:
# We want to know all of the tests which fail, so don't kill real if
# complex fails and vice-versa
fail-fast: false
matrix:
include:
- scalar-type: real
complex: ""
petsc_arch: default
- scalar-type: complex
complex: --complex
petsc_arch: complex
arch: [default, complex]
runs-on: [self-hosted, Linux]
container:
image: firedrakeproject/firedrake-env:pip
env:
# PETSC_DIR and MPICH_DIR are set inside the docker image
# NOTE: Do not set a lot of vars here, single source of truth
FIREDRAKE_CI_TESTS: 1
PYOP2_CI_TESTS: 1
PETSC_ARCH: ${{ matrix.petsc_arch }}
OMP_NUM_THREADS: 1
OPENBLAS_NUM_THREADS: 1
COMPLEX: ${{ matrix.complex }}
RDMAV_FORK_SAFE: 1
EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=1800 --timeout-method=thread -o faulthandler_timeout=1860 tests/firedrake
PYOP2_SPMD_STRICT: 1
EXTRA_PYTEST_ARGS: --splitting-algorithm least_duration --timeout=1800 --timeout-method=thread -o faulthandler_timeout=1860 repo/tests/firedrake
steps:
- uses: actions/checkout@v4

- name: Cleanup
if: ${{ always() }}
- name: Pre-run cleanup
run: |
cd ..
rm -rf firedrake_venv
: # Make sure the current directory is empty
find . -delete

- name: Build Firedrake
run: |
cd ..
# Linting should ignore unquoted shell variable $COMPLEX
# shellcheck disable=SC2086
./firedrake/scripts/firedrake-install \
$COMPLEX \
--honour-petsc-dir \
--mpicc="$MPICH_DIR"/mpicc \
--mpicxx="$MPICH_DIR"/mpicxx \
--mpif90="$MPICH_DIR"/mpif90 \
--mpiexec="$MPICH_DIR"/mpiexec \
--mpihome="$MPICH_DIR"/.. \
--venv-name firedrake_venv \
--no-package-manager \
--disable-ssh \
--documentation-dependencies \
--torch \
--jax \
--netgen \
--slepc \
--install thetis \
--install gusto \
--install icepack \
--install irksome \
--install femlium \
--install fascd \
--install defcon \
--install gadopt \
--install asQ \
|| (cat firedrake-install.log && /bin/false)

- name: Install test dependencies
id: build
run: |
sudo apt update
sudo apt -y install parallel
. ../firedrake_venv/bin/activate
- uses: actions/checkout@v4
with:
path: repo

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get -y install \
$(python3 ./repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-system-dependencies)
: # Extra test dependencies
sudo apt-get -y install parallel

- name: Install PETSc
run: |
git clone https://github.com/firedrakeproject/petsc.git
cd petsc
./configure \
$(python3 ../repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-petsc-configure-options) \
--with-make-np=12
make
# TODO: This fails for some reason
# make check

- name: Install Firedrake
id: install
run: |
export PETSC_DIR=$PWD/petsc PETSC_ARCH=arch-firedrake-${{ matrix.arch }}
export HDF5_MPI=ON
export CC=mpicc CXX=mpicxx
export MPICC=$CC
python3 -m venv venv
. venv/bin/activate
: # Force a rebuild of petsc4py as the cached one will not link to the fresh
: # install of PETSc. A similar trick may be needed for compiled dependencies
: # like h5py or mpi4py if changing HDF5/MPI libraries.
pip cache remove petsc4py
pip install --verbose --no-binary h5py ./repo[test]
firedrake-clean
python -m pip install pytest-timeout ipympl pytest-split pytest-xdist
python -m pip list
: # Extra test dependencies
pip install ipympl pytest-split pytest-timeout pytest-xdist
pip list

- name: Run tests (nprocs = 1)
run: |
. venv/bin/activate
: # Use pytest-xdist here so we can have a single collated output (not possible
: # for parallel tests)
. ../firedrake_venv/bin/activate
firedrake-run-split-tests 1 1 "-n 12 $EXTRA_PYTEST_ARGS --junit-xml=firedrake1_{#}.xml"

- name: Run tests (nprocs = 2)
# Run even if earlier tests failed
if: ${{ success() || steps.build.conclusion == 'success' }}
if: ${{ success() || steps.install.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
firedrake-run-split-tests 2 6 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake2_{#}.xml"

- name: Run tests (nprocs = 3)
if: ${{ success() || steps.build.conclusion == 'success' }}
if: ${{ success() || steps.install.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
firedrake-run-split-tests 3 4 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake3_{#}.xml"

- name: Run tests (nprocs = 4)
if: ${{ success() || steps.build.conclusion == 'success' }}
if: ${{ success() || steps.install.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
firedrake-run-split-tests 4 3 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake4_{#}.xml"

- name: Run tests (nprocs = 5)
if: ${{ success() || steps.build.conclusion == 'success' }}
if: ${{ success() || steps.install.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
firedrake-run-split-tests 5 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake5_{#}.xml"

- name: Run tests (nprocs = 6)
if: ${{ success() || steps.build.conclusion == 'success' }}
if: ${{ success() || steps.install.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
firedrake-run-split-tests 6 2 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake6_{#}.xml"

- name: Run tests (nprocs = 7)
if: ${{ success() || steps.build.conclusion == 'success' }}
if: ${{ success() || steps.install.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
firedrake-run-split-tests 7 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake7_{#}.xml"

- name: Run tests (nprocs = 8)
if: ${{ success() || steps.build.conclusion == 'success' }}
if: ${{ success() || steps.install.conclusion == 'success' }}
run: |
. ../firedrake_venv/bin/activate
. venv/bin/activate
firedrake-run-split-tests 8 1 "$EXTRA_PYTEST_ARGS --junit-xml=firedrake8_{#}.xml"

- name: Test pyadjoint
if: (success() || steps.build.conclusion == 'success') && matrix.scalar-type == 'real'
run: |
. ../firedrake_venv/bin/activate
cd ../firedrake_venv/src/pyadjoint
python -m pytest \
--strict-markers \
--durations=200 \
--timeout=600 \
--timeout-method=thread \
-o faulthandler_timeout=660 \
-n 12 --dist worksteal \
-sv tests/firedrake_adjoint
timeout-minutes: 5

- name: Run Gusto smoke tests
# Only test Gusto in real mode
if: (success() || steps.build.conclusion == 'success') && matrix.scalar-type == 'real'
if: (success() || steps.install.conclusion == 'success') && matrix.arch == 'default'
run: |
. ../firedrake_venv/bin/activate
cd ../firedrake_venv/src/gusto
Expand All @@ -177,31 +147,31 @@ jobs:
integration-tests/transport/test_embedded_dg_advection.py
timeout-minutes: 5

- name: Publish Test Report
- name: Publish test report
uses: mikepenz/[email protected]
# To avoid permissions issues do not run with forked repos
# (see https://github.com/mikepenz/action-junit-report/issues/23)
if: ${{ always() && (github.ref != 'refs/heads/master') && (github.event.pull_request.head.repo.full_name == github.repository) }}
if: |
(success() || steps.install.conclusion == 'success')
&& (github.ref != 'refs/heads/master')
&& (github.event.pull_request.head.repo.full_name == github.repository)
with:
report_paths: 'firedrake*.xml'
comment: true
check_name: "Firedrake ${{ matrix.scalar-type }}"
check_name: "Firedrake ${{ matrix.arch }}"
updateComment: true
flaky_summary: true

- name: Upload log files
uses: actions/upload-artifact@v4
if: always()
if: success() || steps.install.conclusion == 'success'
with:
name: firedrake-logs-${{ matrix.scalar-type }}
name: firedrake-logs-${{ matrix.arch }}
path: pytest_*.log

- name: Cleanup
# Belt and braces: clean up before and after the run.
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
- name: Post-run cleanup
if: always()
run: find . -delete

docker_tag:
name: "Set the Docker release tag"
Expand All @@ -224,10 +194,10 @@ jobs:
name: "Build Docker containers"
# Only run on master, but always generate firedrake-env image,
# even if build fails (see docker.yml)
if: ${{ (github.ref == 'refs/heads/master') && always() }}
needs: [test, docker_tag]
# if: always() && (github.ref == 'refs/heads/master')
# needs: [test, docker_tag]
uses: ./.github/workflows/docker.yml
with:
tag: ${{ needs.docker_tag.outputs.tag }}
status: ${{ needs.test.result }}
tag: pip
status: success
secrets: inherit
Comment on lines +204 to +209
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need undoing before merging

Loading
Loading