Last updated:
Profile GPU Workloads
GPU profiling shows which CUDA kernels use GPU time and which code launched them. It supports NVIDIA GPUs with CUDA workloads on Kubernetes.
The setup has two parts:
- Operator-managed Parca Agent: The same agent that collects CPU profiles also collects GPU data. On each node, it detects whether NVIDIA GPUs are attached and then starts collecting GPU metrics. It collects GPU profiles and NVTX ranges from every process that loads the injection library. See Collect with the Parca Agent.
- Injection library: The parcagpu library, which each GPU workload loads through CUDA. It exposes kernel activity and NVTX ranges to the agent.
The operator does not add the injection library to workloads yet. Until it does, add it to each GPU workload with the init container on this page.
Before you begin
- NVIDIA drivers: Your GPU nodes need the NVIDIA driver, for example from the NVIDIA GPU Operator.
- Workload images: Each GPU workload's image must be based on glibc and include
libcupti. See Limitations.
Configure the Dash0 operator
Enable the operator-managed Parca Agent, raise its memory limit, and let it, the collector, and the debuginfo proxy run on your GPU nodes. Add these values to your operator's Helm values:
operator:
ebpfProfilerEnabled: true
# Run the collector, the managed agent, and the debuginfo proxy on GPU nodes with the nvidia.com/gpu taint.
collectors:
daemonSetTolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
ebpfProfiler:
# GPU workloads need more memory than the 512Mi default.
containerResources:
limits:
memory: 2Gi
tolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
debuginfoProxy:
tolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoScheduleThe agent sends its data only to the collector on its own node, and uploads debuginfo only to the proxy on its own node. If your GPU nodes have taints, all three must tolerate them. Otherwise, Dash0 receives no data from those nodes.
Profiling GPU workloads uses more agent memory than profiling CPU workloads. With the default limit of 512Mi, the agent can be OOMKilled on nodes that run GPU training.
The agent's default tracer list includes cuda, which collects the GPU data. If you set spec.profiling.ebpfProfiler.tracers on the Dash0OperatorConfiguration yourself, keep cuda in the list. For the other settings of the agent, see the operator's configuration example.
Add the injection library to GPU workloads
Each GPU workload that you want to profile must load the parcagpu library. In the workload's pod template, add an init container that copies the library into a shared volume. Then point the CUDA and NVTX injection variables of the GPU container at the copy:
spec:
tolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
initContainers:
- name: lib-installer
image: ghcr.io/parca-dev/parcagpu:0.3.5
command: [sh, -c]
args:
- cp /usr/lib/libparcagpucupti.so /var/lib/parca/gpu/libparcagpucupti.so
volumeMounts:
- name: libparcagpu
mountPath: /var/lib/parca/gpu
containers:
- name: my-gpu-app
# Keep your image and command.
resources:
limits:
nvidia.com/gpu: 1
env:
- name: CUDA_INJECTION64_PATH
value: /var/lib/parca/gpu/libparcagpucupti.so
- name: NVTX_INJECTION64_PATH
value: /var/lib/parca/gpu/libparcagpucupti.so
volumeMounts:
- name: libparcagpu
mountPath: /var/lib/parca/gpu
readOnly: true
volumes:
- name: libparcagpu
emptyDir: {}CUDA_INJECTION64_PATH: CUDA loads the library when it initializes. The library then reports kernel launches and kernel execution times.NVTX_INJECTION64_PATH: Captures NVTX ranges. Set it in the pod spec, even though parcagpu sets it when CUDA initializes. Libraries such as PyTorch make their first NVTX call before that. An NVTX client that finds no injection library at its first call ignores NVTX for the rest of the process.
Limit traced kernel launches
The library records a limited number of kernel launches per second on each CPU thread. Launches over the limit do not appear in GPU Kernels profiles. Set these variables on the GPU container to change the limits:
| Variable | Default | Purpose |
|---|---|---|
PARCAGPU_RATE_LIMIT | 100 | Maximum kernel launches per second that each thread records. |
PARCAGPU_GRAPH_RATE_LIMIT | 20 | Maximum CUDA graph launches per second that each thread records. Graph launches use this limit instead of PARCAGPU_RATE_LIMIT, so graph replays and regular kernel launches do not crowd each other out. |
Both values must be greater than 0. The library ignores other values and uses the default. While PC sampling runs, the library records every launch, because it needs each launch to match GPU Instructions samples to CPU call stacks.
Collect GPU Instructions profiles
The library does not collect GPU PC samples by default. To collect GPU Instructions profiles, set these variables on the GPU container:
| Variable | Purpose |
|---|---|
PARCAGPU_PC_SAMPLING_RATE | Turns on PC sampling. The value is the target number of samples per second, and the library adjusts its sampling probability to approach it. 0 turns on sampling at a fixed probability, without rate control. |
PARCAGPU_SAMPLING_FACTOR | Hardware sampling period, as the base-2 logarithm of GPU cycles between samples. Defaults to 20. Takes effect only when PARCAGPU_PC_SAMPLING_RATE is set. |
PC sampling uses the GPU's performance counters. By default, the NVIDIA driver allows only processes with the CAP_SYS_ADMIN capability to use them. Add the capability to the GPU container:
containers:
- name: my-gpu-app
env:
- name: PARCAGPU_PC_SAMPLING_RATE
value: "100"
securityContext:
capabilities:
add: [SYS_ADMIN]Alternatively, load the NVIDIA kernel module on the node with NVreg_RestrictProfilingToAdminUsers=0, which lets all processes use the counters. Without either, the workload runs and GPU Kernels profiles still arrive, but no GPU Instructions profiles do. To print the CUPTI permission error in the workload's logs, set PARCAGPU_DEBUG=1 on the GPU container.
To show the source lines of your own CUDA kernels in GPU Instructions profiles, compile them with nvcc --generate-line-info (-lineinfo). Without line info, the profiles show the kernels but not their source lines.
View GPU data
Open Profiling under Telemetry and select a GPU type in Profile type. Dash0 opens a built-in view for the type:
- GPU Kernels: Opens the GPU kernels view, which shows kernel execution time.
- GPU Instructions: Opens the GPU instructions view, which shows GPU PC samples grouped by CUDA stall reason (
process.context.label.cuda_stall_reason).
Both views reverse the call-stack order, so the flame graph starts at the kernels. They apply the Hide CUDA internals and Hide Python internals presets. See Use preset filters. For the measurements behind each type, see Key Concepts.
The agent also sends:
- NVTX ranges: Arrive as spans. Find them in the Trace Explorer.
- GPU metrics: Utilization, power, temperature, clocks, PCIe throughput, and per-process GPU utilization. Find them in the Metric Explorer.
If no GPU data appears, check that the operator's eBPF profiler pods and collector pods run on your GPU nodes. Then check that the GPU container has both injection variables and that the init container completed.
Limitations
- NVIDIA CUDA only: The agent does not profile AMD or Intel GPUs.
- Manual injection: Add the init container and the injection variables to each GPU workload yourself. The operator does not inject them yet.
- glibc only: The library is built on Ubuntu 24.04. Images based on musl, such as Alpine, or on an older glibc may fail to load it.
- libcupti required: The library loads
libcuptifrom the workload's CUDA installation. PyTorch wheels and NVIDIA NGC images include it. Plain CUDA runtime images may not. - No Nsight Systems: Each injection variable holds one library. You cannot use parcagpu and Nsight Systems in the same process.
- GKE Autopilot: The operator-managed Parca Agent does not support GKE Autopilot yet.
Further Reading
- Collect and Send Profiles — Choose a profiler for CPU and memory profiles.
- Dash0 operator profiling — Configure the operator-managed Parca Agent.
- Filter and Group Profiles — Apply preset filters such as Hide CUDA internals.
- Key Concepts — Profile types and units, including the GPU types.
- Profiling Security — Profiler privileges and the data profiles contain.