Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pystencils_walberla
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
Stephan Seitz
pystencils_walberla
Commits
d482fd91
Commit
d482fd91
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Allow construction of sweeps from ASTs
parent
87e299fd
No related branches found
No related tags found
No related merge requests found
Pipeline
#21472
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils_walberla/codegen.py
+6
-2
6 additions, 2 deletions
pystencils_walberla/codegen.py
with
6 additions
and
2 deletions
pystencils_walberla/codegen.py
+
6
−
2
View file @
d482fd91
...
@@ -6,6 +6,7 @@ from jinja2 import Environment, PackageLoader
...
@@ -6,6 +6,7 @@ from jinja2 import Environment, PackageLoader
from
pystencils
import
(
from
pystencils
import
(
Assignment
,
AssignmentCollection
,
Field
,
FieldType
,
create_kernel
,
create_staggered_kernel
)
Assignment
,
AssignmentCollection
,
Field
,
FieldType
,
create_kernel
,
create_staggered_kernel
)
from
pystencils.astnodes
import
KernelFunction
from
pystencils.backends.cbackend
import
get_headers
from
pystencils.backends.cbackend
import
get_headers
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
from
pystencils.stencil
import
inverse_direction
,
offset_to_direction_string
from
pystencils.stencil
import
inverse_direction
,
offset_to_direction_string
...
@@ -29,7 +30,7 @@ def generate_sweep(generation_context, class_name, assignments,
...
@@ -29,7 +30,7 @@ def generate_sweep(generation_context, class_name, assignments,
defines where to write generated files, if OpenMP is available or which SIMD instruction
defines where to write generated files, if OpenMP is available or which SIMD instruction
set should be used. See waLBerla examples on how to get a context.
set should be used. See waLBerla examples on how to get a context.
class_name: name of the generated sweep class
class_name: name of the generated sweep class
assignments: list of assignments defining the stencil update rule
assignments: list of assignments defining the stencil update rule
or a :class:`KernelFunction`
namespace: the generated class is accessible as walberla::<namespace>::<class_name>
namespace: the generated class is accessible as walberla::<namespace>::<class_name>
field_swaps: sequence of field pairs (field, temporary_field). The generated sweep only gets the first field
field_swaps: sequence of field pairs (field, temporary_field). The generated sweep only gets the first field
as argument, creating a temporary field internally which is swapped with the first field after
as argument, creating a temporary field internally which is swapped with the first field after
...
@@ -48,7 +49,10 @@ def generate_sweep(generation_context, class_name, assignments,
...
@@ -48,7 +49,10 @@ def generate_sweep(generation_context, class_name, assignments,
if
not
generation_context
.
cuda
and
create_kernel_params
[
'
target
'
]
==
'
gpu
'
:
if
not
generation_context
.
cuda
and
create_kernel_params
[
'
target
'
]
==
'
gpu
'
:
return
return
if
not
staggered
:
if
isinstance
(
assignments
,
KernelFunction
):
ast
=
assignments
create_kernel_params
[
'
target
'
]
=
ast
.
target
elif
not
staggered
:
ast
=
create_kernel
(
assignments
,
**
create_kernel_params
)
ast
=
create_kernel
(
assignments
,
**
create_kernel_params
)
else
:
else
:
ast
=
create_staggered_kernel
(
assignments
,
**
create_kernel_params
)
ast
=
create_staggered_kernel
(
assignments
,
**
create_kernel_params
)
...
...
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