On Mon, 1 Aug 2011 15:53:10 -0400, Benjamin Horstman <yode...@gmail.com> wrote: Non-text part: multipart/mixed Non-text part: multipart/alternative > 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.
CL is an entirely different matter--you can query for the number of arguments in a kernel, so it's actually quite easy to do this. But thanks for the pointers. Andreas
pgpaiQZrp3M17.pgp
Description: PGP signature
_______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda