Cupti default stream id 7 instead of 0?

In my experiments, I see that default stream id for a cupti activity is 7.
Is this always true? Also what is the reason behind it not being 0?

Thank you.

Hi Sujan,

There is no guarantee that default stream id will remain 7 for all CUDA driver versions. It can change from one driver version to another, and we shouldn’t rely on the fixed id. CUPTI API cuptiGetStreamIdEx() can be used to query the id for the default stream.

Hi mjain,

I had another question about cuptiGetStreamIdEx().
I tried this and I get CUPTI_ERROR_INVALID_STREAM error.
uint32_t streamId;
cuptiGetStreamIdEx(nullptr, CU_STREAM_LEGACY, 0, &streamId);

I’d really appreciate your help.

Hi Sujan,

CU_STREAM_LEGACY is the legacy default stream. We can query the ID for this stream only if we pass a valid context.