Skip to content
Snippets Groups Projects
Commit b5500f21 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Fixes in GraphDataHandling

    - return field in add_array
    - add `simulate_only` parameter to call_kernel
parent 8b0cecb7
Branches
Tags
No related merge requests found
Pipeline #21603 failed
...@@ -168,20 +168,21 @@ class GraphDataHandling(pystencils.datahandling.SerialDataHandling): ...@@ -168,20 +168,21 @@ class GraphDataHandling(pystencils.datahandling.SerialDataHandling):
alignment=False, alignment=False,
field_type=FieldType.GENERIC): field_type=FieldType.GENERIC):
super().add_array(name, rtn = super().add_array(name,
values_per_cell, values_per_cell,
dtype, dtype,
latex_name, latex_name,
ghost_layers, ghost_layers,
layout, layout,
cpu, cpu,
gpu, gpu,
alignment, alignment,
field_type) field_type)
if cpu: if cpu:
self.call_queue.append(DataTransfer(self._fields[name], DataTransferKind.HOST_ALLOC)) self.call_queue.append(DataTransfer(self._fields[name], DataTransferKind.HOST_ALLOC))
if gpu: if gpu:
self.call_queue.append(DataTransfer(self._fields[name], DataTransferKind.DEVICE_ALLOC)) self.call_queue.append(DataTransfer(self._fields[name], DataTransferKind.DEVICE_ALLOC))
return rtn
def add_custom_data(self, name, cpu_creation_function, def add_custom_data(self, name, cpu_creation_function,
gpu_creation_function=None, cpu_to_gpu_transfer_func=None, gpu_to_cpu_transfer_func=None): gpu_creation_function=None, cpu_to_gpu_transfer_func=None, gpu_to_cpu_transfer_func=None):
...@@ -200,10 +201,10 @@ class GraphDataHandling(pystencils.datahandling.SerialDataHandling): ...@@ -200,10 +201,10 @@ class GraphDataHandling(pystencils.datahandling.SerialDataHandling):
self.call_queue.append(Swap(self._fields[name1], self._fields[name2], gpu)) self.call_queue.append(Swap(self._fields[name1], self._fields[name2], gpu))
super().swap(name1, name2, gpu) super().swap(name1, name2, gpu)
def run_kernel(self, kernel_function, **kwargs): def run_kernel(self, kernel_function, simulate_only=False, **kwargs):
self.call_queue.append(KernelCall(kernel_function, kwargs)) self.call_queue.append(KernelCall(kernel_function, kwargs))
super().run_kernel(kernel_function, **kwargs) if not simulate_only:
# skip calling super super().run_kernel(kernel_function, **kwargs)
def to_cpu(self, name): def to_cpu(self, name):
super().to_cpu(name) super().to_cpu(name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment