Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julian Hammer
pystencils
Commits
4f41d979
Commit
4f41d979
authored
Aug 10, 2020
by
Jan Hönig
Browse files
Merge branch 'develop' into 'master'
Update conftest and readme See merge request
pycodegen/pystencils!167
parents
2d758462
458bff59
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
4f41d979
...
...
@@ -22,7 +22,7 @@ tests-and-coverage:
-
py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. -m "not longrun" --html test-report/index.html
tags
:
-
docker
-
cuda
-
cuda
11
-
AVX
artifacts
:
when
:
always
...
...
@@ -44,7 +44,7 @@ test-longrun:
-
py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. --html test-report/index.html
tags
:
-
docker
-
cuda
-
cuda
11
-
AVX
artifacts
:
paths
:
...
...
@@ -80,7 +80,7 @@ ubuntu:
-
pytest-3 -v -m "not longrun"
tags
:
-
docker
-
cuda
-
cuda
11
-
AVX
minimal-conda
:
...
...
@@ -146,7 +146,7 @@ pycodegen-integration:
-
make -j $NUM_CORES
tags
:
-
docker
-
cuda
-
cuda
11
-
AVX
# -------------------- Linter & Documentation --------------------------------------------------------------------------
...
...
README.md
View file @
4f41d979
...
...
@@ -2,16 +2,16 @@ pystencils
==========
[

](https://mybinder.org/v2/gh/mabau/pystencils/master?filepath=doc%2Fnotebooks)
[

](http://pycodegen.pages.
walberla.net
/pystencils)
[

](http
s
://pycodegen.pages.
i10git.cs.fau.de
/pystencils)
[

](https://badge.fury.io/py/pystencils)
[

](https://i10git.cs.fau.de/pycodegen/pystencils/commits/master)
[

](http://pycodegen.pages.
walberla.net
/pystencils/coverage_report)
[

](http://pycodegen.pages.
i10git.cs.fau.de
/pystencils/coverage_report)
Run blazingly fast stencil codes on numpy arrays.
*pystencils*
uses sympy to define stencil operations, that can be executed on numpy arrays.
Exploiting the stencil structure makes
*pystencils*
run faster than normal numpy code and even as Cython and numba,
[
as demonstrated in this notebook
](
http://pycodegen.pages.
walberla.net
/pystencils/notebooks/demo_benchmark.html
)
.
[
as demonstrated in this notebook
](
http
s
://pycodegen.pages.
i10git.cs.fau.de
/pystencils/notebooks/demo_benchmark.html
)
.
Here is a code snippet that computes the average of neighboring cells:
...
...
@@ -21,7 +21,7 @@ import numpy as np
f
,
g
=
ps
.
fields
(
"f, g : [2D]"
)
stencil
=
ps
.
Assignment
(
g
[
0
,
0
],
(
f
[
1
,
0
]
+
f
[
-
1
,
0
]
+
f
[
0
,
1
]
+
f
[
0
,
-
1
])
/
4
)
(
f
[
1
,
0
]
+
f
[
-
1
,
0
]
+
f
[
0
,
1
]
+
f
[
0
,
-
1
])
/
4
)
kernel
=
ps
.
create_kernel
(
stencil
).
compile
()
f_arr
=
np
.
random
.
rand
(
1000
,
1000
)
...
...
@@ -39,9 +39,6 @@ discretize = ps.fd.Discretization2ndOrder(dx=1, dt=0.01)
discretization
=
discretize
(
adv_diff_pde
)
```
Look at the
[
documentation
](
http://pycodegen.pages.walberla.net/pystencils
)
to learn more.
Installation
------------
...
...
@@ -69,5 +66,5 @@ pip install pystencils[interactive,gpu,doc]
Documentation
-------------
Read the docs
[
here
](
http://pycodegen.pages.
walberla.net
/pystencils
)
and
Read the docs
[
here
](
http
s
://pycodegen.pages.
i10git.cs.fau.de
/pystencils
)
and
check out the Jupyter notebooks in
`doc/notebooks`
.
conftest.py
View file @
4f41d979
...
...
@@ -25,6 +25,12 @@ except ImportError:
SCRIPT_FOLDER
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
sys
.
path
.
insert
(
0
,
os
.
path
.
abspath
(
'pystencils'
))
# the Ubuntu pipeline uses an older version of pytest which uses deprecated functionality.
# This leads to many warinings in the test and coverage pipeline.
pytest_numeric_version
=
[
int
(
x
,
10
)
for
x
in
pytest
.
__version__
.
split
(
'.'
)]
pytest_numeric_version
.
reverse
()
pytest_version
=
sum
(
x
*
(
100
**
i
)
for
i
,
x
in
enumerate
(
pytest_numeric_version
))
def
add_path_to_ignore
(
path
):
if
not
os
.
path
.
exists
(
path
):
...
...
@@ -152,8 +158,10 @@ class IPyNbFile(pytest.File):
warnings
.
filterwarnings
(
"ignore"
,
"IPython.core.inputsplitter is deprecated"
)
notebook
=
nbformat
.
read
(
notebook_contents
,
4
)
code
,
_
=
exporter
.
from_notebook_node
(
notebook
)
yield
IPyNbTest
(
self
.
name
,
self
,
code
)
# pytest v 2.4>: yield IPyNbTest.from_parent(name=self.name, parent=self, code=code)
if
pytest_version
>=
50403
:
yield
IPyNbTest
.
from_parent
(
name
=
self
.
name
,
parent
=
self
,
code
=
code
)
else
:
yield
IPyNbTest
(
self
.
name
,
self
,
code
)
def
teardown
(
self
):
pass
...
...
@@ -162,5 +170,7 @@ class IPyNbFile(pytest.File):
def
pytest_collect_file
(
path
,
parent
):
glob_exprs
=
[
"*demo*.ipynb"
,
"*tutorial*.ipynb"
,
"test_*.ipynb"
]
if
any
(
path
.
fnmatch
(
g
)
for
g
in
glob_exprs
):
return
IPyNbFile
(
path
,
parent
)
# pytest v 2.4 >: return IPyNbFile.from_parent(fspath=path, parent=parent)
if
pytest_version
>=
50403
:
return
IPyNbFile
.
from_parent
(
fspath
=
path
,
parent
=
parent
)
else
:
return
IPyNbFile
(
path
,
parent
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment