Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
7cdc885a
Commit
7cdc885a
authored
5 years ago
by
Michael Kuron
Browse files
Options
Downloads
Patches
Plain Diff
create_staggered_kernel gpu_exclusive_conditions with more neighbors
parent
23a8f33d
No related branches found
No related tags found
1 merge request
!93
Reimplement create_staggered_kernel
Pipeline
#20158
passed with warnings
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/kernelcreation.py
+11
-6
11 additions, 6 deletions
pystencils/kernelcreation.py
with
11 additions
and
6 deletions
pystencils/kernelcreation.py
+
11
−
6
View file @
7cdc885a
from
types
import
MappingProxyType
from
itertools
import
combinations
import
sympy
as
sp
...
...
@@ -280,14 +281,18 @@ def create_staggered_kernel(assignments, target='cpu', gpu_exclusive_conditions=
if
gpu_exclusive_conditions
:
outer_assignment
=
None
for
assignment
in
assignments
:
direction
=
assignment
.
lhs
.
field
.
staggered_stencil
[
assignment
.
lhs
.
index
[
0
]]
assignment
=
SympyAssignment
(
assignment
.
lhs
,
assignment
.
rhs
)
outer_assignment
=
Conditional
(
condition
(
direction
),
Block
([
assignment
]),
outer_assignment
)
conditions
=
{
direction
:
condition
(
direction
)
for
direction
in
stencil
}
for
num_conditions
in
range
(
len
(
stencil
)):
for
combination
in
combinations
(
conditions
.
values
(),
num_conditions
):
for
assignment
in
assignments
:
direction
=
stencil
[
assignment
.
lhs
.
index
[
0
]]
if
conditions
[
direction
]
in
combination
:
assignment
=
SympyAssignment
(
assignment
.
lhs
,
assignment
.
rhs
)
outer_assignment
=
Conditional
(
sp
.
And
(
*
combination
),
Block
([
assignment
]),
outer_assignment
)
inner_assignment
=
[]
for
assignment
in
assignments
:
direction
=
assignment
.
lhs
.
field
.
staggered_
stencil
[
assignment
.
lhs
.
index
[
0
]]
direction
=
stencil
[
assignment
.
lhs
.
index
[
0
]]
inner_assignment
.
append
(
SympyAssignment
(
assignment
.
lhs
,
assignment
.
rhs
))
last_conditional
=
Conditional
(
sp
.
And
(
*
[
condition
(
d
)
for
d
in
stencil
]),
Block
(
inner_assignment
),
outer_assignment
)
...
...
@@ -303,7 +308,7 @@ def create_staggered_kernel(assignments, target='cpu', gpu_exclusive_conditions=
return
ast
for
assignment
in
assignments
:
direction
=
assignment
.
lhs
.
field
.
staggered_
stencil
[
assignment
.
lhs
.
index
[
0
]]
direction
=
stencil
[
assignment
.
lhs
.
index
[
0
]]
sp_assignments
=
[
s
for
s
in
subexpressions
if
not
hasattr
(
s
,
'
lhs
'
)]
+
\
[
SympyAssignment
(
s
.
lhs
,
s
.
rhs
)
for
s
in
subexpressions
if
hasattr
(
s
,
'
lhs
'
)]
+
\
[
SympyAssignment
(
assignment
.
lhs
,
assignment
.
rhs
)]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment