(fn)
| 181 | # in seconds. We use CUDA events and synchronization for the most accurate |
| 182 | # measurements. |
| 183 | def timed(fn): |
| 184 | start = torch.cuda.Event(enable_timing=True) |
| 185 | end = torch.cuda.Event(enable_timing=True) |
| 186 | start.record() |
| 187 | result = fn() |
| 188 | end.record() |
| 189 | torch.cuda.synchronize() |
| 190 | return result, start.elapsed_time(end) / 1000 |
| 191 | |
| 192 | |
| 193 | @torch.compile |
no test coverage detected