Skip to content

[cuda-gdb] Add independent host and device thread sampling selection, improve docs - #95

Open
pramodk wants to merge 1 commit into
llnl:developfrom
pramodk:pramodk/stat-cuda-gdb-device-threads
Open

pramodk wants to merge 1 commit into
llnl:developfrom
pramodk:pramodk/stat-cuda-gdb-device-threads

Conversation

@pramodk

@pramodk pramodk commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Provide options to sample CUDA device stacks and host helper threads independently.
  • Use -W or --with-device-threads to collect full CUDA device stacks. The existing CUDA Quick mode requires selecting device-thread sampling.
  • Use --gdb-path in stat-cl or the Remote Connect CLI to select the debugger installed on the compute nodes.
  • Add detailed documentation for CUDA-GDB usage

Examples

Run these commands on the launcher host with a STAT build that supports GDB. Replace LAUNCHER_PID
with the PID of the running job's launcher. The commands collect one snapshot with source lines.
The first samples host stacks, the second adds full CUDA device stacks, and the third uses CUDA Quick.

# main host threads only
stat-cl -G -i -t 1 --gdb-path /usr/local/cuda/bin/cuda-gdb LAUNCHER_PID

# host side threads only
stat-cl -G -w -i -t 1 --gdb-path /usr/local/cuda/bin/cuda-gdb LAUNCHER_PID

# no host threads but CUDA device threads (--with-device-threads or -W)
stat-cl -G --with-device-threads -i -t 1 --gdb-path /usr/local/cuda/bin/cuda-gdb LAUNCHER_PID

# host threads plus CUDA device threads (--with-device-threads or -W)
stat-cl -G -w --with-device-threads -i -t 1 --gdb-path /usr/local/cuda/bin/cuda-gdb LAUNCHER_PID

Same works with Remote Connect sample-job command to collect device stacks:

stat-gui-remote-cli --remote-login user@login-host --remote-prefix /opt/stat \
  sample-job JOBID --scheduler slurm --backend gdb --with-device-threads \
  --gdb-path /usr/local/cuda/bin/cuda-gdb

Notes / Disclaimer

  • Tested on L4 GPU node with host-only, device, and CUDA modes.
  • A coding agent has been used to help with refactoring code, implementation, testing, and documentation.

@lee218llnl

lee218llnl commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

This looks good to me and works as advertised. The only issue I see is that it is leaving defunct processes:

80324 ? Z 0:00 [NvDebugAgent] <defunct>

However, this isn't a STAT issue, I see this with cuda-gdb by itself too. Here's the cuda-gdb version if you think this is something worth reporting:

bash-4.4$ cuda-gdb --version exec: /usr/tce/packages/cuda/cuda-13.1.1/bin/cuda-gdb-python3.12-tui --version NVIDIA (R) cuda-gdb 13.1 Portions Copyright (C) 2007-2025 NVIDIA Corporation Based on GNU gdb 14.2 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
The defunct processes go away when the application terminates. This isn't a blocker for this PR, so I will merge when you think it's ready.

@pramodk

pramodk commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

thanks for testing!

About the defunct processes: that's true! I have looked into this extensively including the recent improvements in driver for late attach functionality, etc.

I have marked this PR draft as I thought would be nice to first change CLI option improvements we discussed and then I will rebase this on the top. We can merge all other PRs before this and then I will mark this ready later.

- Keep one host stack per rank by default with GDB and let users select host helper and CUDA device threads independently.
- Add -W and --with-device-threads to collect CUDA device stacks in stat-cl and the Remote Connect CLI.
- Add --gdb-path to both CLIs so users can select the debugger executable installed on the compute nodes.
- Require device-thread sampling for the existing CUDA Quick mode across the CLI and GUI.
- Expose host and device thread selection in the GUI and document the workflow with a two-rank CUDA example.
@pramodk
pramodk force-pushed the pramodk/stat-cuda-gdb-device-threads branch from 722037c to 2643928 Compare December 5, 2026 00:46
@pramodk
pramodk marked this pull request as ready for review December 5, 2026 00:46
@pramodk

pramodk commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator Author

@lee218llnl : I am preparing stat-cl and stat-remote-cl unification PR and while reviewing, I felt it would be best to get this PR merged as youhave already reviewed/tested this.

Updating CLI are is easier than need of another full review. So feel free to merge this once CI passes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants