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

Bugfix/cuda oom detection and handling #6934

Merged

Conversation

ejohb
Copy link
Contributor

@ejohb ejohb commented Apr 9, 2021

What does this PR do?

This PR address the is_cuda_out_of_memory function missing some CUDA OOM errors as it only looks for a single fixed string. The problem in my case turned out to me a little more complex actually as the garbage_collection_cuda was itself generating OOM errors, so I had to handle those too.

Fixes #958
Fixes #6819

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Apr 9, 2021

Codecov Report

Merging #6934 (3c79bc9) into master (745aed0) will decrease coverage by 5%.
The diff coverage is 0%.

@@           Coverage Diff           @@
##           master   #6934    +/-   ##
=======================================
- Coverage      92%     87%    -5%     
=======================================
  Files         194     194            
  Lines       12410   12414     +4     
=======================================
- Hits        11428   10777   -651     
- Misses        982    1637   +655     

@awaelchli awaelchli added the ready PRs ready to be merged label Apr 10, 2021
@awaelchli awaelchli added this to the 1.3 milestone Apr 10, 2021
@awaelchli awaelchli added bug Something isn't working tuner labels Apr 10, 2021
pytorch_lightning/utilities/memory.py Outdated Show resolved Hide resolved
Copy link
Contributor

@akihironitta akihironitta left a comment

Choose a reason for hiding this comment

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

This PR fixes #6819, right? If so, could you update the description of this PR?

pytorch_lightning/utilities/memory.py Outdated Show resolved Hide resolved
pytorch_lightning/utilities/memory.py Outdated Show resolved Hide resolved
@awaelchli awaelchli removed the ready PRs ready to be merged label Apr 13, 2021
@awaelchli awaelchli requested a review from carmocca April 14, 2021 22:27
@carmocca carmocca merged commit 5bd3cd5 into Lightning-AI:master Apr 15, 2021
Comment on lines 54 to +57
return isinstance(exception, RuntimeError) \
and len(exception.args) == 1 \
and "CUDA out of memory." in exception.args[0]
and "CUDA" in exception.args[0] \
and "out of memory" in exception.args[0]
Copy link
Member

Choose a reason for hiding this comment

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

would be easier to read if the result will be in a var and then just return it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so, but was trying to as non-invasive as possible :)

Copy link
Member

Choose a reason for hiding this comment

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

good invasion is always welcome :]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tuner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

is_cuda_out_of_memory Misses CUDA OOM Errors Process runs on more GPUs than specified
5 participants