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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Sebastian Bindgen
pystencils
Commits
de710402
Commit
de710402
authored
5 years ago
by
Stephan Seitz
Browse files
Options
Downloads
Patches
Plain Diff
Allow default_target=='opencl' in SerialDataHandling
parent
62803d18
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/datahandling/serial_datahandling.py
+9
-8
9 additions, 8 deletions
pystencils/datahandling/serial_datahandling.py
with
9 additions
and
8 deletions
pystencils/datahandling/serial_datahandling.py
+
9
−
8
View file @
de710402
...
...
@@ -16,6 +16,9 @@ from pystencils.utils import DotDict
class
SerialDataHandling
(
DataHandling
):
_GPU_LIKE_TARGETS
=
[
'
gpu
'
,
'
opencl
'
]
_GPU_LIKE_BACKENDS
=
[
'
gpucuda
'
,
'
opencl
'
]
def
__init__
(
self
,
domain_size
:
Sequence
[
int
],
default_ghost_layers
:
int
=
1
,
...
...
@@ -48,17 +51,16 @@ class SerialDataHandling(DataHandling):
self
.
_opencl_queue
=
opencl_queue
self
.
_opencl_ctx
=
opencl_ctx
if
array_handler
:
self
.
array_handler
=
array_handler
else
:
if
not
array_handler
:
try
:
self
.
array_handler
=
PyCudaArrayHandler
()
except
Exception
:
self
.
array_handler
=
None
if
default_target
==
'
opencl
'
or
opencl_queue
:
default_target
=
'
gpu
'
self
.
array_handler
=
PyOpenClArrayHandler
(
opencl_queue
)
else
:
self
.
array_handler
=
array_handler
if
periodicity
is
None
or
periodicity
is
False
:
periodicity
=
[
False
]
*
self
.
dim
...
...
@@ -99,7 +101,7 @@ class SerialDataHandling(DataHandling):
if
layout
is
None
:
layout
=
self
.
default_layout
if
gpu
is
None
:
gpu
=
self
.
default_target
==
'
gpu
'
gpu
=
self
.
default_target
in
self
.
_GPU_LIKE_TARGETS
kwargs
=
{
'
shape
'
:
tuple
(
s
+
2
*
ghost_layers
for
s
in
self
.
_domainSize
),
...
...
@@ -239,13 +241,12 @@ class SerialDataHandling(DataHandling):
self
.
to_gpu
(
name
)
def
run_kernel
(
self
,
kernel_function
,
**
kwargs
):
arrays
=
self
.
gpu_arrays
if
kernel_function
.
ast
.
backend
==
'
gpucuda
'
\
or
kernel_function
.
ast
.
backend
==
'
opencl
'
else
self
.
cpu_arrays
arrays
=
self
.
gpu_arrays
if
kernel_function
.
ast
.
backend
in
self
.
_GPU_LIKE_BACKENDS
else
self
.
cpu_arrays
kernel_function
(
**
arrays
,
**
kwargs
)
def
get_kernel_kwargs
(
self
,
kernel_function
,
**
kwargs
):
result
=
{}
result
.
update
(
self
.
gpu_arrays
if
kernel_function
.
ast
.
backend
==
'
gpucuda
'
else
self
.
cpu_arrays
)
result
.
update
(
self
.
gpu_arrays
if
kernel_function
.
ast
.
backend
in
self
.
_GPU_LIKE_BACKENDS
else
self
.
cpu_arrays
)
result
.
update
(
kwargs
)
return
[
result
]
...
...
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