Dynamic code generation with CUDA


I would like to know if CUDA support dynamic code generation. My application currently generate some code as a “text” buffer.
Once done I would like to generate my CUDA from this code and then execute it.

Can you tell me if it is possible ?


It is possible, but not supported at the API level. You essentially have to launch NVCC as a process, compile into a library, then dynamically load the library.

See http://code.google.com/p/copperhead/ for an example of a relatively mature project that does this.

PyCUDA provides exactly this sort of dynamic code generation and metaprogramming via a straightforward, pythonic interface.