Hi, Here is a small diff to allow int8 to work correctly.
In file pycuda/tools.py in the function dtype_to_ctype, it use "signed char" for numpy.int8, but the function parse_c_arg don't understand it. We can change dtype_to_ctype to return just "char", but that would be inconsistent with what is done for othe dtype. Here is a patch that make parse_c_arg understand "signed char" diff --git a/pycuda/tools.py b/pycuda/tools.py index f16cc60..3ce4648 100644 --- a/pycuda/tools.py +++ b/pycuda/tools.py @@ -473,7 +473,7 @@ def parse_c_arg(c_arg): dtype = np.uint32 elif tp in ["short", "short int"]: dtype = np.int16 elif tp in ["unsigned short", "unsigned short int"]: dtype = np.uint16 - elif tp in ["char"]: dtype = np.int8 + elif tp in ["char", "signed char"]: dtype = np.int8 elif tp in ["unsigned char"]: dtype = np.uint8 elif tp in ["bool"]: dtype = np.bool else: Here is code that trigger the problem: import numpy import pycuda.autoinit import pycuda.gpuarray data = numpy.asarray(numpy.random.rand(5,5)*50, dtype='int8') data_gpu = pycuda.gpuarray.to_gpu(data) data_gpu*2 thanks Frédéric Bastien _______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda