diff --git a/src/pystencils_autodiff/backends/astnodes.py b/src/pystencils_autodiff/backends/astnodes.py index 9c968ccbb1f59e2ae97acfccd9c7baf501ab68ae..34a6a3f4a26d45ad20a7651e9bf264bf9731e44a 100644 --- a/src/pystencils_autodiff/backends/astnodes.py +++ b/src/pystencils_autodiff/backends/astnodes.py @@ -59,6 +59,7 @@ class PybindArrayDestructuring(DestructuringBindingsForFieldClass): } CLASS_NAME_TEMPLATE = "pybind11::array_t<{dtype}>" + ARGS_AS_REFERENCE = False headers = ["<pybind11/numpy.h>"] diff --git a/src/pystencils_autodiff/framework_integration/texture_astnodes.py b/src/pystencils_autodiff/framework_integration/texture_astnodes.py index f6b2f532f6348bec468ffd6e1377346019899c0c..e228b217d6275c0f08066bc26a5a5233067c43a1 100644 --- a/src/pystencils_autodiff/framework_integration/texture_astnodes.py +++ b/src/pystencils_autodiff/framework_integration/texture_astnodes.py @@ -187,7 +187,7 @@ cudaMalloc{ndim}Array(&{array}, &channel_desc_{texture_name}, """ + ( copy_params = f'cpy_{texture_name}_params' return f"""cudaMemcpy3DParms {copy_params}{{}}; {copy_params}.srcPtr = {{{self._device_ptr}, - {self._texture.field.strides[-1] * self._texture.field.shape[-1] * self._dtype.numpy_dtype.itemsize}, + {self._texture.field.strides[-1] * self._texture.field.shape[-2]}, {self._texture.field.shape[-1]}, {self._texture.field.shape[-2]}}}; {copy_params}.dstArray = {array}; @@ -201,7 +201,7 @@ cudaMemcpy3D(&{copy_params});""" # noqa 0u, 0u, {self._device_ptr}, - {self._texture.field.strides[-1] * self._texture.field.shape[-1] * self._dtype.numpy_dtype.itemsize}, + {self._texture.field.strides[-1]}, {self._texture.field.shape[-1]}, {self._texture.field.shape[-2]}, cudaMemcpyDeviceToDevice);