def _preprocess(self): if self.xp == numpy: self.start = time.time() else: self.start = cuda.Event() self.stop = cuda.Event() self.start.record()
def _preprocess(self): if self.xp == numpy: start = time.time() self._running_stack.append(start) else: start = cuda.Event() stop = cuda.Event() start.record() self._running_stack.append((start, stop)) self._depth += 1
def start(self): if self.running: return if self.synchronized: raise RuntimeError('This timer is already synchronized. ' 'Please reset the timer first.') start = cuda.Event() stop = cuda.Event() start.record() if self._need_synchronization_before_measurement(): start.synchronize() self.start_events.append(start) self.stop_events.append(stop) self.running = True
def _init(self): if not self.initted: self.start_gpu = cuda.Event() self.stop_gpu = cuda.Event() self.initted = True