Skip to content

Commit

Permalink
[mmf][search] Leverage the TrainerProfilingMixin to figure out the de…
Browse files Browse the repository at this point in the history
…tailed latency breakdown

Differential Revision: D46013756

fbshipit-source-id: d01a6668b40e77c3adaddf0e93a7948da94657d8
  • Loading branch information
Xialu Li authored and facebook-github-bot committed May 19, 2023
1 parent 1c4c0f9 commit def19b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mmf/trainers/core/profiling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Facebook, Inc. and its affiliates.

import logging
import threading
from abc import ABC
from typing import Type

Expand All @@ -16,5 +17,7 @@ class TrainerProfilingMixin(ABC):
def profile(self, text: str) -> None:
if self.training_config.logger_level != "debug":
return
logging.debug(f"{text}: {self.profiler.get_time_since_start()}")
logging.debug(
f"tid={threading.current_thread().ident}, {text}: {self.profiler.get_time_since_start()}"
)
self.profiler.reset()

0 comments on commit def19b7

Please sign in to comment.