| 74 | pass |
| 75 | |
| 76 | def stop_and_wait(self, stream=None): |
| 77 | if not stream: |
| 78 | stream = cuda.CUstream(0) |
| 79 | |
| 80 | self.stop(stream) |
| 81 | if stream: |
| 82 | (err,) = cuda.cuStreamSynchronize(stream) |
| 83 | if err != cuda.CUresult.CUDA_SUCCESS: |
| 84 | raise RuntimeError(f"CUDA Error {str(err)}") |
| 85 | else: |
| 86 | (err,) = cudart.cudaDeviceSynchronize() |
| 87 | if err != cuda.CUresult.CUDA_SUCCESS: |
| 88 | raise RuntimeError(f"CUDA Error {str(err)}") |
| 89 | |
| 90 | def duration(self, iterations=1): |
| 91 | err, duration = cuda.cuEventElapsedTime(self.events[0], self.events[1]) |