[PC Sampling API] When to call `cuptiPCSamplingGetNumStallReasons`?

Should it be called after cuptiPCSamplingEnable or it can be called before it?

I encountered problems by calling cuptiPCSamplingGetNumStallReasons before cuptiPCSamplingEnable. The return value of cuptiPCSamplingGetNumStallReasons shows no stall reasons if calling this way. It’s weird that such a problem didn’t appear before cuda 13.1 driver.

All the pc sampling APIs need to be called after cuptiPCSamplingEnable API as it create/initializes the internal PC sampling object for the CUDA context.

So cuptiPCSamplingGetNumStallReasons neeeds to be called after cuptiPCSamplingEnable API. You can refer to the pc_sampling_start_stop public sample for the API workflow.

We will check why this API was working fine in 13.1 package.

Thanks for the info. I was referring to CUDA versions before 13.1. Anyway I’ll fix this correspondingly to always call APIs after enabling PC sampling.