Skip to content

Suppress noisy external-library log lines on non-rank-0 processes - #5590

Merged
deepakn94 merged 1 commit into
NVIDIA:mainfrom
deepakn94:dnarayanan/suppress_nonrank0_log_noise
Aug 12, 2026
Merged

Suppress noisy external-library log lines on non-rank-0 processes#5590
deepakn94 merged 1 commit into
NVIDIA:mainfrom
deepakn94:dnarayanan/suppress_nonrank0_log_noise

Conversation

@deepakn94

Copy link
Copy Markdown
Contributor

Summary

  • Add DeprecationWarning to the warning filter list on non-rank-0 processes in pretrain_gpt.py and pretrain_hybrid.py. Override warnings.showwarning as a fallback for libraries like CUTLASS DSL that use catch_warnings() with simplefilter("always") to bypass filters.
  • Suppress noisy Python loggers (GroupedGemmQuantSm100, GroupedGemmDsreluSm100, GroupedGemmSreluSm100, GroupedGemmWgradSm100, absl) on non-rank-0 in setup_logging().
  • Pass device_id to torch.distributed.init_process_group() to eliminate the NCCL "Guessing device ID" C++ warning on every rank.

Together these reduce log output from ~160K lines to ~3K lines on a 128-GPU job.

Test plan

  • Verified on oci-hsg with 32-node (128 GPU) job: log went from 159K → 21K → 3K lines
  • Remaining non-rank-0 lines are only NCCL version strings (~128) and legitimate rank-127 Megatron output (timers, iteration logs)

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@deepakn94
deepakn94 marked this pull request as ready for review June 30, 2026 22:13
@deepakn94
deepakn94 requested review from a team as code owners June 30, 2026 22:13
@deepakn94

Copy link
Copy Markdown
Contributor Author

/claude review

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

logger.info(f'Setting logging level to {logging_level}')
logging.getLogger().setLevel(logging_level)

if not is_rank0():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we just use this instead: https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/training/utils/log_utils.py#L66-L70

was going to remove the version in this file (initialize.py) in a different PR that hasn't been merged yet. but it seems that it would do the same thing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Where should I call the version in log_utils?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does it not work if called in the same place this one is called? ie log_utils.setup_logging should just replace initialize.setup_logging?

Comment thread megatron/training/initialize.py Outdated
Add DeprecationWarning to the warning filter list on non-rank-0. Override
warnings.showwarning as a fallback for libraries like CUTLASS DSL that use
catch_warnings() with simplefilter("always") to bypass filters. Suppress
noisy Python loggers (GroupedGemm variants, absl) on non-rank-0 in
setup_logging().

Signed-off-by: Deepak Narayanan <dnarayanan@nvidia.com>
@deepakn94
deepakn94 force-pushed the dnarayanan/suppress_nonrank0_log_noise branch from 4a188c1 to 7027e38 Compare August 11, 2026 22:25
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the Approved All necessary approvals have been made label Aug 11, 2026
@deepakn94

Copy link
Copy Markdown
Contributor Author

/ok to test 7027e38

@deepakn94
deepakn94 added this pull request to the merge queue Aug 12, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/31615942188

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@deepakn94
deepakn94 added this pull request to the merge queue Aug 12, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/31624303817

Merged via the queue into NVIDIA:main with commit fad6111 Aug 12, 2026
96 of 100 checks passed
@deepakn94
deepakn94 deleted the dnarayanan/suppress_nonrank0_log_noise branch August 12, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved All necessary approvals have been made complexity: low nemotron

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants