Question about CUPTI parameter from target CUDA code

I want to getting CUPTI parameters from CUDA kernel for comparing Nsys output, because I am setting various parameters to same CUDA kernel.
Nsys CUPTI parameters outputs are CorrelationID, Graph Node ID, Stream etc.
Is there any method to getting those same parameters from CUDA kernel source code?

Reference

@liuyis can you respond to this?

Hi @sakaia ,

Is there any method to getting those same parameters from CUDA kernel source code?

Do you mean you want to get information like CorrelationID, Graph Node ID, Stream etc but from CUDA kernel codes instead of through Nsys/CUPTI?

I’m not sure that’s possible. The information is captured through some internal mechanisms and is not publicly available.

If that’s not what you meant, please share a more specific example regarding what information would you like to collect.

Thank you for your comments.
I want to get these information in both sides (Nsys and CUDA kernel code) for mapping cuda kernel behaviour.
Is it available?

Unfortunately not. These information can only be collected through NVIDIA tools like Nsys, CUPTI.

One alternative way to map CUDA kernel with profiling results is to wrap the CUDA kernel launch call with NVTX ranges, and you will see the NVTX ranges on Nsys timeline, provided that you’ve enabled --trace=cuda,nvtx. Please check GitHub - NVIDIA/NVTX: The NVIDIA® Tools Extension SDK (NVTX) is a C-based Application Programming Interface (API) for annotating events, code ranges, and resources in your applications. for more details regarding NVTX.

One option would be to use CUpti_ActivityKernel9::gridId and access the gridId from the kernel using the ptx special register %gridid. I do not know if there is a CUDA intrinsic for gridid. You may have to use inline PTX. I also do not know gridid’s behavior for CUDA graph nodes. GridId has historically been used by tools for CDP trace and by the debugger akin to correlationId. gridid is owned by the driver. correlationId is owned by CUPTI.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.