I am using NVIDIA CUDA Profiler Tools Interface (CUPTI) from CUDA Toolkit 4.1
I am trying to obtain stream ID inside a CUPTI callback function.
When I get a call back for CUPTI_CB_DOMAIN_RUNTIME_API domain with CUPTI_RUNTIME_TRACE_CBID_cudaLaunch_v3020 as the cbid, I want to know the stream that is launching the kernel.
I use the following piece of code to achieve this:
const cuLaunchKernel_params * p = (const cuLaunchKernel_params *) cbInfo->functionParams;
CUstream hStream = p->hStream;
uint32_t id;
cuptiGetStreamId(cbInfo->context,hStream,&id);
However, cuptiGetStreamId() crashes and on examination I observed that cbInfo->functionParams does not contain values that can be casted to (cuLaunchKernel_params *).
The CUPTI user manual for “CUpti_CallbackData::functionParams” does not give any clear information on how to use this field correctly.
Any information on this subject will be helpful.
Thanks
Milind
PS: ActivityAPI provides facility to know stream Id, but I don’t want to take that path.