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

Set devices to 1 if multi-gpu is configured #2256

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

samet-akcay
Copy link
Contributor

📝 Description

  • Multi-GPU is currently not supported in anomalib due to how metrics are handled. This PR checks if user passes multi-gpu configuration and properly re-configures to single GPU with correct GPU id .

✨ Changes

Select what type of change your PR is:

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🔨 Refactor (non-breaking change which refactors the code base)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔒 Security update

✅ Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • 📋 I have summarized my changes in the CHANGELOG and followed the guidelines for my type of change (skip for minor changes, documentation updates, and test enhancements).
  • 📚 I have made the necessary updates to the documentation (if applicable).
  • 🧪 I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).

For more information about code review checklists, see the Code Review Checklist.

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 32.43243% with 25 lines in your changes missing coverage. Please review.

Project coverage is 80.64%. Comparing base (cfd3d8e) to head (6eebcc1).
Report is 3 commits behind head on main.

Files Patch % Lines
src/anomalib/engine/engine.py 32.43% 25 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2256      +/-   ##
==========================================
- Coverage   80.80%   80.64%   -0.17%     
==========================================
  Files         248      248              
  Lines       10859    10894      +35     
==========================================
+ Hits         8775     8785      +10     
- Misses       2084     2109      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# TODO(ashwinvaidya17, djdameln, samet-akcay): Add Multi-GPU support to Anomalib
# https://github.com/openvinotoolkit/anomalib/issues/1449
devices = self._cache.args.get("devices")
if devices and str(devices).count(","):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if someone passes devices =2? If I am not wrong, it will still start distributed training.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I've added few more logic to cover some other edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants