Hi-

Is there a way to get a list of the global variables, especially
constant arrays and texture refs that are defined in a kernel?

I'm generating a pycuda.driver.Module from a template, and the storage
of various kernel inputs depends on the template parameters.

It would be convenient for code using a kernel generated this way to
have some way of figuring out what global variables are defined in the
kernel, and whether they are globals, constants, or texrefs.

Maybe in a future version of pycuda it would be nice to replace (or
provide an alternative to) the accessor functions:

pycuda.driver.Module.get_global
pycuda.driver.Module.get_function
pycuda.driver.Module.get_texref

that consists of having member variables:

pycuda.driver.Module.globals
pycuda.driver.Module.functions
pycuda.driver.Module.constants
pycuda.driver.Module.texrefs

that are already initialized to dictionaries with the name of the
variable as the key, and the handle  (or maybe a (handle, size) tuple)
as the value.

or maybe have a single member variable pycuda.driver.Module.globals
that is a dictionary with variable names as keys, and a (type, handle,
size) tuple or something similar.

If I at least have the name of the variable I think I can deduce if
the variable is defined as a __constant__ array  by wrapping
pycuda.driver.Module.get_global in a try: statement, but that's rather
un-pythonic

Or perhaps I'm misunderstanding something and the Module.get_*
functions are forced on us by the CUDA  API?

Cheers,
Drew

_______________________________________________
PyCUDA mailing list
[email protected]
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to