We are using CUPTI PC Sampling in a PyTorch distributed training job on NVIDIA H200 GPUs. The injector runs inside the training process, but the sampling logic is intended to be a passive diagnostic component.
Configuration:
- CUDA 13.0
collection-mode = 1(continuous)- sampling period =
17 - data retrieval interval =
1000 ms - host-side record buffer capacity =
500 - multiple distributed processes and NCCL activity
cuptiPCSamplingGetData()is called only from a dedicated background thread- CUDA kernel-launch and module-load callbacks do not call any PC Sampling API
The process eventually crashes with a segmentation fault inside CUPTI:
__strlen_evex
__GI___strdup
cuptiPCSamplingGetData
GetPcSamplingDataFromCupti
PeriodicDrainThread
The crash happens inside the CUPTI call, before it returns an error code. The application does not receive CUPTI_ERROR_*; instead, the training process receives SIGSEGV.
Immediately before the crash, our diagnostics show that the input structure and output buffer are valid:
params_size = 32
data_size = 80
capacity = 500
total_samples = 977
total_pcs = 500
remainingNumPcs ≈ 55,000
hardware_buffer_full = 0
The returned PC records contain valid addresses and readable function names. In some runs, an LD_PRELOAD tracer shows that CUPTI calls strdup() with readable strings such as spin_kernel, load_kernel, and store_kernel. In other runs, no invalid caller-side pointer can be observed.
The large remainingNumPcs value indicates that the producer is generating data faster than the application retrieves it, but we do not know whether this is merely a backlog/stress condition or whether it can expose an internal CUPTI bug. A robust API would normally report overflow or an error rather than dereference an invalid pointer and crash the host process.
The crash often occurs near NCCL initialization or dynamic CUDA module activity. We would like to clarify:
- Is it supported to call
cuptiPCSamplingGetData()periodically from a background thread while CUDA kernels and NCCL/JIT modules are concurrently loading or unloading? - In continuous mode, must PC Sampling data be retrieved or synchronized at every module load/unload boundary?
- Can a large
remainingNumPcsvalue cause CUPTI internal metadata corruption or an unrecoverable condition? - Are there known CUDA 13.0/CUPTI 13 issues involving
cuptiPCSamplingGetData(),strdup(), or function-name resolution? - Is there a recommended buffer size or retrieval protocol for preventing this condition?
- Is there a supported way to use PC Sampling from an external process so that a CUPTI failure cannot terminate the training process?
We can provide the complete CUPTI initialization code, the exact CUpti_PCSamplingGetDataParams contents, and full per-process forensic logs if needed.