Benedikt Kopp
2017-06-19 16:16:30 UTC
Dear all,
I'm having a few problems with pycuda in combination with Ubuntu 16.04 and
cuda 8.0.
I've tried to make a minimal working error-example that I run on both
Windows and Linux:
*import numpy as np*
*import pycuda.autoinit*
*import pycuda.driver as cuda*
*from pycuda.compiler import SourceModule*
*def main():*
* test_array = np.arange(0,20,1).astype(np.float32)*
* mod = SourceModule("""*
* __global__ void addtwo(float *input){*
* int n = threadIdx.x;*
* input[n] = input[n]+2;*
* }*
* """)*
* addtwo = mod.get_function('addtwo')*
* addtwo(cuda.InOut(test_array),grid=(1,1),block=(np.int32(20),1,1))*
*if __name__ == '__main__':* *main()*
*which on linux gives me the following error*
*ArgumentError Traceback (most recent call
last)*
*<ipython-input-2-58ca95c5b364> in <module>()*
*----> 1 main()*
*<ipython-input-1-812e11d7dfa9> in main()*
* 17 *
* 18 addtwo = mod.get_function('addtwo')*
*---> 19
addtwo(cuda.InOut(test_array),grid=(1,1),block=(np.int32(20),1,1))*
*/usr/lib/python2.7/dist-packages/pycuda/driver.pyc in function_call(func,
*args, **kwargs)*
* 380 raise ValueError("must specify block size")*
* 381 *
*--> 382 func._set_block_shape(*block)*
* 383 handlers, arg_buf = _build_arg_buf(args)*
* 384 *
*ArgumentError: Python argument types in*
* Function._set_block_shape(Function, numpy.int32, int, int)*
*did not match C++ signature:*
* _set_block_shape(pycuda::function {lvalue}, int, int, int)*
whereas, when I run it on Windows, it runs just fine.
Also, for both systems, when I change the block size to block=(20,1,1), it
runs completely fine.
My question now is:
Is this a bug?
Are there more differences between Windows and Linux that I have to look
out for?
Is it even possible to write pycuda code that is interchangeable between
windows and linux?
I've been working on this error for more than a week now and I would very
much appreciate your help!
Best regards,
Ben
PS: I've tried to look up the archive for this mailing list, but I can't
reach http://news.gmane.org/gmane.comp.python.cuda
I'm having a few problems with pycuda in combination with Ubuntu 16.04 and
cuda 8.0.
I've tried to make a minimal working error-example that I run on both
Windows and Linux:
*import numpy as np*
*import pycuda.autoinit*
*import pycuda.driver as cuda*
*from pycuda.compiler import SourceModule*
*def main():*
* test_array = np.arange(0,20,1).astype(np.float32)*
* mod = SourceModule("""*
* __global__ void addtwo(float *input){*
* int n = threadIdx.x;*
* input[n] = input[n]+2;*
* }*
* """)*
* addtwo = mod.get_function('addtwo')*
* addtwo(cuda.InOut(test_array),grid=(1,1),block=(np.int32(20),1,1))*
*if __name__ == '__main__':* *main()*
*which on linux gives me the following error*
*ArgumentError Traceback (most recent call
last)*
*<ipython-input-2-58ca95c5b364> in <module>()*
*----> 1 main()*
*<ipython-input-1-812e11d7dfa9> in main()*
* 17 *
* 18 addtwo = mod.get_function('addtwo')*
*---> 19
addtwo(cuda.InOut(test_array),grid=(1,1),block=(np.int32(20),1,1))*
*/usr/lib/python2.7/dist-packages/pycuda/driver.pyc in function_call(func,
*args, **kwargs)*
* 380 raise ValueError("must specify block size")*
* 381 *
*--> 382 func._set_block_shape(*block)*
* 383 handlers, arg_buf = _build_arg_buf(args)*
* 384 *
*ArgumentError: Python argument types in*
* Function._set_block_shape(Function, numpy.int32, int, int)*
*did not match C++ signature:*
* _set_block_shape(pycuda::function {lvalue}, int, int, int)*
whereas, when I run it on Windows, it runs just fine.
Also, for both systems, when I change the block size to block=(20,1,1), it
runs completely fine.
My question now is:
Is this a bug?
Are there more differences between Windows and Linux that I have to look
out for?
Is it even possible to write pycuda code that is interchangeable between
windows and linux?
I've been working on this error for more than a week now and I would very
much appreciate your help!
Best regards,
Ben
PS: I've tried to look up the archive for this mailing list, but I can't
reach http://news.gmane.org/gmane.comp.python.cuda