problem of openacc compiled shared lib on linux

I compiled an openacc source code as a shared lib (.so file)on linux.
But when the main function call a function in this shared lib, this kind of problem happened:call to cuModuleGetFunction returned error 500: Not found.
Does anyone knows why this problem happen?

Hi ye37920,

When putting OpenACC into shared libraries (.so or .dll), you need to compile the library objects without RDC enabled (i.e. -ta=tesla:nordc). RDC requires the use of a device object linker which isn’t available when using shared libraries (or static libraries when not linking with PGI compilers).

The caveat is that you wont be able to perform device side routine calls (i.e. OpenACC “routine” directive) or access static global or module data (“declare create” directives).

Hope this helps,