Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alexander Reinauer
pystencils
Commits
48c16a56
Commit
48c16a56
authored
Mar 17, 2020
by
Alexander Reinauer
Browse files
Merge branch 'master' of
https://i10git.cs.fau.de/pycodegen/pystencils
into VoF
parents
c0188656
e87b4daf
Pipeline
#22665
passed with stage
in 8 minutes and 19 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pystencils/boundaries/boundaryhandling.py
View file @
48c16a56
...
...
@@ -96,21 +96,21 @@ class BoundaryHandling:
fi
=
flag_interface
self
.
flag_interface
=
fi
if
fi
is
not
None
else
FlagInterface
(
data_handling
,
name
+
"Flags"
)
if
ParallelDataHandling
and
isinstance
(
self
.
data_handling
,
ParallelDataHandling
):
array_handler
=
PyCudaArrayHandler
()
else
:
array_handler
=
self
.
data_handling
.
array_handler
def
to_cpu
(
gpu_version
,
cpu_version
):
gpu_version
=
gpu_version
.
boundary_object_to_index_list
cpu_version
=
cpu_version
.
boundary_object_to_index_list
for
obj
,
cpu_arr
in
cpu_version
.
items
():
gpu_version
[
obj
]
.
get
(
cpu_arr
)
array_handler
.
download
(
gpu_version
[
obj
]
,
cpu_arr
)
def
to_gpu
(
gpu_version
,
cpu_version
):
gpu_version
=
gpu_version
.
boundary_object_to_index_list
cpu_version
=
cpu_version
.
boundary_object_to_index_list
if
ParallelDataHandling
and
isinstance
(
self
.
data_handling
,
ParallelDataHandling
):
array_handler
=
PyCudaArrayHandler
()
else
:
array_handler
=
self
.
data_handling
.
array_handler
for
obj
,
cpu_arr
in
cpu_version
.
items
():
if
obj
not
in
gpu_version
or
gpu_version
[
obj
].
shape
!=
cpu_arr
.
shape
:
gpu_version
[
obj
]
=
array_handler
.
to_gpu
(
cpu_arr
)
...
...
pystencils/datahandling/serial_datahandling.py
View file @
48c16a56
...
...
@@ -226,7 +226,7 @@ class SerialDataHandling(DataHandling):
def
swap
(
self
,
name1
,
name2
,
gpu
=
None
):
if
gpu
is
None
:
gpu
=
self
.
default_target
==
"gpu"
gpu
=
self
.
default_target
in
self
.
_GPU_LIKE_TARGETS
arr
=
self
.
gpu_arrays
if
gpu
else
self
.
cpu_arrays
arr
[
name1
],
arr
[
name2
]
=
arr
[
name2
],
arr
[
name1
]
...
...
pystencils/gpucuda/periodicity.py
View file @
48c16a56
...
...
@@ -35,13 +35,14 @@ def get_periodic_boundary_functor(stencil, domain_size, index_dimensions=0, inde
assert
target
in
[
'gpu'
,
'opencl'
]
src_dst_slice_tuples
=
get_periodic_boundary_src_dst_slices
(
stencil
,
ghost_layers
,
thickness
)
kernels
=
[]
index_dimensions
=
index_dimensions
for
src_slice
,
dst_slice
in
src_dst_slice_tuples
:
ast
=
create_copy_kernel
(
domain_size
,
src_slice
,
dst_slice
,
index_dimensions
,
index_dim_shape
,
dtype
)
if
target
==
'gpu'
:
kernels
.
append
(
pystencils
.
gpucuda
.
make_python_function
(
ast
))
else
:
ast
.
_target
=
'opencl'
ast
.
_backend
=
'opencl'
kernels
.
append
(
pystencils
.
opencl
.
make_python_function
(
ast
,
opencl_queue
,
opencl_ctx
))
def
functor
(
pdfs
,
**
_
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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