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

CUDA memory profile #9096

Merged
merged 3 commits into from
May 9, 2024
Merged

CUDA memory profile #9096

merged 3 commits into from
May 9, 2024

Conversation

erhoo82
Copy link
Collaborator

@erhoo82 erhoo82 commented May 2, 2024

What does this PR do ?

Profile CUDA memory breakdown. The reference is available in the below link.
https://pytorch.org/blog/understanding-gpu-memory-1/

The memory profile will generate a pickle file and a user can load the file in the below page.
https://pytorch.org/memory_viz

Changelog

  • Added the option to profile a range of training steps to profile the memory usage
  • Adjust the training step by the number of micro-batches steps per global step.

Usage

Add the below knobs to the yaml run config.

  memory_profile:                                                                      
     enabled: true                                                                      
     start_step: 2                                                                      
     end_step: 5                                                                        
     rank: 0                                                                            
     output_path: <path/to/out_file>

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

@github-actions github-actions bot added core Changes to NeMo Core NLP Multi Modal labels May 2, 2024
Signed-off-by: Sangkug Lym <slym@nvidia.com>
@erhoo82 erhoo82 requested a review from ericharper May 2, 2024 20:22
@ericharper ericharper requested a review from akoumpa May 2, 2024 21:51
Copy link
Member

@akoumpa akoumpa left a comment

Choose a reason for hiding this comment

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

Hi @erhoo82,

I'm going to approve this as is, with one suggestion:

I searched for hasattr(self, '_memory_profile_enabled') and found 11 occurrences. Something like self.has_memory_profile_enabled() would result in cleaner code, for example, if the has_memory_profile_enabled was defined in modelPT.py.
However, that's not a hard requirement as the hasattr is widely used in NeMo.

Thank you so much, this is helpful feature to have in NeMo.

@erhoo82 erhoo82 merged commit 15e09a4 into main May 9, 2024
134 checks passed
@erhoo82 erhoo82 deleted the memory_profile branch May 9, 2024 23:28
BoxiangW pushed a commit to BoxiangW/NeMo that referenced this pull request Jun 5, 2024
* CUDA memory profile

Signed-off-by: Sangkug Lym <slym@nvidia.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Sangkug Lym <slym@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Harper <complex451@gmail.com>
Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>
rohitrango pushed a commit to rohitrango/NeMo that referenced this pull request Jun 25, 2024
* CUDA memory profile

Signed-off-by: Sangkug Lym <slym@nvidia.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Sangkug Lym <slym@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Harper <complex451@gmail.com>
@tonyjie tonyjie mentioned this pull request Jul 24, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants