I've been working with the tutorial on using pycuda for doubling an array. As a project, I attempted to modify the code so that the size of the array can be variable, mostly for the purpose of importing images.  The functions have been modified as follows:

mod = cuda.SourceModule("""
  __global__ void doublify(float *a, int rows)
    int idx = threadIdx.x + threadIdx.y*rows;
    a[idx] += 2;
func = (a_gpu, r_gpu, block=(4,4,1))

The idea is to pass an additional int variable into the function. However, when I run the code I get an error telling me of an invalid type parameter, as follows:

Traceback (most recent call last):
  File "img_double_c.py", line 39, in <module>
    func(a_gpu, r_gpu,  block=(5,5,1))
  File "/usr/local/lib64/python2.5/site-packages/pycuda-0.91-py2.5-linux-x86_64.egg/pycuda/driver.py", line 108, in function_call
    handlers = func.param_set(*args)
  File "/usr/local/lib64/python2.5/site-packages/pycuda-0.91-py2.5-linux-x86_64.egg/pycuda/driver.py", line 78, in function_param_set
    raise TypeError("invalid type on parameter #%d (0-based)" % i)
TypeError: invalid type on parameter #1 (0-based)

Reading more of the documentation showed that only certain datatypes may be passed into the module, none of which are of int type. Is there something I'm missing here?  If not, is there a way to pass variables (i.e. image width and image height) into a SourceModule?

Brad Zima