Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance logging messages for improved user experience #138

Merged
merged 4 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/converter/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def setup_logging(log_filename: str) -> None:
stream_handler.setLevel(logging.WARNING)
stream_handler.setFormatter(formatter)

stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.INFO)
stream_handler.setFormatter(formatter)

logging.basicConfig(level=logging.DEBUG, handlers=[file_handler, stream_handler])


Expand Down Expand Up @@ -107,6 +111,7 @@ def main() -> None:
if "func" in args:
setup_logging(args.log_filename)
args.func(args)
logging.info(f"Conversion successful. Output file is available at {args.output}.")
else:
parser.print_help()

Expand Down
2 changes: 2 additions & 0 deletions src/trace_link/trace_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def main() -> None:
linker = TraceLinker()
linker.link(args.chakra_host_trace, args.chakra_device_trace, args.output_file)

logging.info(f"Linking process successful. Output file is available at {args.output_file}.")
logging.info("Please run the chakra_converter for further postprocessing.")

if __name__ == "__main__":
main()
10 changes: 0 additions & 10 deletions src/trace_link/trace_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,6 @@ def map_host_to_device_ops(
host_op_id_to_timestamp_map = {}
host_op_id_to_inter_thread_dep_map = {}

host_ops_count = len(host_ops)
kineto_ops_count = len(kineto_cpu_ops)
if host_ops_count > kineto_ops_count:
# The specific comment is placed within the if block as requested.
logging.warning(
f"Number of Chakra host operators ({host_ops_count}) is larger than the number of Kineto "
f"operators ({kineto_ops_count}). Expected Chakra host ops (CPU only) to be fewer than Kineto ops "
"(CPU and GPU). Logging this rare but possible scenario."
)

for _, host_op in enumerate(host_ops):
if (host_op.rf_id is not None) and (host_op.rf_id in kineto_rf_id_to_device_op_map):
kineto_op = kineto_rf_id_to_device_op_map[host_op.rf_id]
Expand Down
Loading