This is hard, since PyCUDA doesn't (and shouldn't) attempt to parse the
kernel source code. But that's the only way to find out what the number
of arguments should be. Therefore, the CUDA libraries are the only spot
where it's sensible to do that reporting, and they actually can't,
either, since they treat the arguments passed to the function as a
binary blob.

You may want to talk to Oliver Chafik (JavaCL's author), as it manages to
catch this type of error somehow:

com.nativelibs4java.opencl.CLException$InvalidArgIndex: InvalidArgIndex
(kernel name = testDummy, num args = 0, arg index = 0, source = <<<
    __kernel void testDummy() {
    }

It might just be using the JavaCL generator underneath though, which does
the crazy parsing exactly as you suggested (see
http://code.google.com/p/javacl/wiki/JavaCLGenerator#Generated_code ).  It
would be possible to write an equivalent for python, but I'm not sure if
there's enough benefit in a runtime type-checked language.

-- 
Benjamin P. Horstman
Delta Upsilon International Fraternity
CWRU EECS BS/MS 2010
_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to