Understanding CUDA

Hi,

I.ve been going through the CUDA Toolkit documentation and came across this in the CUDA video decoder section:

// Called by the video parser to decode a single picture. Since the parser will // deliver data as fast as it can, we need to make sure that the picture index // we're attempting to use for decode is no longer used for display.
static int CUDAAPI HandlePictureDecode(void *pUserData, CUVIDPICPARAMS *pPicParams);

I’m just wondering, in the above code, what is CUDAAPI? i.e. is it a typename or a macro etc. I’m struggling to find references to it anywhere else.

Thanks in advance.

Anyone able to help?

CUDAAPI represents the calling convention. Some operating system platforms, notably Windows, offer multiple calling conventions. My memory is a bit hazy, but I think on Windows CUDAAPI resolves to __stdcall, which is stack-based. You could search the CUDA header files to confirm if you have a need to know this detail. Presumably there is an OS-specific #define for CUDAAPI somewhere in the header files.

A small bit of grep-ing on the CUDA header files (in /usr/local/cuda/include on linxu) will show you that CUDAAPI is defined in cuda.h:

#ifdef _WIN32
#define CUDAAPI __stdcall
#else
#define CUDAAPI
#endif

So now your question becomes “what is the meaning of __stdcall” as a function qualifier on the windows platform ?

And that is not a CUDA specific question.

http://stackoverflow.com/questions/297654/what-is-stdcall
https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx

Great, thanks very much!