def __enter__(self): if not self.enabled: return if self.entered: raise RuntimeError( "ITT annotation context manager is not reentrant") self.entered = True _enable_profiler( ProfilerConfig(ProfilerState.ITT, self.record_shapes, False, False, False, False, _ExperimentalConfig()), set()) return self
def __enter__(self): if not self.enabled: return if self.entered: raise RuntimeError( "NVTX annotation context manager is not reentrant") self.entered = True torch.cuda.synchronize() _enable_profiler( ProfilerConfig(ProfilerState.NVTX, self.record_shapes, False, False, False, False), set()) return self
def _start_trace(self): self.entered = True _enable_profiler(self.config(), self.kineto_activities)