Skip to content

Commit

Permalink
Merge branch 'master' into indiamai/new_def_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
indiamai committed Dec 9, 2024
2 parents 0508622 + 6a20368 commit 1dec340
Show file tree
Hide file tree
Showing 84 changed files with 7,403 additions and 315 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Install and test Firedrake (macOS)

on:
push:
branches:
- master
pull_request:
# By default this workflow is run on the "opened", "synchronize" and
# "reopened" events. We add "labelled" so it will run if the PR is given a label.
types: [opened, synchronize, reopened, labeled]

concurrency:
# Cancels jobs running if new commits are pushed
group: >
${{ github.workflow }}-
${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build Firedrake (macOS)
runs-on: [self-hosted, macOS]
# 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:
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() }}
run: |
cd ..
rm -rf firedrake_venv
- name: Install Python
run: brew install python python-setuptools
- name: Build Firedrake
run: |
cd ..
"$(brew --prefix)/bin/python3" \
firedrake/scripts/firedrake-install \
--venv-name firedrake_venv \
--disable-ssh \
|| (cat firedrake-install.log && /bin/false)
- name: Run smoke tests
run: |
. ../firedrake_venv/bin/activate
python -m pytest -v tests/firedrake/regression/ -k "poisson_strong or stokes_mini or dg_advection"
timeout-minutes: 30
- name: Post-run cleanup
if: ${{ always() }}
run: |
cd ..
rm -rf firedrake_venv
127 changes: 127 additions & 0 deletions .github/workflows/pip-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Pip install Firedrake (macOS)

on:
push:
branches:
- master
pull_request:
# By default this workflow is run on the "opened", "synchronize" and
# "reopened" events. We add "labelled" so it will run if the PR is given a label.
types: [opened, synchronize, reopened, labeled]

concurrency:
# Cancels jobs running if new commits are pushed
group: >
${{ github.workflow }}-
${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: "Build Firedrake using pip (macOS)"
runs-on: [self-hosted, macOS]
# 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:
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"

- name: Install homebrew packages
run: brew install gcc autoconf pkg-config make automake cmake ninja libtool boost openblas python python-setuptools mpich

- name: Cleanup (pre)
if: ${{ always() }}
run: |
rm -rf pip_venv
"$(brew --prefix)/bin/python3" -m pip cache purge
- name: Create a virtual environment
run: |
"$(brew --prefix)/bin/python3" -m venv pip_venv
mkdir pip_venv/src
- name: Install PETSc
run: |
cd pip_venv/src
git clone https://github.com/firedrakeproject/petsc.git
cd petsc
./configure PETSC_DIR="$PWD" PETSC_ARCH=default \
--with-shared-libraries=1 \
--with-mpi-dir=/opt/homebrew \
--with-zlib \
--download-bison \
--download-hdf5 \
--download-hwloc \
--download-hypre \
--download-metis \
--download-mumps \
--download-netcdf \
--download-pastix \
--download-pnetcdf \
--download-ptscotch \
--download-scalapack \
--download-suitesparse \
--download-superlu_dist
make
- name: Install libsupermesh
run: |
source pip_venv/bin/activate
python -m pip install 'rtree>=1.2'
cd pip_venv/src
git clone https://github.com/firedrakeproject/libsupermesh.git
mkdir -p libsupermesh/build
cd libsupermesh/build
cmake .. \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX="$VIRTUAL_ENV" \
-DMPI_C_COMPILER=/opt/homebrew/bin/mpicc \
-DMPI_CXX_COMPILER=/opt/homebrew/bin/mpicxx \
-DMPI_Fortran_COMPILER=/opt/homebrew/bin/mpif90 \
-DCMAKE_Fortran_COMPILER=/opt/homebrew/bin/mpif90 \
-DMPIEXEC_EXECUTABLE=/opt/homebrew/bin/mpiexec
make
make install
- uses: actions/checkout@v4
with:
path: pip_venv/src/firedrake

- name: Pip install
run: |
export PETSC_DIR="$PWD/pip_venv/src/petsc"
export PETSC_ARCH=default
export HDF5_DIR="$PETSC_DIR/$PETSC_ARCH"
export HDF5_MPI=ON
export CC=/opt/homebrew/bin/mpicc
export CXX=/opt/homebrew/bin/mpicxx
export MPICC="$CC"
source pip_venv/bin/activate
cd pip_venv/src
python -m pip install \
--log=firedrake-install.log \
--no-binary h5py \
-v -e './firedrake[test]'
- name: Install CI-specific test dependencies
run: |
source pip_venv/bin/activate
python -m pip install -U pytest-timeout
- name: Run Firedrake smoke tests
run: |
source pip_venv/bin/activate
cd pip_venv/src/firedrake
python -m pytest --timeout=1800 -v tests/firedrake/regression \
-k "poisson_strong or stokes_mini or dg_advection"
timeout-minutes: 30

- name: Cleanup (post)
if: ${{ always() }}
run: |
rm -rf pip_venv
"$(brew --prefix)/bin/python3" -m pip cache purge
31 changes: 19 additions & 12 deletions .github/workflows/pyop2.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: PyOP2
name: Test PyOP2 and TSFC

# Trigger the workflow on push or pull request,
# but only for the master branch
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
Expand Down Expand Up @@ -88,29 +84,40 @@ jobs:
make
make install
- name: Checkout PyOP2
- name: Checkout Firedrake
uses: actions/checkout@v4
with:
path: PyOP2
path: firedrake

- name: Install PyOP2 dependencies
shell: bash
working-directory: PyOP2
working-directory: firedrake
run: |
source ../venv/bin/activate
python -m pip install -U pip
python -m pip install -U pytest-timeout
- name: Install PyOP2
shell: bash
working-directory: PyOP2
working-directory: firedrake
run: |
source ../venv/bin/activate
python -m pip install -v ".[test]"
export CC=mpicc
export HDF5_DIR="$PETSC_DIR/$PETSC_ARCH"
export HDF5_MPI=ON
python -m pip install --no-binary h5py -v ".[test]"
- name: Run TSFC tests
shell: bash
working-directory: firedrake
run: |
source ../venv/bin/activate
pytest --tb=native --timeout=480 --timeout-method=thread -o faulthandler_timeout=540 -v tests/tsfc
timeout-minutes: 10

- name: Run tests
- name: Run PyOP2 tests
shell: bash
working-directory: PyOP2
working-directory: firedrake
run: |
source ../venv/bin/activate
# Running parallel test cases separately works around a bug in pytest-mpi
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Christopher Hawkes

Miklós Homolya

Joshua Hope-Collins...........<https://www.imperial.ac.uk/people/joshua.hope-collins13>

Christian T. Jacobs

Darko Janeković
Expand Down
2 changes: 1 addition & 1 deletion CITATION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you publish results using Firedrake, we would be grateful if you would cite t

@manual{FiredrakeUserManual,
title = {Firedrake User Manual},
author = {David A. Ham and Paul H. J. Kelly and Lawrence Mitchell and Colin J. Cotter and Robert C. Kirby and Koki Sagiyama and Nacime Bouziani and Thomas J. Gregory and Jack Betteridge and Daniel R. Shapero and Reuben W. Nixon-Hill and Connor J. Ward and Patrick E. Farrell and Pablo D. Brubeck and India Marsden and Daiane I. Dolci and Sophia Vorderwuelbecke and Thomas H. Gibson and Miklós Homolya and Tianjiao Sun and Andrew T. T. McRae and Fabio Luporini and Alastair Gregory and Michael Lange and Simon W. Funke and Florian Rathgeber and Gheorghe-Teodor Bercea and Graham R. Markall},
author = {David A. Ham and Paul H. J. Kelly and Lawrence Mitchell and Colin J. Cotter and Robert C. Kirby and Koki Sagiyama and Nacime Bouziani and Thomas J. Gregory and Jack Betteridge and Daniel R. Shapero and Reuben W. Nixon-Hill and Connor J. Ward and Patrick E. Farrell and Pablo D. Brubeck and India Marsden and Daiane I. Dolci and Joshua Hope-Collins and Sophia Vorderwuelbecke and Thomas H. Gibson and Miklós Homolya and Tianjiao Sun and Andrew T. T. McRae and Fabio Luporini and Alastair Gregory and Michael Lange and Simon W. Funke and Florian Rathgeber and Gheorghe-Teodor Bercea and Graham R. Markall},
organization = {Imperial College London and University of Oxford and Baylor University and University of Washington},
edition = {First edition},
year = {2023},
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ lint:
@python -m flake8 $(FLAKE8_FORMAT) pyop2
@echo " Linting PyOP2 scripts"
@python -m flake8 $(FLAKE8_FORMAT) pyop2/scripts --filename=*
@echo " Linting TSFC"
@python -m flake8 $(FLAKE8_FORMAT) tsfc

actionlint:
@echo " Pull latest actionlint image"
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update \
cmake gfortran git libopenblas-serial-dev \
libtool python3-dev python3-pip python3-tk python3-venv \
python3-requests zlib1g-dev libboost-dev sudo gmsh \
bison flex ninja-build \
bison flex ninja-build pkg-config \
libocct-ocaf-dev libocct-data-exchange-dev \
swig graphviz \
libcurl4-openssl-dev libxml2-dev \
Expand Down
5 changes: 3 additions & 2 deletions docs/source/download.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ they have the system dependencies:
* zlib
* flex, bison
* Ninja
* pkg-config

Firedrake has been successfully installed on Windows 10 using the
Windows Subsystem for Linux. There are more detailed instructions for
Expand Down Expand Up @@ -229,10 +230,10 @@ type::

You should now be able to run ``firedrake-update``.

Installing Firedrake with pip (experimental, Linux only)
Installing Firedrake with pip (experimental)
--------------------------------------------------------

Firedrake has experimental support for installing using ``pip``, avoiding the need for the ``firedrake-install`` script. At present only Linux is tested using this install method.
Firedrake has experimental support for installing using ``pip``, avoiding the need for the ``firedrake-install`` script.

Requirements
~~~~~~~~~~~~
Expand Down
5 changes: 3 additions & 2 deletions firedrake/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,9 @@ def base_form_assembly_visitor(self, expr, tensor, *args):
return sum(weight * arg for weight, arg in zip(expr.weights(), args))
elif all(isinstance(op, firedrake.Cofunction) for op in args):
V, = set(a.function_space() for a in args)
res = sum([w*op.dat for (op, w) in zip(args, expr.weights())])
return firedrake.Cofunction(V, res)
result = firedrake.Cofunction(V)
result.dat.maxpy(expr.weights(), [a.dat for a in args])
return result
elif all(isinstance(op, ufl.Matrix) for op in args):
res = tensor.petscmat if tensor else PETSc.Mat()
is_set = False
Expand Down
Loading

0 comments on commit 1dec340

Please sign in to comment.