Skip to content

Add CUPTI Timer - #488

Open
fbusato wants to merge 11 commits into
mainfrom
cupti-timer
Open

fbusato wants to merge 11 commits into
mainfrom
cupti-timer

Conversation

@fbusato

@fbusato fbusato commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Fixes #184

The PR adds CUPTI Activity API to measure GPU active time instead of CUDA events.
CUPTI timing can be enable with the optional command line option --cupti-timer.

The main advantage of CUPTI is that it measures the actual GPU active time, excluding noise, such as kernel launch latency and host activities (e.g. cuda driver). This also makes the measurements independent from the CPU speed or driver version.

Other advantages are:

  • 0.5us granularity
  • No blocking kernel: a more realistic measurement of the CPU time.
  • Consistency with Nvidia profiling tools.
  • Functionalities that run on different streams concurrently are correctly measured (not double-counted).

Example

nvbench.example.cpp17.throughput on an RTX A6000:

Mode CPU Time GPU Time Batch GPU BW Util
CUDA events 259.6 µs 240.4 µs 239.1 µs 72.68%
--cupti-timer 254.8 µs 238.7 µs 238.8 µs 73.20%

@fbusato fbusato self-assigned this Oct 9, 2026
Comment thread nvbench/detail/gpu_timer.cuh Outdated
Comment thread nvbench/cupti_timer.cxx Outdated
Comment thread nvbench/cupti_timer.cxx Outdated
@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator

Several general points:

  • The busy GPU time accounting may change computed throughput significantly. We still divide element and byte counts by GPU time. With CUPTI, these become rates per second of GPU activity. They can remain high even when long gaps between activities make application throughput poor.

    The NVBench printers (particularly, json_printer) do not reflect which timer was used making it difficult to automatically compare against event-based benchmarking result.

  • Python package is presently build with NVBench_ENABLE_CUPTI=OFF because of a longstanding and gaining opinion that use of CUPTI is to be phased out.

@fbusato

fbusato commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator Author

The NVBench printers (particularly, json_printer) do not reflect which timer was used making it difficult to automatically compare against event-based benchmarking result.

I definitely agree. We cannot compare two different methodology. I introduced the comparison script version and annotated the json with the timing methodology. If script versions are not compatible or timing methods are different, it raises an error.

Also, I tried to organize each fix in a separate commit to help for the review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable CUPTI to measure kernel execution time instead of CUDA Events

2 participants