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
Jonas Plewinski
pystencils
Commits
32b97ae5
Commit
32b97ae5
authored
7 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Documentation cleanup part1
parent
956c89a0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kernelcreation.py
+11
-9
11 additions, 9 deletions
kernelcreation.py
session.py
+6
-0
6 additions, 0 deletions
session.py
with
17 additions
and
9 deletions
kernelcreation.py
+
11
−
9
View file @
32b97ae5
...
...
@@ -7,12 +7,12 @@ from pystencils.gpucuda.indexing import indexing_creator_from_params
from
pystencils.transformations
import
remove_conditionals_in_staggered_kernel
def
create_kernel
(
equation
s
,
target
=
'
cpu
'
,
data_type
=
"
double
"
,
iteration_slice
=
None
,
ghost_layers
=
None
,
def
create_kernel
(
assignment
s
,
target
=
'
cpu
'
,
data_type
=
"
double
"
,
iteration_slice
=
None
,
ghost_layers
=
None
,
cpu_openmp
=
False
,
cpu_vectorize_info
=
None
,
gpu_indexing
=
'
block
'
,
gpu_indexing_params
=
MappingProxyType
({})):
"""
Creates abstract syntax tree (AST) of kernel, using a list of update equations.
:param
equation
s: either be a plain list of equations or a AssignmentCollection object
:param
assignment
s: either be a plain list of equations or a AssignmentCollection object
:param target:
'
cpu
'
,
'
llvm
'
or
'
gpu
'
:param data_type: data type used for all untyped symbols (i.e. non-fields), can also be a dict from symbol name
to type
...
...
@@ -37,16 +37,18 @@ def create_kernel(equations, target='cpu', data_type="double", iteration_slice=N
# ---- Normalizing parameters
split_groups
=
()
if
isinstance
(
equations
,
AssignmentCollection
):
if
'
split_groups
'
in
equations
.
simplification_hints
:
split_groups
=
equations
.
simplification_hints
[
'
split_groups
'
]
equations
=
equations
.
all_assignments
if
isinstance
(
assignments
,
AssignmentCollection
):
if
'
split_groups
'
in
assignments
.
simplification_hints
:
split_groups
=
assignments
.
simplification_hints
[
'
split_groups
'
]
assignments
=
assignments
.
all_assignments
if
isinstance
(
assignments
,
Assignment
):
assignments
=
[
assignments
]
# ---- Creating ast
if
target
==
'
cpu
'
:
from
pystencils.cpu
import
create_kernel
from
pystencils.cpu
import
add_openmp
ast
=
create_kernel
(
equation
s
,
type_info
=
data_type
,
split_groups
=
split_groups
,
ast
=
create_kernel
(
assignment
s
,
type_info
=
data_type
,
split_groups
=
split_groups
,
iteration_slice
=
iteration_slice
,
ghost_layers
=
ghost_layers
)
if
cpu_openmp
:
add_openmp
(
ast
,
num_threads
=
cpu_openmp
)
...
...
@@ -60,12 +62,12 @@ def create_kernel(equations, target='cpu', data_type="double", iteration_slice=N
return
ast
elif
target
==
'
llvm
'
:
from
pystencils.llvm
import
create_kernel
ast
=
create_kernel
(
equation
s
,
type_info
=
data_type
,
split_groups
=
split_groups
,
ast
=
create_kernel
(
assignment
s
,
type_info
=
data_type
,
split_groups
=
split_groups
,
iteration_slice
=
iteration_slice
,
ghost_layers
=
ghost_layers
)
return
ast
elif
target
==
'
gpu
'
:
from
pystencils.gpucuda
import
create_cuda_kernel
ast
=
create_cuda_kernel
(
equation
s
,
type_info
=
data_type
,
ast
=
create_cuda_kernel
(
assignment
s
,
type_info
=
data_type
,
indexing_creator
=
indexing_creator_from_params
(
gpu_indexing
,
gpu_indexing_params
),
iteration_slice
=
iteration_slice
,
ghost_layers
=
ghost_layers
)
return
ast
...
...
This diff is collapsed.
Click to expand it.
session.py
0 → 100644
+
6
−
0
View file @
32b97ae5
from
pystencils.sympy_gmpy_bug_workaround
import
*
from
pystencils
import
*
import
sympy
as
sp
import
numpy
as
np
import
pystencils.plot2d
as
plt
from
pystencils.jupytersetup
import
*
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