Megatron-LM icon indicating copy to clipboard operation
Megatron-LM copied to clipboard

Profiling args are missing on the main brench

Open Skylion007 opened this issue 10 months ago • 2 comments

Describe the bug

A clear and concise description of what the bug is. Tag the @mcore-oncall to get oncall's attention to this issue.

  • the development branch has useful tooling like --profile that is missing on the main branch. Is this a purposeful exclusion? Or an oversight. This makes it difficult to run profiling on stable commits on the main branch.

Steps/Code to reproduce bug

Please list minimal steps or code snippet for us to be able to reproduce the bug.

A helpful guide on on how to craft a minimal bug report http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports.

--profile is not included on the main branch

Expected behavior

A clear and concise description of what you expected to happen.

--profile and related args included on the main branch. Alternatively, if this is useful it would be great to annotate these args as dev only somewhere in the doc string in the arguments.py or the dataclass refactor for the config system.

Additional context

Add any other context about the problem here.

Skylion007 avatar Jan 26 '26 20:01 Skylion007

Have you tried running pretrain_gpt.py --help ? I think the arguments will still be usable, they are just automatically generated now, instead of explicitly defined. See this PR

maanug-nv avatar Jan 27 '26 22:01 maanug-nv

This looks stale on current main — the --profile flag and the rest of the profiling args are present, just no longer registered via a literal add_argument('--profile', ...) call, which is presumably why a direct search for that string doesn't find them.

They're now generated from a dataclass:

  • megatron/training/config/common_config.py defines ProfilingConfig, whose use_nsys_profiler field carries metadata={"argparse_meta": {"arg_names": ["--profile"], "dest": "profile"}}, alongside profile_step_start, profile_step_end, use_pytorch_profiler, profile_ranks, nvtx_ranges, etc.
  • megatron/training/arguments.py::_add_training_args() wires this in for real: ArgumentGroupFactory(ProfilingConfig).build_group(parser, "profiling").
  • megatron/training/training.py reads args.profile, args.profile_step_start/end, args.profile_ranks, args.use_pytorch_profiler, and args.nvtx_ranges throughout the training loop (e.g. around the profiler-start/stop logic).

So --profile and friends are live on main today via the dataclass-driven argparse system rather than the classic direct add_argument() calls. Given that, this can probably be closed unless there's a specific flag from dev that's still missing — happy to be pointed at one if so.

amanyagami avatar Aug 21 '26 02:08 amanyagami