Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Bindgen
pystencils
Commits
a4e8ce0c
Commit
a4e8ce0c
authored
Dec 11, 2020
by
Sebastian Bindgen
Browse files
Usage of custom boundary functor if given
parent
e20f82a3
Pipeline
#28607
passed with stage
in 5 minutes and 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pystencils/datahandling/serial_datahandling.py
View file @
a4e8ce0c
...
...
@@ -271,7 +271,7 @@ class SerialDataHandling(DataHandling):
def
synchronization_function_gpu
(
self
,
names
,
stencil_name
=
None
,
**
_
):
return
self
.
synchronization_function
(
names
,
stencil_name
,
target
=
'gpu'
)
def
synchronization_function
(
self
,
names
,
stencil
=
None
,
target
=
None
,
**
_
):
def
synchronization_function
(
self
,
names
,
stencil
=
None
,
target
=
None
,
functor
=
None
,
**
_
):
if
target
is
None
:
target
=
self
.
default_target
if
target
==
'opencl'
:
...
...
@@ -311,19 +311,22 @@ class SerialDataHandling(DataHandling):
if
len
(
filtered_stencil
)
>
0
:
if
target
==
'cpu'
:
from
pystencils.slicing
import
get_periodic_boundary_functor
result
.
append
(
get_periodic_boundary_functor
(
filtered_stencil
,
ghost_layers
=
gls
))
if
functor
is
None
:
from
pystencils.slicing
import
get_periodic_boundary_functor
functor
=
get_periodic_boundary_functor
result
.
append
(
functor
(
filtered_stencil
,
ghost_layers
=
gls
))
else
:
from
pystencils.gpucuda.periodicity
import
get_periodic_boundary_functor
as
boundary_func
target
=
'gpu'
if
not
isinstance
(
self
.
array_handler
,
PyOpenClArrayHandler
)
else
'opencl'
result
.
append
(
boundary_func
(
filtered_stencil
,
self
.
_domainSize
,
index_dimensions
=
self
.
fields
[
name
].
index_dimensions
,
index_dim_shape
=
values_per_cell
,
dtype
=
self
.
fields
[
name
].
dtype
.
numpy_dtype
,
ghost_layers
=
gls
,
target
=
target
,
opencl_queue
=
self
.
_opencl_queue
,
opencl_ctx
=
self
.
_opencl_ctx
))
if
functor
is
None
:
from
pystencils.gpucuda.periodicity
import
get_periodic_boundary_functor
as
functor
target
=
'gpu'
if
not
isinstance
(
self
.
array_handler
,
PyOpenClArrayHandler
)
else
'opencl'
result
.
append
(
functor
(
filtered_stencil
,
self
.
_domainSize
,
index_dimensions
=
self
.
fields
[
name
].
index_dimensions
,
index_dim_shape
=
values_per_cell
,
dtype
=
self
.
fields
[
name
].
dtype
.
numpy_dtype
,
ghost_layers
=
gls
,
target
=
target
,
opencl_queue
=
self
.
_opencl_queue
,
opencl_ctx
=
self
.
_opencl_ctx
))
if
target
==
'cpu'
:
def
result_functor
():
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment