add python profiler#288
Merged
sfc-gh-sbekman merged 2 commits intomainfrom Oct 6, 2025
Merged
Conversation
Signed-off-by: Stas Bekman <stas.bekman@snowflake.com>
| else: | ||
| # run profiler on rank 0 | ||
| # XXX: how do we prevent it from running on other nodes? | ||
| import cProfile |
Collaborator
There was a problem hiding this comment.
I don't know how dependencies are managed in AT, but does cProfile need to be added as dependency?
Collaborator
Author
There was a problem hiding this comment.
it's distributed with python core https://docs.python.org/3/library/profile.html
dependencies in AT are managed:
- required via pyproject.toml
- optional via code requiring it doing the checking - like liger-kernel
sfc-gh-truwase
approved these changes
Oct 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR will allow you to add to the launcher
--python_profile <sortkey>, which will run the code undercProfile, where sort keys aretottimeorcumtimeand then at the end of the run it will dump to stdout something like:I'm marking this API as experimental, since it's possible we might want to get the profile data into a file and then add per rank profile and more. So this is a very rough solution at the moment which I think will evolve.
Note we can't use yaml config here since it's too early in the game, hence the argparse API.