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
Stephan Seitz
pystencils
Commits
b3deafd5
Commit
b3deafd5
authored
Nov 30, 2019
by
Michael Kuron
Browse files
Correct number of ghost layers in create_staggered_kernel
parent
44a924db
Changes
2
Hide whitespace changes
Inline
Side-by-side
pystencils/cpu/kernelcreation.py
View file @
b3deafd5
...
...
@@ -34,6 +34,7 @@ def create_kernel(assignments: AssignmentOrAstNodeList, function_name: str = "ke
transformation :func:`pystencils.transformation.split_inner_loop`
iteration_slice: if not None, iteration is done only over this slice of the field
ghost_layers: a sequence of pairs for each coordinate with lower and upper nr of ghost layers
that should be excluded from the iteration.
if None, the number of ghost layers is determined automatically and assumed to be equal for a
all dimensions
skip_independence_check: don't check that loop iterations are independent. This is needed e.g. for
...
...
pystencils/kernelcreation.py
View file @
b3deafd5
...
...
@@ -36,9 +36,9 @@ def create_kernel(assignments,
to type
iteration_slice: rectangular subset to iterate over, if not specified the complete non-ghost layer
\
part of the field is iterated over
ghost_layers:
if left to default, the number of necessary ghost layers is determined automatically
a single integer specifies the ghost layer count at all borders, can also be a sequence of
pairs ``[(x_lower_gl, x_upper_gl), .... ]``
ghost_layers:
a single integer specifies the ghost layer count at all borders, can also be a sequence of
pairs ``[(x_lower_gl, x_upper_gl), .... ]``. These layers are excluded from the iteration.
If left to default, the number of ghost layers is determined automatically.
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!
cpu_openmp: True or number of threads for OpenMP parallelization, False for no OpenMP
...
...
@@ -249,14 +249,14 @@ def create_staggered_kernel(assignments, gpu_exclusive_conditions=False, **kwarg
for
elementary_direction
in
direction
:
exclusions
.
remove
(
inverse_direction_string
(
elementary_direction
))
common_exclusions
.
intersection_update
(
exclusions
)
ghost_layers
=
[[
1
,
1
]
for
d
in
range
(
dim
)]
ghost_layers
=
[[
0
,
0
]
for
d
in
range
(
dim
)]
for
direction
in
common_exclusions
:
direction
=
direction_string_to_offset
(
direction
)
for
d
,
s
in
enumerate
(
direction
):
if
s
==
1
:
ghost_layers
[
d
][
0
]
=
0
ghost_layers
[
d
][
1
]
=
1
elif
s
==
-
1
:
ghost_layers
[
d
][
1
]
=
0
ghost_layers
[
d
][
0
]
=
1
def
condition
(
direction
):
"""exclude those staggered points that correspond to fluxes between ghost cells"""
...
...
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