Skip to content

[Example] Add a simple NVML example#1783

Open
mdboom wants to merge 4 commits intoNVIDIA:mainfrom
mdboom:nvml-example
Open

[Example] Add a simple NVML example#1783
mdboom wants to merge 4 commits intoNVIDIA:mainfrom
mdboom:nvml-example

Conversation

@mdboom
Copy link
Contributor

@mdboom mdboom commented Mar 17, 2026

This is one example as part of #1681

@mdboom mdboom requested a review from cpcloud March 17, 2026 20:22
@mdboom mdboom added cuda.bindings Everything related to the cuda.bindings module example Improvements or additions to code examples labels Mar 17, 2026
@mdboom mdboom self-assigned this Mar 17, 2026
@github-actions
Copy link

Copy link
Contributor

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

return f"{bytes_val / (1024 * 1024):.0f}MiB"


LINES = [[[4, 27, 6], [18, 3], [20]], [[4, 6, 13, 13], [22], [9, 10]]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just dump out a TSV, PSV, or CSV and pipe to column -t instead of devoting 40+ lines to a table formatter that's irrelevant for NVML APIs?

Not gonna block, but I do feel like this hides the actual useful bits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, a little bit. It started as an exercise to replicate nvidia-smi (which I thought many CUDA programmers might already be familiar with) in Python. But I agree it's a bit ridiculous.

@mdboom mdboom enabled auto-merge (squash) March 17, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module example Improvements or additions to code examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants