mmengine.utils.track_parallel_progress¶
- mmengine.utils.track_parallel_progress(func, tasks, nproc, initializer=None, initargs=None, bar_width=50, chunksize=1, skip_first=False, keep_order=True, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[源代码]¶
Track the progress of parallel task execution with a progress bar.
The built-in
multiprocessing
module is used for process pools and tasks are done withPool.map()
orPool.imap_unordered()
.- 参数
func (callable) – The function to be applied to each task.
tasks (list or tuple[Iterable, int]) – A list of tasks or (tasks, total num).
nproc (int) – Process (worker) number.
initializer (None or callable) – Refer to
multiprocessing.Pool
for details.initargs (None or tuple) – Refer to
multiprocessing.Pool
for details.chunksize (int) – Refer to
multiprocessing.Pool
for details.bar_width (int) – Width of progress bar.
skip_first (bool) – Whether to skip the first sample for each worker when estimating fps, since the initialization step may takes longer.
keep_order (bool) – If True,
Pool.imap()
is used, otherwisePool.imap_unordered()
is used.
- 返回
The task results.
- 返回类型