Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frederik Hennig
pystencils
Commits
fe314070
Commit
fe314070
authored
Jun 07, 2021
by
Frederik Hennig
Browse files
Reverted unnecessary changes, added doc comment
parent
9eabc9b6
Pipeline
#32514
failed with stage
in 32 minutes and 54 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pystencils/cpu/kernelcreation.py
View file @
fe314070
...
...
@@ -18,7 +18,7 @@ AssignmentOrAstNodeList = List[Union[Assignment, ast.Node]]
def
create_kernel
(
assignments
:
AssignmentOrAstNodeList
,
function_name
:
str
=
"kernel"
,
type_info
=
'double'
,
split_groups
=
(),
iteration_slice
=
None
,
ghost_layers
=
None
,
skip_independence_check
=
False
,
loop_step
=
1
,
allow_double_writes
=
False
)
->
KernelFunction
:
skip_independence_check
=
False
,
allow_double_writes
=
False
)
->
KernelFunction
:
"""Creates an abstract syntax tree for a kernel function, by taking a list of update rules.
Loops are created according to the field accesses in the equations.
...
...
@@ -39,6 +39,9 @@ def create_kernel(assignments: AssignmentOrAstNodeList, function_name: str = "ke
all dimensions
skip_independence_check: don't check that loop iterations are independent. This is needed e.g. for
periodicity kernel, that access the field outside the iteration bounds. Use with care!
allow_double_writes: If True, don't check if every field is only written at a single location. This is required
for example for kernels that are compiled with loop step sizes > 1, that handle multiple cells
at once. Use with care!
Returns:
AST node representing a function, that can be printed as C or CUDA code
...
...
pystencils/transformations.py
View file @
fe314070
...
...
@@ -150,7 +150,7 @@ def get_common_shape(field_set):
return
shape
def
make_loop_over_domain
(
body
,
iteration_slice
=
None
,
ghost_layers
=
None
,
loop_order
=
None
,
loop_step
=
1
):
def
make_loop_over_domain
(
body
,
iteration_slice
=
None
,
ghost_layers
=
None
,
loop_order
=
None
):
"""Uses :class:`pystencils.field.Field.Access` to create (multiple) loops around given AST.
Args:
...
...
@@ -195,7 +195,7 @@ def make_loop_over_domain(body, iteration_slice=None, ghost_layers=None, loop_or
if
iteration_slice
is
None
:
begin
=
ghost_layers
[
loop_coordinate
][
0
]
end
=
shape
[
loop_coordinate
]
-
ghost_layers
[
loop_coordinate
][
1
]
new_loop
=
ast
.
LoopOverCoordinate
(
current_body
,
loop_coordinate
,
begin
,
end
,
step
=
loop_step
)
new_loop
=
ast
.
LoopOverCoordinate
(
current_body
,
loop_coordinate
,
begin
,
end
)
current_body
=
ast
.
Block
([
new_loop
])
else
:
slice_component
=
iteration_slice
[
loop_coordinate
]
...
...
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