Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frederik Hennig
pystencils
Commits
2b2aaf56
Commit
2b2aaf56
authored
Mar 25, 2022
by
Markus Holzer
Browse files
Merge branch 'master' of i10git.cs.fau.de:pycodegen/pystencils into fix_new_filtered
parents
666fa8d6
1f3b1300
Pipeline
#38700
passed with stages
in 19 minutes and 37 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pystencils/backends/dot.py
View file @
2b2aaf56
import
graphviz
from
graphviz
import
Digraph
,
lang
try
:
from
graphviz
import
Digraph
import
graphviz.quoting
as
quote
except
ImportError
:
from
graphviz
import
Digraph
import
graphviz.lang
as
quote
from
sympy.printing.printer
import
Printer
...
...
@@ -12,7 +17,7 @@ class DotPrinter(Printer):
super
(
DotPrinter
,
self
).
__init__
()
self
.
_node_to_str_function
=
node_to_str_function
self
.
dot
=
Digraph
(
**
kwargs
)
self
.
dot
.
quote_edge
=
lang
.
quote
self
.
dot
.
quote_edge
=
quote
.
quote
def
_print_KernelFunction
(
self
,
func
):
self
.
dot
.
node
(
str
(
id
(
func
)),
style
=
'filled'
,
fillcolor
=
'#a056db'
,
label
=
self
.
_node_to_str_function
(
func
))
...
...
pystencils/cpu/vectorization.py
View file @
2b2aaf56
...
...
@@ -256,7 +256,7 @@ def insert_vector_casts(ast_node, default_float_type='double'):
new_arg
=
visit_expr
(
expr
.
args
[
0
],
default_type
)
base_type
=
get_type_of_expression
(
expr
.
args
[
0
]).
base_type
if
type
(
expr
.
args
[
0
])
is
vector_memory_access
\
else
get_type_of_expression
(
expr
.
args
[
0
])
pw
=
sp
.
Piecewise
((
-
new_arg
,
new_arg
<
base_type
.
numpy_dtype
.
type
(
0
)),
pw
=
sp
.
Piecewise
((
-
new_arg
,
new_arg
<
cast_func
(
0
,
base_type
.
numpy_dtype
)),
(
new_arg
,
True
))
return
visit_expr
(
pw
,
default_type
)
elif
expr
.
func
in
handled_functions
or
isinstance
(
expr
,
sp
.
Rel
)
or
isinstance
(
expr
,
BooleanFunction
):
...
...
pystencils_tests/test_field_access_poly.py
View file @
2b2aaf56
...
...
@@ -7,7 +7,7 @@
"""
import
pytest
from
pystencils.session
import
*
from
sympy
import
poly
...
...
@@ -22,8 +22,14 @@ def test_field_access_poly():
def
test_field_access_piecewise
():
dh
=
ps
.
create_data_handling
((
20
,
20
))
ρ
=
dh
.
add_array
(
'rho'
)
pw
=
sp
.
Piecewise
((
0
,
1
<
sp
.
Max
(
-
0.5
,
ρ
.
center
+
0.5
)),
(
1
,
True
))
a
=
sp
.
simplify
(
pw
)
print
(
a
)
try
:
a
=
sp
.
Piecewise
((
0
,
1
<
sp
.
Max
(
-
0.5
,
sp
.
Symbol
(
"test"
)
+
0.5
)),
(
1
,
True
))
a
.
simplify
()
except
Exception
as
e
:
pytest
.
skip
(
f
"Bug in SymPy 1.10:
{
e
}
"
)
else
:
dh
=
ps
.
create_data_handling
((
20
,
20
))
ρ
=
dh
.
add_array
(
'rho'
)
pw
=
sp
.
Piecewise
((
0
,
1
<
sp
.
Max
(
-
0.5
,
ρ
.
center
+
0.5
)),
(
1
,
True
))
a
=
sp
.
simplify
(
pw
)
print
(
a
)
pytest.ini
View file @
2b2aaf56
...
...
@@ -53,7 +53,7 @@ exclude_lines =
if
__name__
=
= .__main__.:
skip_covered
=
True
fail_under
=
8
6
fail_under
=
8
5
[html]
directory
=
coverage_report
setup.py
View file @
2b2aaf56
...
...
@@ -91,7 +91,7 @@ setuptools.setup(name='pystencils',
author_email
=
'cs10-codegen@fau.de'
,
url
=
'https://i10git.cs.fau.de/pycodegen/pystencils/'
,
packages
=
[
'pystencils'
]
+
[
'pystencils.'
+
s
for
s
in
setuptools
.
find_packages
(
'pystencils'
)],
install_requires
=
[
'sympy>=1.5.1,<=1.
9
'
,
'numpy>=1.8.0'
,
'appdirs'
,
'joblib'
],
install_requires
=
[
'sympy>=1.5.1,<=1.
10
'
,
'numpy>=1.8.0'
,
'appdirs'
,
'joblib'
],
package_data
=
{
'pystencils'
:
[
'include/*.h'
,
'backends/cuda_known_functions.txt'
,
'backends/opencl1.1_known_functions.txt'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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