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
pycodegen
pystencils
Commits
47dbf5d3
Commit
47dbf5d3
authored
Jan 14, 2020
by
Michael Kuron
Browse files
SerialDataHandling: synchronization_function for tensor fields
parent
b6c9f64c
Pipeline
#21019
passed with stage
in 3 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pystencils/datahandling/serial_datahandling.py
View file @
47dbf5d3
...
@@ -307,8 +307,6 @@ class SerialDataHandling(DataHandling):
...
@@ -307,8 +307,6 @@ class SerialDataHandling(DataHandling):
values_per_cell
=
(
1
,
)
values_per_cell
=
(
1
,
)
if
len
(
values_per_cell
)
==
1
:
if
len
(
values_per_cell
)
==
1
:
values_per_cell
=
values_per_cell
[
0
]
values_per_cell
=
values_per_cell
[
0
]
else
:
raise
NotImplementedError
(
"Synchronization of this field is not supported: "
+
name
)
if
len
(
filtered_stencil
)
>
0
:
if
len
(
filtered_stencil
)
>
0
:
if
target
==
'cpu'
:
if
target
==
'cpu'
:
...
...
pystencils/gpucuda/periodicity.py
View file @
47dbf5d3
import
numpy
as
np
import
numpy
as
np
from
itertools
import
product
import
pystencils.gpucuda
import
pystencils.gpucuda
import
pystencils.opencl
import
pystencils.opencl
...
@@ -9,8 +10,6 @@ from pystencils.slicing import get_periodic_boundary_src_dst_slices, normalize_s
...
@@ -9,8 +10,6 @@ from pystencils.slicing import get_periodic_boundary_src_dst_slices, normalize_s
def
create_copy_kernel
(
domain_size
,
from_slice
,
to_slice
,
index_dimensions
=
0
,
index_dim_shape
=
1
,
dtype
=
np
.
float64
):
def
create_copy_kernel
(
domain_size
,
from_slice
,
to_slice
,
index_dimensions
=
0
,
index_dim_shape
=
1
,
dtype
=
np
.
float64
):
"""Copies a rectangular part of an array to another non-overlapping part"""
"""Copies a rectangular part of an array to another non-overlapping part"""
if
index_dimensions
not
in
(
0
,
1
):
raise
NotImplementedError
(
"Works only for one or zero index coordinates"
)
f
=
Field
.
create_generic
(
"pdfs"
,
len
(
domain_size
),
index_dimensions
=
index_dimensions
,
dtype
=
dtype
)
f
=
Field
.
create_generic
(
"pdfs"
,
len
(
domain_size
),
index_dimensions
=
index_dimensions
,
dtype
=
dtype
)
normalized_from_slice
=
normalize_slice
(
from_slice
,
f
.
spatial_shape
)
normalized_from_slice
=
normalize_slice
(
from_slice
,
f
.
spatial_shape
)
...
@@ -21,8 +20,10 @@ def create_copy_kernel(domain_size, from_slice, to_slice, index_dimensions=0, in
...
@@ -21,8 +20,10 @@ def create_copy_kernel(domain_size, from_slice, to_slice, index_dimensions=0, in
"Slices have to have same size"
"Slices have to have same size"
update_eqs
=
[]
update_eqs
=
[]
for
i
in
range
(
index_dim_shape
):
if
index_dimensions
<
2
:
eq
=
Assignment
(
f
(
i
),
f
[
tuple
(
offset
)](
i
))
index_dim_shape
=
[
index_dim_shape
]
for
i
in
product
(
*
[
range
(
d
)
for
d
in
index_dim_shape
]):
eq
=
Assignment
(
f
(
*
i
),
f
[
tuple
(
offset
)](
*
i
))
update_eqs
.
append
(
eq
)
update_eqs
.
append
(
eq
)
ast
=
create_cuda_kernel
(
update_eqs
,
iteration_slice
=
to_slice
,
skip_independence_check
=
True
)
ast
=
create_cuda_kernel
(
update_eqs
,
iteration_slice
=
to_slice
,
skip_independence_check
=
True
)
...
...
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