(fn)
| 157 | # in seconds. We use CUDA events and synchronization for the most accurate |
| 158 | # measurements. |
| 159 | def timed(fn): |
| 160 | start = torch.cuda.Event(enable_timing=True) |
| 161 | end = torch.cuda.Event(enable_timing=True) |
| 162 | start.record() |
| 163 | result = fn() |
| 164 | end.record() |
| 165 | torch.cuda.synchronize() |
| 166 | return result, start.elapsed_time(end) / 1000 |
| 167 | |
| 168 | |
| 169 | inp = torch.randn(4096, 4096).cuda() |
no test coverage detected