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):
alignment=False,
field_type=FieldType.GENERIC):
super().add_array(name,
values_per_cell,
dtype,
latex_name,
ghost_layers,
layout,
cpu,
gpu,
alignment,
field_type)
rtn = super().add_array(name,
values_per_cell,
dtype,
latex_name,
ghost_layers,
layout,
cpu,
gpu,
alignment,
field_type)
if cpu:
self.call_queue.append(DataTransfer(self._fields[name], DataTransferKind.HOST_ALLOC))
if gpu:
self.call_queue.append(DataTransfer(self._fields[name], DataTransferKind.DEVICE_ALLOC))
return rtn
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):
......@@ -200,10 +201,10 @@ class GraphDataHandling(pystencils.datahandling.SerialDataHandling):
self.call_queue.append(Swap(self._fields[name1], self._fields[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))
super().run_kernel(kernel_function, **kwargs)
# skip calling super
if not simulate_only:
super().run_kernel(kernel_function, **kwargs)
def to_cpu(self, 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