From 8568124d8ab57624f59f9b4ba48de9ebd433f8ec Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Sun, 19 Jan 2020 00:36:05 +0100
Subject: [PATCH] cuda.TextureReference.set_array(tex_ref, cu_array) ->
 tex_ref.set_array(cu_array)

I missed that this is actually a member function. Better call it
directly to make it also work with `cuda.SurfaceReference`.
---
 pystencils/gpucuda/texture_utils.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pystencils/gpucuda/texture_utils.py b/pystencils/gpucuda/texture_utils.py
index d29d86292..71021c258 100644
--- a/pystencils/gpucuda/texture_utils.py
+++ b/pystencils/gpucuda/texture_utils.py
@@ -9,6 +9,7 @@
 """
 
 from os.path import dirname, isdir, join
+from typing import Union
 
 import numpy as np
 
@@ -28,7 +29,7 @@ def pow_two_divider(n):
     return divider
 
 
-def ndarray_to_tex(tex_ref,
+def ndarray_to_tex(tex_ref,  # type: Union[cuda.TextureReference, cuda.SurfaceReference]
                    ndarray,
                    address_mode=None,
                    filter_mode=None,
@@ -48,7 +49,7 @@ def ndarray_to_tex(tex_ref,
         raise TypeError(
             'ndarray must be numpy.ndarray or pycuda.gpuarray.GPUArray')
 
-    cuda.TextureReference.set_array(tex_ref, cu_array)
+    tex_ref.set_array(cu_array)
 
     tex_ref.set_address_mode(0, address_mode)
     if ndarray.ndim >= 2:
-- 
GitLab