On Mon, Jun 6, 2011 at 2:16 PM, Irwin Zaid <irwin.zaid(a)physics.ox.ac.uk> wrote:
Anyway, I was wondering if there is a better way to provide this
functionality? In normal CUDA code, this could be done with templates, but
that doesn't seem to be an option here. I know metaprogramming is a
solution, but I'd like to avoid that as it seems like an unnecessarily large
solution to a tiny problem. (And I don't want to require additional
dependencies like jinja2, mako, etc...)
Am I simply stuck maintaining two kernels that are nearly identical?
I do not really see why are you calling metaprogramming a "large
solution". Basically it is the same as using printf() to construct
printed string in runtime. If you do not want to require third-party
templating packages, you can just use Python's format() function ---
it seems that it will be enough for your purposes.