Skip to content

Commit

Permalink
Merge remote-tracking branch 'pyop2/master' into JDBetteridge/merge_p…
Browse files Browse the repository at this point in the history
…yop2_tsfc
  • Loading branch information
JDBetteridge committed Oct 22, 2024
2 parents 50cd88a + 31471a6 commit 47f2151
Show file tree
Hide file tree
Showing 100 changed files with 47,307 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Whitespace
* whitespace=tab-in-indent,space-before-tab,trailing-space,tabwidth=2
*.{py,pyx,pxd,pxi} whitespace=tab-in-indent,space-before-tab,trailing-space,tabwidth=4
Makefile whitespace=space-before-tab,trailing-space,tabwidth=2
pyop2/_version.py export-subst
firedrake/_version.py export-subst
123 changes: 123 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: CI

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

jobs:
test:
runs-on: ubuntu-latest
strategy:
# Don't immediately kill all if one Python version fails
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
env:
CC: mpicc
PETSC_DIR: ${{ github.workspace }}/petsc
PETSC_ARCH: default
PETSC_CONFIGURE_OPTIONS: --with-debugging=1 --with-shared-libraries=1 --with-c2html=0 --with-fortran-bindings=0
RDMAV_FORK_SAFE: 1
PYOP2_CI_TESTS: 1
timeout-minutes: 60

steps:
- name: Install system dependencies
shell: bash
run: |
sudo apt update
sudo apt install build-essential mpich libmpich-dev \
libblas-dev liblapack-dev gfortran
- name: Set correct Python version
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Clone PETSc
uses: actions/checkout@v2
with:
repository: firedrakeproject/petsc
path: ${{ env.PETSC_DIR }}

- name: Build and install PETSc
shell: bash
working-directory: ${{ env.PETSC_DIR }}
run: |
./configure ${PETSC_CONFIGURE_OPTIONS}
make
- name: Build and install petsc4py
shell: bash
working-directory: ${{ env.PETSC_DIR }}/src/binding/petsc4py
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade wheel cython numpy
python -m pip install --no-deps .
- name: Checkout PyOP2
uses: actions/checkout@v2
with:
path: PyOP2

- name: Install PyOP2 dependencies
shell: bash
working-directory: PyOP2
run: |
# xargs is used to force installation of requirements in the order we specified.
xargs -l1 python -m pip install < requirements-ext.txt
xargs -l1 python -m pip install < requirements-git.txt
python -m pip install pulp
python -m pip install -U flake8
python -m pip install -U pytest-timeout
- name: Install PyOP2 (Python <3.12)
if: ${{ matrix.python-version != '3.12' }}
shell: bash
working-directory: PyOP2
run: python -m pip install .

# Not sure if this is a bug in setuptools or something PyOP2 is doing wrong
- name: Install PyOP2 (Python == 3.12)
if: ${{ matrix.python-version == '3.12' }}
shell: bash
working-directory: PyOP2
run: |
python -m pip install -U setuptools
python setup.py install
- name: Run linting
shell: bash
working-directory: PyOP2
run: make lint

- name: Run tests
shell: bash
working-directory: PyOP2
run: |
# Running parallel test cases separately works around a bug in pytest-mpi
pytest -k "not parallel" --tb=native --timeout=480 --timeout-method=thread -o faulthandler_timeout=540 -v test
mpiexec -n 3 pytest -k "parallel[3]" --tb=native --timeout=480 --timeout-method=thread -o faulthandler_timeout=540 -v test
timeout-minutes: 10

- name: Build documentation
if: ${{ matrix.python-version == '3.10' }}
shell: bash
working-directory: PyOP2
run: |
python -m pip install sphinx
make -C doc/sphinx html
- name: Upload to github pages
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && matrix.python-version== '3.10' }}
uses: crazy-max/[email protected]
with:
build_dir: PyOP2/doc/sphinx/build/html
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,34 @@ __pycache__/
/firedrake_configuration/configuration.json
/firedrake.egg-info
/docs/source/element_list.csv


# Build
build
dist
MANIFEST
PyOP2.egg-info
*.py[cdo]

# Extension modules
sparsity.so
sparsity.c
sparsity.cpython*.so
# Docs
pyop2.coffee.rst
pyop2.rst
pyop2.pdf
pyop2.aux
pyop2.log

# Testing
.pytest-incremental
.tox
.vagrant

# Meshes
*.edge
*.ele
*.msh
*.node
*.geo
19 changes: 19 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,22 @@ Joe Wallwork <[email protected]>
Jingmin Xia <[email protected]>
Jingmin Xia <[email protected]> <[email protected]>

Gheorghe-Teodor Bercea <[email protected]> <foraker.doc.ic.ac.uk>
George Boutsioukis <[email protected]>
David A Ham <[email protected]>
David A Ham <[email protected]> <[email protected]>
Miklós Homolya <[email protected]>
Nicolas Loriant <[email protected]> <[email protected]>
Nicolas Loriant <[email protected]> <[email protected]>
Nicolas Loriant <[email protected]> <[email protected]>
Nicolas Loriant <[email protected]> <[email protected]>
Nicolas Loriant <[email protected]> <[email protected]>
Fabio Luporini <[email protected]> <[email protected]>
Graham Markall <[email protected]> <[email protected]>
Graham Markall <[email protected]> <[email protected]>
Andrew McRae <[email protected]> <[email protected]>
Andrew McRae <[email protected]> <[email protected]>
Lawrence Mitchell <[email protected]> <[email protected]>
Lawrence Mitchell <[email protected]> <[email protected]>
Kaho Sato <[email protected]>
Reuben W. Nixon-Hill <[email protected]> <[email protected]>
24 changes: 24 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PyOP2 has received contributions from the following:

Institutions
------------

Imperial College London
The University of Edinburgh

Individuals
-----------

Gheorghe-Teodor Bercea <[email protected]>
Simon Funke <[email protected]>
Ben Grabham <[email protected]>
David A Ham <[email protected]>
Nicolas Loriant <[email protected]>
Fabio Luporini <[email protected]>
Graham Markall <[email protected]>
Lawrence Mitchell <[email protected]>
Florian Rathgeber <[email protected]>
Francis Russell <[email protected]>
Kaho Sato <[email protected]>
Reuben W. Nixon-Hill <[email protected]>
Nacime Bouziani <[email protected]>
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Contributing to PyOP2

We value third-party contributions. To keep things simple for you and us,
please adhere to the following contributing guidelines.

## Getting Started

* You will need a [GitHub account](https://github.com/signup/free).
* Submit a [ticket for your issue][0], assuming one does not already exist.
* Clearly describe the issue including steps to reproduce when it is a bug.
* Make sure you specify the version that you know has the issue.
* Bonus points for submitting a failing test along with the ticket.
* If you don't have push access, fork the repository on GitHub.

## Making Changes

* Create a topic branch for your feature or bug fix.
* Make commits of logical units.
* Make sure your commits adhere to the coding guidelines below.
* Make sure your commit messages are in the [proper format][1]: The first line
of the message should have 50 characters or less, separated by a blank line
from the (optional) body. The body should be wrapped at 70 characters and
paragraphs separated by blank lines. Bulleted lists are also fine.
* Make sure you have added the necessary tests for your changes.
* Run _all_ the tests to assure nothing else was accidentally broken.

## Coding guidelines

[PEP 0008][2] is enforced, with the exception of [E501][3] and [E226][3]:
* Indent by 4 spaces, tabs are *strictly forbidden*.
* Lines should not exceed 79 characters where possible without severely
impacting legibility. If breaking a line would make the code much less
readable it's fine to overrun by a little bit.
* No trailing whitespace at EOL or trailing blank lines at EOF.

## Checking your commit conforms to coding guidelines

Install a Git pre-commit hook automatically checking for tab and whitespace
errors before committing and also calls `flake8` on your changed files. In the
`.git/hooks` directory of your local Git repository, run the following:

```
git config --local core.whitespace "space-before-tab, tab-in-indent, trailing-space, tabwidth=4"
wget https://gist.github.com/kynan/d233073b66e860c41484/raw/pre-commit
chmod +x pre-commit
```

Make sure the `pre-commit.sample` hook is still in place, since it is required.

## Submitting Changes

* We can only accept your contribution if you have signed the Contributor
License Agreement (CLA).
* Push your changes to a topic branch in your fork of the repository.
* Submit a pull request to the repository in the OP2 organization.

[0]: https://github.com/OP2/PyOP2/issues
[1]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[2]: http://www.python.org/dev/peps/pep-0008/
[3]: http://pep8.readthedocs.org/en/latest/intro.html#error-codes
31 changes: 31 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Firedrake:
Firedrake is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
Expand All @@ -11,3 +12,33 @@ License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Firedrake. If not, see <http://www.gnu.org/licenses/>.

PyOP2:
Copyright (c) 2012, Imperial College London and others. Please see the
AUTHORS file in the main source directory for a full list of copyright
holders. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The name of Imperial College London or that of other
contributors may not be used to endorse or promote products
derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTERS
''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
include versioneer.py
include firedrake/_version.py
recursive-include pyop2 *.c
include pyop2/_version.py

70 changes: 70 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,73 @@ alltest: modules lint test
shorttest: modules lint
@echo " Running short regression tests"
@python -m pytest --short tests $(PYTEST_ARGS)

# PyOP2 Makefile
# PYTEST = py.test
#
# TEST_BASE_DIR = test
#
# UNIT_TEST_DIR = $(TEST_BASE_DIR)/unit
#
# SPHINX_DIR = doc/sphinx
# SPHINX_BUILD_DIR = $(SPHINX_DIR)/build
# SPHINX_TARGET = html
# SPHINX_TARGET_DIR = $(SPHINX_BUILD_DIR)/$(SPHINX_TARGET)
# SPHINXOPTS = -a
#
# PORT = 8000
#
# MESHES_DIR = demo/meshes
#
# GIT_REV = $(shell git rev-parse --verify --short HEAD)
#
# all: ext
#
# .PHONY : help test lint unit doc update_docs ext ext_clean meshes
#
# help:
# @echo "make COMMAND with COMMAND one of:"
# @echo " test : run lint and unit tests"
# @echo " lint : run flake8 code linter"
# @echo " unit : run unit tests"
# @echo " unit_BACKEND : run unit tests for BACKEND"
# @echo " doc : build sphinx documentation"
# @echo " serve : launch local web server to serve up documentation"
# @echo " update_docs : build sphinx documentation and push to GitHub"
# @echo " ext : rebuild Cython extension"
# @echo " ext_clean : delete generated extension"
# @echo " meshes : download demo meshes"
# @echo
# @echo "Available OpenCL contexts: $(OPENCL_CTXS)"
#
# test: lint unit
#
# lint:
# @flake8
#
# unit:
# cd $(TEST_BASE_DIR); $(PYTEST) unit
#
# doc:
# make -C $(SPHINX_DIR) $(SPHINX_TARGET) SPHINXOPTS=$(SPHINXOPTS)
#
# serve:
# make -C $(SPHINX_DIR) livehtml
#
# update_docs:
# if [ ! -d $(SPHINX_TARGET_DIR)/.git ]; then \
# mkdir -p $(SPHINX_BUILD_DIR); \
# cd $(SPHINX_BUILD_DIR); git clone `git config --get remote.origin.url` $(SPHINX_TARGET); \
# fi
# cd $(SPHINX_TARGET_DIR); git fetch -p; git checkout -f gh-pages; git reset --hard origin/gh-pages
# make -C $(SPHINX_DIR) $(SPHINX_TARGET) SPHINXOPTS=$(SPHINXOPTS)
# cd $(SPHINX_TARGET_DIR); git add .; git commit -am "Update documentation to revision $(GIT_REV)"; git push origin gh-pages
#
# ext: ext_clean
# python setup.py build_ext -i
#
# ext_clean:
# rm -rf build pyop2/compute_ind.c pyop2/compute_ind.so pyop2/sparsity.c pyop2/sparsity.so
#
# meshes:
# make -C $(MESHES_DIR) meshes
2 changes: 2 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all:
pdflatex pyop2.tex
Loading

0 comments on commit 47f2151

Please sign in to comment.