def get_cycles_per_ms():
 global _cycles_per_ms
 if (_cycles_per_ms is None):
  start = torch.cuda.Event(enable_timing=True)
  end = torch.cuda.Event(enable_timing=True)
  start.record()
  torch.cuda._sleep(1000000)
  end.record()
  end.synchronize()
  _cycles_per_ms = (1000000 / start.elapsed_time(end))
 return _cycles_per_ms

def get_cycles_per_ms ( ) : global _cycles_per_ms if ( _cycles_per_ms is None ) : start = torch . cuda . Event ( enable_timing = True ) end = torch . cuda . Event ( enable_timing = True ) start . record ( ) torch . cuda . _sleep ( 1000000 ) end . record ( ) end . synchronize ( ) _cycles_per_ms = ( 1000000 / start . elapsed_time ( end ) ) return _cycles_per_ms
approximate number of cycles per millisecond for torch .