nemo_automodel.components.training.timers
nemo_automodel.components.training.timers
Megatron based timers.
Module Contents
Classes
Data
API
Bases: TimerBase
Dummy Timer.
Returns the cumulative duration the timer has been active.
Note: Not supported for DummyTimer.
Dummy timer elapsed time.
Dummy timer reset.
Dummy timer start.
Dummy timer stop.
Bases: TimerBase
Timer class with ability to start/stop.
Comment on using barrier: If this flag is passed, then all
the caller processes will wait till all reach the timing routine.
It is up to the user to make sure all the ranks in barrier_group
call it otherwise, it will result in a hang.
Comment on barrier_group: By default it is set to None which
in torch distributed land, it will result in the global communicator.
Calculates the cumulative duration for which the timer has been active.
Calculates the elapsed time and restarts timer.
Parameters:
Resets timer before restarting. Defaults to True.
Synchronizes ranks before stopping. Defaults to False.
Returns:
Elapsed time.
Reset timer.
Sets barrier group.
Parameters:
Torch ProcessGroup for barrier.
Start the timer.
Parameters:
Synchronizes ranks before starting. Defaults to False.
Stop the timer.
Parameters:
Synchronizes ranks before stopping. Defaults to False.
Timer base class.
Start the timer when entering a context using the configured barrier option.
Stop the timer when exiting a context using the configured barrier option.
Calculates the elapsed time and restarts timer.
Parameters:
Resets timer before restarting. Defaults to True.
Synchronizes ranks before stopping. Defaults to False.
Returns:
Elapsed time.
Reset timer.
Start the timer.
Parameters:
Synchronizes ranks before starting. Defaults to False.
Stop the timer.
Parameters:
Synchronizes ranks before stopping. Defaults to False.
Set the barrier option for use in context manager.
Parameters:
Whether to use barrier in context manager. Defaults to True.
Returns:
Returns self for chaining.
Class for a group of Timers.
Call timer with name and log level.
Returns a timer object that can be used as a context manager.
Parameters:
Name of the timer.
Log level of the timer. Defaults to None.
Whether to use barrier in context manager. Defaults to False.
Report times across all ranks.
Returns elapsed times of timers in names.
If the above assumptions are not met, calling this function will result in hang.
Parameters:
list of timer names
reset the timer after recording the elapsed time
if set, do a global barrier before time measurments
Returns:
torch.tensor: Tensor of size [world_size, len(names)] with times in float.
Report only min and max times across all ranks.
Report strings for max/minmax times across all ranks.
Returns the output string with logged timer values according to configured options.
Parameters:
Names of the timers to log. If None, all registered timers are fetched. Defaults to None.
Normalizes the timer values by the factor. Defaults to 1.0.
Whether to reset timer values after logging. Defaults to True.
Whether to do a global barrier before time measurments. Defaults to False.
Returns:
Formatted string with the timer values.
Raises:
Exception: Raises if log option is invalid.
Logs the timers passed in names to stdout.
Example usage is to log average per step value for timer ‘foo’, this function can be called with normalizer factor set to logging interval.
Parameters:
Names of the timers to log.
logs the timers to a specific rank. If set to None, logs to the last rank. Defaults to None.
Normalizes the timer values by the factor. Defaults to 1.0.
Whether to reset timer values after logging. Defaults to True.
Whether to do a global barrier before time measurments. Defaults to False.
Write timers to a tensorboard writer.
Note that we only report maximum time across ranks to tensorboard.
Parameters:
Names of the timers to log.
Tensorboard SummaryWriter object
Current iteration.
Normalizes the timer values by the factor. Defaults to 1.0.
Whether to reset timer values after logging. Defaults to True.
Whether to do a global barrier before time measurments. Defaults to False.
Patch to write timers to wandb for Megatron Core Timers.