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
Tom Harke
pystencils
Commits
10d68d25
Commit
10d68d25
authored
Feb 01, 2018
by
Martin Bauer
Browse files
Coupling of multiple LBM steps + demo for thermal coupling
parent
afd34623
Changes
3
Hide whitespace changes
Inline
Side-by-side
datahandling/datahandling_interface.py
View file @
10d68d25
...
...
@@ -128,24 +128,23 @@ class DataHandling(ABC):
def
toCpu
(
self
,
name
):
"""Copies GPU data of array with specified name to CPU.
Works only if 'cpu=True' and 'gpu=True' has been used in 'add' method"""
pass
@
abstractmethod
def
toGpu
(
self
,
name
):
"""Copies GPU data of array with specified name to GPU.
Works only if 'cpu=True' and 'gpu=True' has been used in 'add' method"""
pass
@
abstractmethod
def
allToCpu
(
self
,
name
):
"""Copies data from GPU to CPU for all arrays that have a CPU and a GPU representation"""
pass
@
abstractmethod
def
allToGpu
(
self
,
name
):
"""Copies data from CPU to GPU for all arrays that have a CPU and a GPU representation"""
pass
@
abstractmethod
def
isOnGpu
(
self
,
name
):
"""Checks if this data was also allocated on the GPU - does not check if this data item is in synced"""
@
abstractmethod
def
vtkWriter
(
self
,
fileName
,
dataNames
,
ghostLayers
=
False
):
...
...
datahandling/parallel_datahandling.py
View file @
10d68d25
...
...
@@ -121,6 +121,7 @@ class ParallelDataHandling(DataHandling):
self
.
_fieldNameToCpuDataName
[
latexName
]
=
name
if
gpu
:
self
.
_fieldNameToGpuDataName
[
latexName
]
=
self
.
GPU_DATA_PREFIX
+
name
return
self
.
fields
[
name
]
def
hasData
(
self
,
name
):
return
name
in
self
.
_fields
...
...
@@ -213,6 +214,9 @@ class ParallelDataHandling(DataHandling):
else
:
wlb
.
cuda
.
copyFieldToGpu
(
self
.
blocks
,
self
.
GPU_DATA_PREFIX
+
name
,
name
)
def
isOnGpu
(
self
,
name
):
return
name
,
self
.
GPU_DATA_PREFIX
+
name
in
self
.
_cpuGpuPairs
def
allToCpu
(
self
):
for
cpuName
,
gpuName
in
self
.
_cpuGpuPairs
:
wlb
.
cuda
.
copyFieldToCpu
(
self
.
blocks
,
gpuName
,
cpuName
)
...
...
datahandling/serial_datahandling.py
View file @
10d68d25
...
...
@@ -106,6 +106,7 @@ class SerialDataHandling(DataHandling):
self
.
fields
[
name
]
=
Field
.
createFixedSize
(
latexName
,
shape
=
kwargs
[
'shape'
],
indexDimensions
=
indexDimensions
,
dtype
=
kwargs
[
'dtype'
],
layout
=
layoutTuple
)
self
.
_fieldLatexNameToDataName
[
latexName
]
=
name
return
self
.
fields
[
name
]
def
addCustomData
(
self
,
name
,
cpuCreationFunction
,
gpuCreationFunction
=
None
,
cpuToGpuTransferFunc
=
None
,
gpuToCpuTransferFunc
=
None
):
...
...
@@ -209,6 +210,9 @@ class SerialDataHandling(DataHandling):
else
:
self
.
gpuArrays
[
name
].
set
(
self
.
cpuArrays
[
name
])
def
isOnGpu
(
self
,
name
):
return
name
in
self
.
gpuArrays
def
synchronizationFunctionCPU
(
self
,
names
,
stencilName
=
None
,
**
kwargs
):
return
self
.
_synchronizationFunctor
(
names
,
stencilName
,
'cpu'
)
...
...
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