Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix usage of intp->uintp in struct example
  • Loading branch information
inducer committed Mar 19, 2016
1 parent ffaac0c commit 9e08f58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/demo_struct.py
Expand Up @@ -7,7 +7,7 @@
from pycuda.compiler import SourceModule

class DoubleOpStruct:
mem_size = 8 + numpy.intp(0).nbytes
mem_size = 8 + numpy.uintp(0).nbytes
def __init__(self, array, struct_arr_ptr):
self.data = cuda.to_device(array)
self.shape, self.dtype = array.shape, array.dtype
Expand All @@ -20,7 +20,7 @@ def __init__(self, array, struct_arr_ptr):
cuda.memcpy_htod(int(struct_arr_ptr),
numpy.getbuffer(numpy.int32(array.size)))
cuda.memcpy_htod(int(struct_arr_ptr) + 8,
numpy.getbuffer(numpy.intp(int(self.data))))
numpy.getbuffer(numpy.uintp(int(self.data))))

def __str__(self):
return str(cuda.from_device(self.data, self.shape, self.dtype))
Expand Down Expand Up @@ -59,7 +59,7 @@ def __str__(self):
print(array1)
print(array2)

func(numpy.intp(do2_ptr), block=(32, 1, 1), grid=(1, 1))
func(numpy.uintp(do2_ptr), block=(32, 1, 1), grid=(1, 1))
print("doubled second only")
print(array1)
print(array2)
Expand Down

0 comments on commit 9e08f58

Please sign in to comment.