[driver api][ptx]: cuModuleGetFunction fails with CUDA_ERROR_NOT_FOUND ... but cuModuleGetGlobal wor

Hi!

I have a PTX file that’s successfully loaded by cuModuleLoad(). If I run cuModuleGetFunction() on that module with an existing kernel name, I get CUDA_ERROR_NOT_FOUND. However, if I run cuModuleGetGlobal() on the very same loaded module, it works like a charm. How’s that possible? Both symbols (the kernel and the global memory variable) can be found in the PTX file, so why does cuModuleGetFunction() fail? FYI, I use the “pure” kernel name as a string literal during lookup, not the mangled version found in the PTX. Using CUDA 3.1 on 64-bit Linux.

Any idea?

Thanks in advance!

I think you should trj using mangled name (at least that works for me )

Sergey.

I think you should trj using mangled name (at least that works for me )

Sergey.

That does work indeed! I consider this a bug as it’s neither documented that way nor does it seem sensible to me…

Cheers

That does work indeed! I consider this a bug as it’s neither documented that way nor does it seem sensible to me…

Cheers

CUDA files are compiled as C++, so unless functions are declared as extern “C” they have mangled names.

CUDA files are compiled as C++, so unless functions are declared as extern “C” they have mangled names.

In that case, they indeed get mangled names. Is the fact documented that they’re compiled as C++? If not, it should probably be added to the driver API section on kernel execution. Anyhow, I declared my kernels as extern “C” and now the function lookup works as expected.

Thanks Tim!

In that case, they indeed get mangled names. Is the fact documented that they’re compiled as C++? If not, it should probably be added to the driver API section on kernel execution. Anyhow, I declared my kernels as extern “C” and now the function lookup works as expected.

Thanks Tim!