Skip to content

Commit 54d1214

Browse files
committed
Merge branch 'master' into gpu
2 parents 0d1e33e + d0cc348 commit 54d1214

File tree

11 files changed

+147
-95
lines changed

11 files changed

+147
-95
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
# Trigger the workflow on push or pull request,
4+
# but only for the master branch
5+
on:
6+
push:
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
env:
17+
CC: mpicc
18+
PETSC_CONFIGURE_OPTIONS: --with-debugging=1
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
23+
- name: Install system dependencies
24+
shell: bash
25+
run: |
26+
sudo apt install \
27+
build-essential python3-dev git python3-pip libopenmpi-dev \
28+
openmpi-bin libblas-dev liblapack-dev gfortran
29+
30+
- name: Set correct Python version
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: '3.6'
34+
35+
# xargs is used to force installation of requirements in the order we specified.
36+
# pip 20.2 needed for loopy install to work.
37+
- name: Install Python dependencies
38+
shell: bash
39+
run: |
40+
pip install pip==20.2
41+
xargs -l1 pip install < requirements-ext.txt
42+
xargs -l1 pip install < requirements-git.txt
43+
pip install pulp
44+
pip install -U flake8
45+
46+
- name: Install PyOP2
47+
shell: bash
48+
run: pip install -e .
49+
50+
- name: Do tests
51+
shell: bash
52+
run: |
53+
make lint
54+
py.test test -v --tb=native

.github/workflows/gh-pages.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Website
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
gh-pages:
10+
runs-on: ubuntu-latest
11+
env:
12+
CC: mpicc
13+
PETSC_CONFIGURE_OPTIONS: --with-debugging=1
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Install system dependencies
19+
shell: bash
20+
run: |
21+
sudo apt install \
22+
build-essential python3-dev git python3-pip libopenmpi-dev \
23+
openmpi-bin libblas-dev liblapack-dev gfortran
24+
25+
- name: Set correct Python version
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: '3.6'
29+
30+
# xargs is used to force installation of requirements in the order we specified.
31+
# pip 20.2 needed for loopy install to work.
32+
- name: Install Python dependencies
33+
shell: bash
34+
run: |
35+
pip install pip==20.2
36+
xargs -l1 pip install < requirements-ext.txt
37+
xargs -l1 pip install < requirements-git.txt
38+
pip install pulp sphinx
39+
pip install -U flake8
40+
41+
- name: Install PyOP2
42+
shell: bash
43+
run: pip install -e .
44+
45+
- name: Build documentation
46+
shell: bash
47+
run: make -C doc/sphinx html
48+
49+
- name: Upload to GitHub Pages
50+
uses: crazy-max/ghaction-github-pages@v2.2.0
51+
with:
52+
build_dir: doc/sphinx/build/html
53+
jekyll: false
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Andrew McRae <a.t.t.mcrae@bath.ac.uk> <dorugeber@users.noreply.github.com>
1616
Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> <lawrence.mitchell@ed.ac.uk>
1717
Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> <wence@gmx.li>
1818
Kaho Sato <kahosato93@gmail.com>
19+
Reuben W. Nixon-Hill <reuben.nixon-hill10@imperial.ac.uk> <ReubenHill@users.noreply.github.com>

.travis.yml

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

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk>
2020
Florian Rathgeber <florian.rathgeber@gmail.com>
2121
Francis Russell <francis@unchartedbackwaters.co.uk>
2222
Kaho Sato <kahosato93@gmail.com>
23-
Reuben W. Hill <reuben.hill10@imperial.ac.uk>
23+
Reuben W. Nixon-Hill <reuben.nixon-hill10@imperial.ac.uk>

doc/sphinx/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ devhelp epub latex latexpdf text man changes linkcheck doctest gettext apidoc
2020

2121
help:
2222
@echo "Please use \`make <target>' where <target> is one of"
23-
@echo " livehtml to make HTML files and point livereload server at them"
2423
@echo " html to make standalone HTML files"
2524
@echo " dirhtml to make HTML files named index.html in directories"
2625
@echo " singlehtml to make a single large HTML file"
@@ -47,9 +46,6 @@ apidoc:
4746
clean:
4847
-rm -rf $(BUILDDIR)/*
4948

50-
livehtml:
51-
python server.py
52-
5349
buildhtml:
5450
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
5551

doc/sphinx/server.py

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

doc/sphinx/source/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Add any Sphinx extension module names here, as strings. They can be extensions
2929
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
30-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.pngmath']
30+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.imgmath']
3131
autodoc_default_flags = ['members', 'undoc-members']
3232
# Both the class’ and the __init__ method’s docstring are concatenated and
3333
# inserted into the class definition
@@ -54,10 +54,9 @@
5454
# built documents.
5555
#
5656
# The short X.Y version.
57-
execfile("../../../pyop2/version.py")
58-
version = '%d.%d' % __version_info__[0:2] # noqa: pulled from pyop2/version.py
57+
version = '2020.0'
5958
# The full version, including alpha/beta/rc tags.
60-
release = __version__ # noqa: pulled from pyop2/version.py
59+
release = version
6160

6261
# The language for content autogenerated by Sphinx. Refer to documentation
6362
# for a list of supported languages.

doc/sphinx/source/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
Welcome to PyOP2's documentation!
77
=================================
88

9+
.. warning::
10+
The prose documentation contained here is significantly out-of-date and thus
11+
contains many inaccuracies. It is, nevertheless, quite a useful resource for
12+
people new to PyOP2. Please read with care.
13+
14+
The API documentation, however, is updated regularly and can be considered
15+
accurate.
16+
917
Contents:
1018

1119
.. toctree::

pyop2/base.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ def __init__(self, global_):
10491049

10501050
self._global = global_
10511051
self._globalset = GlobalSet(comm=self.comm)
1052+
self._name = "gdset_#x%x" % id(self)
10521053

10531054
@classmethod
10541055
def _cache_key(cls, *args):
@@ -1383,13 +1384,16 @@ class Dat(DataCarrier, _EmptyDataMixin):
13831384
multiplication / division by a scalar.
13841385
"""
13851386

1387+
_zero_kernels = {}
1388+
"""Class-level cache for zero kernels."""
1389+
1390+
_modes = [READ, WRITE, RW, INC, MIN, MAX]
1391+
13861392
@cached_property
13871393
def pack(self):
13881394
from pyop2.codegen.builder import DatPack
13891395
return DatPack
13901396

1391-
_modes = [READ, WRITE, RW, INC, MIN, MAX]
1392-
13931397
@validate_type(('dataset', (DataCarrier, DataSet, Set), DataSetTypeError),
13941398
('name', str, NameTypeError))
13951399
@validate_dtype(('dtype', None, DataTypeError))
@@ -1591,18 +1595,22 @@ def zero(self, subset=None):
15911595
loop = loops.get(iterset, None)
15921596

15931597
if loop is None:
1594-
import islpy as isl
1595-
import pymbolic.primitives as p
1596-
1597-
inames = isl.make_zero_and_vars(["i"])
1598-
domain = (inames[0].le_set(inames["i"])) & (inames["i"].lt_set(inames[0] + self.cdim))
1599-
x = p.Variable("dat")
1600-
i = p.Variable("i")
1601-
insn = loopy.Assignment(x.index(i), 0, within_inames=frozenset(["i"]))
1602-
data = loopy.GlobalArg("dat", dtype=self.dtype, shape=(self.cdim,))
1603-
knl = loopy.make_function([domain], [insn], [data], name="zero")
1604-
1605-
knl = Kernel(knl, 'zero')
1598+
try:
1599+
knl = self._zero_kernels[(self.dtype, self.cdim)]
1600+
except KeyError:
1601+
import islpy as isl
1602+
import pymbolic.primitives as p
1603+
1604+
inames = isl.make_zero_and_vars(["i"])
1605+
domain = (inames[0].le_set(inames["i"])) & (inames["i"].lt_set(inames[0] + self.cdim))
1606+
x = p.Variable("dat")
1607+
i = p.Variable("i")
1608+
insn = loopy.Assignment(x.index(i), 0, within_inames=frozenset(["i"]))
1609+
data = loopy.GlobalArg("dat", dtype=self.dtype, shape=(self.cdim,))
1610+
knl = loopy.make_function([domain], [insn], [data], name="zero")
1611+
1612+
knl = Kernel(knl, 'zero')
1613+
self._zero_kernels[(self.dtype, self.cdim)] = knl
16061614
loop = _make_object('ParLoop', knl,
16071615
iterset,
16081616
self(WRITE))
@@ -3415,8 +3423,8 @@ def _cache_key(cls, code, name, opts={}, include_dirs=[], headers=[],
34153423
code = code.gencode()
34163424
if isinstance(code, loopy.LoopKernel):
34173425
from loopy.tools import LoopyKeyBuilder
3418-
from pytools.persistent_dict import new_hash
3419-
key_hash = new_hash()
3426+
from hashlib import sha256
3427+
key_hash = sha256()
34203428
code.update_persistent_hash(key_hash, LoopyKeyBuilder())
34213429
code = key_hash.hexdigest()
34223430
hashee = (str(code) + name + str(sorted(opts.items())) + str(include_dirs)

0 commit comments

Comments
 (0)