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

Fix texture uploading

parent 6c18a869
No related branches found
No related tags found
No related merge requests found
Pipeline #18920 failed
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment