curobo.profiling module¶
Profiling utilities for cuRobo.
Lightweight timing helpers for measuring GPU work. Timer behavior is gated by
curobo.runtime.cuda_event_timers; when disabled, timers are no-ops and return
0.0 with minimal overhead.
Example
from curobo.profiling import CudaEventTimer
timer = CudaEventTimer().start()
# ... GPU work ...
elapsed_seconds = timer.stop()
- class CudaEventTimer¶
Bases:
objectLightweight CUDA event-based timer for accurate GPU timing.
Uses CUDA events instead of CPU time + synchronize for more accurate GPU timing without blocking the entire device.
Example
>>> timer = CudaEventTimer().start() >>> # ... GPU work ... >>> elapsed_seconds = timer.stop()
The timer respects runtime.cuda_event_timers. When disabled, stop() returns 0.0 with minimal overhead.
Initialize the timer.
- __init__()¶
Initialize the timer.
- start(stream=None)¶
Start the timer by recording a CUDA event.
- Parameters:
stream (torch.cuda.streams.Stream | None) – Optional CUDA stream on which to record the event.
- Returns:
Self for method chaining.
- Return type:
- checkpoint(
- name,
- stream=None,
Record a named, non-synchronizing interval boundary.
The elapsed interval ends at this checkpoint and starts at the previous checkpoint (or
start). Reusing a name accumulates repeated intervals, which is useful for iterative algorithms. Values become available throughintervalsafterstop.- Parameters:
name (str) – Stable name for the interval ending at this checkpoint.
stream (torch.cuda.streams.Stream | None) – Optional CUDA stream on which to record the event.
- Returns:
Self for method chaining.
- Return type:
- stop(
- final_interval=None,
- stream=None,
Stop the timer and return elapsed time in seconds.
This synchronizes only on the end event, not the entire device.
- Parameters:
final_interval (str | None) – Optional name for the interval from the last checkpoint (or start) through the stop event.
stream (torch.cuda.streams.Stream | None) – Optional CUDA stream on which to record the event.
- Returns:
Elapsed time in seconds, or 0.0 if timing is disabled.
- Return type: