external calls to __device__ functions

Hi!

in cuPrintf.cuh I find the following

///////////////////////////////////////////////////////////////////////////////

// DEVICE SIDE

// External function definitions for device-side code

// Abuse of templates to simulate varargs

__device__ int cuPrintf(const char *fmt);

However when I try to declare a device fuction in a header and put the implementation into some .cu file which I do not include I get the rror message

Error: External calls are not supported (found non-inlined call to _Z17asinf_tablelookupf)

Inlining the code works fine.

Now what? This restriction is mentioned nowhere in combination with device functions.

What am I missing?

regards Rolf

CUDA does not have a linker on the device side, so you cannot call device functions in a different .cu file (as you’ve just found out).

@tera: 1) Where in the documentation does it say that there is no linker on the device side?

         2) I use cuPrintf, but I only need to include cuPrintf.cu in the routine that calls the kernel!

MMB

It’s quite hidden in Appendix E.1 of the Programming Guide:

The same statement for variables is slightly easier to find in Appendix B.2.5 “Restrictions”:

Ok, I figured out myself that external calls do not work.

Still I would like to quote from the cuPrintf Readme (in addition to the code snippet comments you find in my original post):

Following the answers I got, option (a) is impossible ?!

It’s hard to believe, why should it be in the readme?

Or is it a matter of operating system (I have LINUX)?