I'm trying to synchronise my cuda routine by using cudaStreamAddCallback(), but I can't implement it, also because the documentation is not unambiguous. The cuda-C-programming-guide says that the callback has to be defined as:
void CUDART_CB MyCallback(void *data){}
and is talking about flags like the cudaStreamCallbackBlocking that needs to be set; while the Cuda_Toolhit_Reference_Manual and the cuda_runtime_api.h requiring an other implementation of the callback:
void CUDART_CB MyCallback (cudaStream_t stream, cudaError_t status, void *userData){}
and mentioning that the flag is for future use and require a 0 as argument. Furthermore, calling the function as follow:
cudaStreamAddCallback(GpuStream, MyCallback, &BufSwitchParams, 0);
and working using VS 2010 trying to compile for 64bit I'm getting the message: argument of type “ void(__stdcall CMyClass::*)(cudaStream_t stream, cudaError_t status, void *userData)” is incompatible with parameter of type "cudaStreamCallback_t".
Does someone has already implemented this function and would be able to help me out of my dilemma, while posting a snippet here?