Hey,

Just started working with PyCUDA, and already very taken with it, it makes a 
whole load of things very simple. Already after a couple of days I have a 
working program with OpenGL interop using PySide to provide the GUI and CUDA 
doing 3D texture lookups. One thing I haven’t been able to figure out yet 
though is how to pass vector arguments to CUDA kernels. I have a function 
definition like this:
__global__ void extract_slice(uchar4 *destPbo,
                                                          unsigned int width,
                                                          unsigned int height,
                                                          float3 center,
                                                          float3 xDelta,
                                                          float3 yDelta)
but I can’t make this work with pycuda passing in float3 variables like this:
self.kernel.prepared_call(grid_dimensions, (16, 16, 1),
                                                                  
target_mapping.device_ptr(),
                                                                  self.width(),
                                                                  self.height(),
                                                                  
pycuda.gpuarray.vec.make_float3(0.0, 0.0, 0.0),
                                                                  
pycuda.gpuarray.vec.make_float3(1.0, 0.0, 0.0),
                                                                  
pycuda.gpuarray.vec.make_float3(0.0, 1.0, 0.0)
                                                                  )
so instead I have had to resort to just passing in 9 floats instead of 3 float3 
variables, these are then reconstructed into float3s in the kernel and 
everything works correctly. While this is a solution for the moment I would 
really like to figure out how to pass vector types like this, and if anyone can 
point me in the right direction it would be much appreciated.

Thanks,

Ben
_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to