(self,
config,
batch_size,
start_step=2,
steps_per_output=None,
monitor_memory=False,
logging_fn=None,
sync_current_stream=False)
| 206 | class ThroughputTimer: |
| 207 | |
| 208 | def __init__(self, |
| 209 | config, |
| 210 | batch_size, |
| 211 | start_step=2, |
| 212 | steps_per_output=None, |
| 213 | monitor_memory=False, |
| 214 | logging_fn=None, |
| 215 | sync_current_stream=False): |
| 216 | from deepspeed.utils import logger |
| 217 | self.config = config |
| 218 | self.start_time = 0 |
| 219 | self.end_time = 0 |
| 220 | self.started = False |
| 221 | self.batch_size = 1 if batch_size is None else batch_size |
| 222 | self.start_step = start_step |
| 223 | self.epoch_count = 0 |
| 224 | self.micro_step_count = 0 |
| 225 | self.global_step_count = 0 |
| 226 | self.total_elapsed_time = 0 |
| 227 | self.step_elapsed_time = 0 |
| 228 | self.steps_per_output = steps_per_output |
| 229 | self.monitor_memory = monitor_memory |
| 230 | self.logging = logging_fn |
| 231 | if self.logging is None: |
| 232 | self.logging = logger.info |
| 233 | self.initialized = False |
| 234 | # Reflow avoids a device-wide timer sync: waiting for its H2D side stream would delay |
| 235 | # the next GPU compute launch and reduce overlap with the CPU optimizer workers. |
| 236 | # Other runs keep the original full-device synchronization. |
| 237 | self.sync_current_stream = sync_current_stream |
| 238 | |
| 239 | if self.monitor_memory and importlib.util.find_spec("psutil") is None: |
| 240 | raise ImportError("Unable to import 'psutils', please install package") |
| 241 | |
| 242 | def update_epoch_count(self): |
| 243 | self.epoch_count += 1 |
nothing calls this directly
no outgoing calls
no test coverage detected