Ahmed Fasih <[email protected]> writes:

> Hi, I am looking at the PyCUDA example for C++ templated kernel calls
> [1], but I have the __global__ kernel function with a template, i.e.,
>
> template <class T> __global__ void cuda_kernel(...)
>
> From C++, this is invoked via, e.g.,
>
> cuda_kernel<float><<< grid, threads >>>(...)
>
> I admit that the theory and PyCUDA practice of name mangling is fuzzy in
> my head, so you'll forgive me if I am doing something laughable, but I
> tried, in Python,
>
> module = SourceModule(custring, no_extern_c=1)
> cuda_kernel  = module.get_function("cuda_kernel")
>
> where "custring" contains the CUDA kernel code, and PyCUDA spits out an
> error,
>
> LogicError: cuModuleGetFunction failed: not found
>
> How can I get my host-callable C++-template kernel functions into
> PyCUDA, aside from the simple-minded workaround of untemplating
> everything?

Solution I'd prefer: Keep your templates, but make 'extern "C"' wrappers
with well-defined names for those template kernel that you actually want
to call.

Otherwise, you'll need one of these:

http://stackoverflow.com/questions/6526500/c-name-mangling-library-for-python

Andreas

_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to