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
c7a4918a
Commit
c7a4918a
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Attach assignments to KernelFunction
parent
f6907740
No related branches found
No related tags found
1 merge request
!98
WIP: Graph datahandling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/kernelcreation.py
+5
-2
5 additions, 2 deletions
pystencils/kernelcreation.py
with
5 additions
and
2 deletions
pystencils/kernelcreation.py
+
5
−
2
View file @
c7a4918a
...
...
@@ -130,6 +130,7 @@ def create_kernel(assignments,
if
use_auto_for_assignments
:
for
a
in
ast
.
atoms
(
SympyAssignment
):
a
.
use_auto
=
True
ast
.
assignments
=
assignments
return
ast
...
...
@@ -184,6 +185,7 @@ def create_indexed_kernel(assignments,
assignments
=
[
assignments
]
elif
isinstance
(
assignments
,
AssignmentCollection
):
assignments
=
assignments
.
all_assignments
if
target
==
'
cpu
'
:
from
pystencils.cpu
import
create_indexed_kernel
from
pystencils.cpu
import
add_openmp
...
...
@@ -191,7 +193,6 @@ def create_indexed_kernel(assignments,
coordinate_names
=
coordinate_names
)
if
cpu_openmp
:
add_openmp
(
ast
,
num_threads
=
cpu_openmp
)
return
ast
elif
target
==
'
llvm
'
:
raise
NotImplementedError
(
"
Indexed kernels are not yet supported in LLVM backend
"
)
elif
target
==
'
gpu
'
or
target
==
'
opencl
'
:
...
...
@@ -209,10 +210,12 @@ def create_indexed_kernel(assignments,
ast
.
compile
=
functools
.
partial
(
make_python_function
,
ast
,
opencl_queue
,
opencl_ctx
)
ast
.
_target
=
'
opencl
'
ast
.
_backend
=
'
opencl
'
return
ast
else
:
raise
ValueError
(
"
Unknown target %s. Has to be either
'
cpu
'
or
'
gpu
'"
%
(
target
,))
ast
.
assignments
=
assignments
return
ast
def
create_staggered_kernel
(
assignments
,
target
=
'
cpu
'
,
gpu_exclusive_conditions
=
False
,
**
kwargs
):
"""
Kernel that updates a staggered field.
...
...
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