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
00738cb8
Commit
00738cb8
authored
May 04, 2022
by
Markus Holzer
Browse files
More fixes
parent
1edb192f
Changes
5
Hide whitespace changes
Inline
Side-by-side
pystencils/kernel_contrains_check.py
View file @
00738cb8
...
...
@@ -54,12 +54,15 @@ class KernelConstraintsCheck:
# Disable double write check inside conditionals
# would be triggered by e.g. in-kernel boundaries
old_double_write
=
self
.
check_double_write_condition
old_independence_condition
=
self
.
check_independence_condition
self
.
check_double_write_condition
=
False
self
.
check_independence_condition
=
False
if
obj
.
false_block
:
self
.
visit
(
obj
.
false_block
)
self
.
process_expression
(
obj
.
condition_expr
)
self
.
process_expression
(
obj
.
true_block
)
self
.
check_double_write_condition
=
old_double_write
self
.
check_independence_condition
=
old_independence_condition
self
.
scopes
.
pop
()
elif
isinstance
(
obj
,
ast
.
Block
):
self
.
scopes
.
push
()
...
...
pystencils/kernelcreation.py
View file @
00738cb8
...
...
@@ -75,7 +75,7 @@ def create_kernel(assignments: Union[Assignment, List[Assignment], AssignmentCol
warnings
.
warn
(
f
"It was not possible to apply the default pystencils optimisations to the "
f
"AssignmentCollection due to the following problem :
{
e
}
"
)
simplification_hints
=
assignments
.
simplification_hints
assignments
=
NodeCollection
(
assignment
s
.
all_
assignments
)
assignments
=
NodeCollection
.
from_
assignment
_collection
(
assignments
)
assignments
.
simplification_hints
=
simplification_hints
if
config
.
index_fields
:
...
...
pystencils/node_collection.py
View file @
00738cb8
...
...
@@ -31,7 +31,16 @@ class NodeCollection:
@
staticmethod
def
from_assignment_collection
(
assignment_collection
:
AssignmentCollection
):
return
NodeCollection
([
SympyAssignment
(
a
.
lhs
,
a
.
rhs
)
for
a
in
assignment_collection
.
all_assignments
])
nodes
=
list
()
for
assignemt
in
assignment_collection
.
all_assignments
:
if
isinstance
(
assignemt
,
Assignment
):
nodes
.
append
(
SympyAssignment
(
assignemt
.
lhs
,
assignemt
.
rhs
))
elif
isinstance
(
assignemt
,
Node
):
nodes
.
append
(
assignemt
)
else
:
raise
ValueError
(
f
"Unknown node in the AssignmentCollection:
{
assignemt
}
"
)
return
NodeCollection
(
nodes
)
def
evaluate_terms
(
self
):
evaluate_constant_terms
=
ReplaceOptim
(
...
...
pystencils/typing/cast_functions.py
View file @
00738cb8
...
...
@@ -89,6 +89,7 @@ class CastFunc(sp.Function):
else
:
return
super
().
is_nonnegative
@
property
def
is_real
(
self
):
"""
...
...
pystencils/typing/utilities.py
View file @
00738cb8
...
...
@@ -129,8 +129,6 @@ def get_type_of_expression(expr,
expr
=
sp
.
sympify
(
expr
)
if
isinstance
(
expr
,
sp
.
Integer
):
return
create_type
(
default_int_type
)
elif
expr
.
is_real
is
False
:
return
create_type
((
np
.
zeros
((
1
,),
default_float_type
)
*
1j
).
dtype
)
elif
isinstance
(
expr
,
sp
.
Rational
)
or
isinstance
(
expr
,
sp
.
Float
):
return
create_type
(
default_float_type
)
elif
isinstance
(
expr
,
ResolvedFieldAccess
):
...
...
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