Replies: 1 comment
|
Short answer: not directly via nvbench itself, but yes—you can collect SM Active and SM Occupancy programmatically, just not through a simple “nvbench API switch” in the way you’re describing. nvbench is a benchmark runner, not a full profiling/telemetry framework like Nsight Systems or CUPTI. 1. Why nvbench can’t do this directlyMetrics like:
come from hardware performance counters, and those are exposed via:
nvbench does not:
It only measures:
2. What you actually want (system-wide SM metrics)What you're describing (“like nsys, not per-kernel”) maps to: ✔ Nsight Systems (nsys)
You can run it programmatically like: nsys profile \
--stats=true \
--output=my_profile \
./your_appor from code via subprocess: system("nsys profile --stats=true ./your_app");3. Programmatic access (CUPTI route)If you truly want to integrate inside your code (no external tool), then: You need CUPTI:CUPTI exposes:
You can:
cuptiSetEventCollectionMode(...)
cuptiMetricGetValue(...)
But: 👉 This is low-level, complex, and intrusive compared to nvbench. 4. Hybrid approach (most practical)Since you said:
The standard production approach is: Option A (recommended)Run nvbench normally + wrap with Nsight Systems: nsys profile --metrics=smsp__cycles_active.avg.pct_of_peak_sustained_active ./benchThen parse:
Option BUse nvbench for workload generation + CUPTI for telemetry
5. Important limitationSM Occupancy is:
It is derived from:
So:
Final answer
If you want, I can show:
If this answer helped or pointed you in the right direction, I'd appreciate it if you could mark it as the accepted answer so it's easier for others with the same issue to find. Also, if you found my contribution useful, I'd appreciate it if you could check out my GitHub profile, follow me, and star any repositories you find interesting. GitHub: https://github.com/Advait251206 |
Uh oh!
There was an error while loading. Please reload this page.
I want to get sm active and sm occupancy in my code , like run a dependent process and collect these metrics and export metrics value.
so is there any way I can do that programatically?
I do not want to collect metrics for a single kernel or some kernels? just collect metrics like nsys
All reactions