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

Manually init absl log to avoid log spam #6890

Merged
merged 1 commit into from
Apr 5, 2024
Merged

Conversation

JackCaoG
Copy link
Collaborator

@JackCaoG JackCaoG commented Apr 4, 2024

This should get rid of

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1712267574.801377  681831 pjrt_api.cc:100] GetPjrtApi was found for tpu at /usr/local/lib/python3.10/site-packages/libtpu/libtpu.so
I0000 00:00:1712267574.801477  681831 pjrt_api.cc:79] PJRT_Api is set for device type tpu
I0000 00:00:1712267574.801484  681831 pjrt_api.cc:146] The PJRT plugin has PJRT API version 0.46. The framework PJRT API version is 0.46.

on every init. torch_xla/csrc/BUILD was messed by the formater, my only change was to add "@com_google_absl//absl/log:initialize",

@JackCaoG JackCaoG requested a review from will-cromar April 4, 2024 23:23
@JackCaoG
Copy link
Collaborator Author

JackCaoG commented Apr 4, 2024

@lsy323 I consider this as a regression, since in 2.0 we fixed this issue once. I am debating whether we should backport this to 2.3. What do you think?

@@ -2206,6 +2207,7 @@ void InitXlaModuleBindings(py::module m) {
!xtensor->CurrentDataHandle()->HasValue();
});
m.def("_init_xla_lazy_backend", []() {
absl::InitializeLog();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I'm not confident about this change. IIRC this function errors out if it's called twice, and it is for sure called in the GPU plugin: https://github.com/openxla/xla/blob/df104c0963bf1597358dc759da3fa3d2639de03c/xla/pjrt/c/pjrt_c_api_gpu.cc#L28

If you're considering a backport, a more conservative change would be to add the initialization for TPU only sine we're sure libtpu does not init logging:

} else if (device_type == "TPU") {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg, will update

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not backport this since it has risks.

@JackCaoG JackCaoG force-pushed the JackCaoG/fix_log_spam branch from 01f48fa to 3919c07 Compare April 5, 2024 00:30
@JackCaoG JackCaoG requested a review from will-cromar April 5, 2024 00:31
Copy link
Collaborator

@will-cromar will-cromar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What tool did you use to format the bazel build file and should I be using it?

@JackCaoG
Copy link
Collaborator Author

JackCaoG commented Apr 5, 2024

What tool did you use to format the bazel build file and should I be using it?

I need to find out haha, I was just using the vscode with our dev container and the vscode decided to format the bazel file.

@JackCaoG JackCaoG merged commit 62f6e05 into master Apr 5, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants