Question about CUPTI: sending parameter from start to end callback function

Hey Guys,

I am trying to add CUPTI callback function in my program. In the entry part of callback function, I wish I could assign an unique index to each cuda func call; at the exit part of callback function, I wish I could use the index to discern which cuda function call it belongs to.

I saw there is a data member of struct CUpti_CallbackData, (defined in cupti_callback.h). It is description is as following:

 * Pointer to data shared between the entry and exit callbacks of
 * a given runtime or drive API function invocation. This field
 * can be used to pass 64-bit values from the entry callback to
 * the corresponding exit callback.
 uint64_t *correlationData;

I’ve thought it can help, so I tried to assign the index to it, and I wish I could read and use this member at exit point. But it is read-only.

If you know how to share a data between entry/exit callback function, please help to teach me.

Thank you very much for reading this post.


I understand it now. This data member is read-only; it points to a place that I can save my parameter or pointer of my parameter struct.