warning: extern declaration of the entity XXXX is treated as a static definition

Hi there,

We have been developing a CUDA code generator for a number of years and I am in the process of refactoring it to use separate compilation and linking in the generated code. This is working well aside from one issue. In order to automatically optimize block sizes, we initially build the generated code once using nvcc -cubin and analyze our kernels using cuModuleLoad, cuModuleGetFunction and cuFuncGetAttribute. This still works but we get “warning: extern declaration of the entity XXXX is treated as a static definition” for every extern device variable in our generated code. It totally makes sense that extern device variables generate a warning in this situation, but is there a way to suppress these warnings?

Thanks

Jamie

Jamie, have you included -rdc=true in your nvcc calls? I encountered the same error when I’d forgotten to enable relocatable device code (rdc).