Commit 10d68d25 authored by Martin Bauer's avatar Martin Bauer
Browse files

Coupling of multiple LBM steps + demo for thermal coupling

parent afd34623
......@@ -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):
......
......@@ -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)
......
......@@ -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')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment