(self)
| 592 | self._loop_finally() |
| 593 | |
| 594 | def close(self): |
| 595 | if self.executor.device_type == 'cuda': |
| 596 | # https://discuss.pytorch.org/t/how-to-delete-a-tensor-in-gpu-to-free-up-memory/48879/32 |
| 597 | # W/O this, repeatedly rebuilding and destroying engines within the same process |
| 598 | # will cause more and more reserved CUDA memory. |
| 599 | torch._C._cuda_clearCublasWorkspaces() |
| 600 | if self._loop_main is not None: |
| 601 | self._loop_main.cancel() |
| 602 | else: |
| 603 | self._loop_finally() |
| 604 | |
| 605 | def start(self): |
| 606 | """Start engine loop tasks.""" |
no test coverage detected