diff --git a/src/pystencils_autodiff/backends/astnodes.py b/src/pystencils_autodiff/backends/astnodes.py index 0e5bdd4c9155a6734a141a3ef0eaef0782622449..1dc2594e6fd1cd2e359ee49af163d34aca23dcfd 100644 --- a/src/pystencils_autodiff/backends/astnodes.py +++ b/src/pystencils_autodiff/backends/astnodes.py @@ -14,6 +14,7 @@ from os.path import dirname, exists, join from pystencils.astnodes import FieldPointerSymbol, FieldShapeSymbol, FieldStrideSymbol from pystencils.cpu.cpujit import get_cache_config +from pystencils.include import get_pycuda_include_path, get_pystencils_include_path from pystencils_autodiff._file_io import read_template_from_file, write_file from pystencils_autodiff.backends.python_bindings import ( PybindFunctionWrapping, PybindPythonBindings, TensorflowFunctionWrapping, @@ -105,6 +106,7 @@ class TorchModule(JinjaCppFile): torch_extension = load(hash, [file_name], with_cuda=self.is_cuda, + extra_cflags='--std=c++14', extra_include_paths=[ get_pycuda_include_path(), get_pystencils_include_path()]) return torch_extension diff --git a/src/pystencils_autodiff/framework_integration/astnodes.py b/src/pystencils_autodiff/framework_integration/astnodes.py index 856505800f3006fbd774f94b26b0060dc41870b9..fdfe10064206b47ce28685796a7e94ae81793f00 100644 --- a/src/pystencils_autodiff/framework_integration/astnodes.py +++ b/src/pystencils_autodiff/framework_integration/astnodes.py @@ -11,13 +11,14 @@ waLBerla currently uses `pystencils-walberla <https://pypi.org/project/pystencil """ import itertools from collections.abc import Iterable +from functools import reduce from typing import Any, List, Set import jinja2 import numpy as np -import sympy as sp import pystencils +import sympy as sp from pystencils.astnodes import KernelFunction, Node, NodeOrExpr, ResolvedFieldAccess from pystencils.data_types import TypedSymbol from pystencils.kernelparameters import FieldPointerSymbol, FieldShapeSymbol, FieldStrideSymbol @@ -95,7 +96,7 @@ class NativeTextureBinding(pystencils.backends.cbackend.CustomCodeNode): cudaTextureDesc {texture_desc}{{}}; cudaTextureObject_t {texture_object}=0; -cudaCreateTextureObject(&{texture_object}, &{resource_desc}, &texture_desc, null_ptr); +cudaCreateTextureObject(&{texture_object}, &{resource_desc}, &{texture_desc}, nullptr); {texture_desc}.readMode = cudaReadModeElementType; auto {texture_object}Destroyer = [&](){{ cudaDestroyTextureObject({texture_object}); @@ -153,7 +154,7 @@ auto {texture_object}Destroyer = [&](){{ device_ptr=self._device_ptr, cuda_channel_format=self._get_channel_format_string(), bits_per_channel=self._dtype.itemsize * 8, - total_size="TODO!!!") + total_size=self._dtype.itemsize * reduce(lambda x, y: x*y, self._shape, 1)) return code