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

Docker CUDA warning fix #1895

Merged
merged 1 commit into from
Jan 10, 2021
Merged

Docker CUDA warning fix #1895

merged 1 commit into from
Jan 10, 2021

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Jan 10, 2021

This PR fixes the warning displayed in Docker with CPU first noticed in issue #1891. Solution is a rearrangement of logic to avoid calls to torch.cuda.is_available(). Problem is likely within torch but this change has no negative side effects so it's probably worth it to implement.

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improved device selection logic for CUDA in YOLOv5.

πŸ“Š Key Changes

  • Reordered the conditions in the device selection to prioritize CPU check before verifying CUDA availability.

🎯 Purpose & Impact

  • πŸš€ Purpose: The change ensures that the CPU preference is considered before the system checks for CUDA compatibility. This could prevent unnecessary checks for CUDA when CPU mode is explicitly requested.
  • βœ… Impact: This tweak might result in minor performance improvements and cleaner logic during the initialization of the YOLOv5 model, especially for environments where CUDA is not intended to be used. It primarily benefits users who wish to run models on the CPU or manage GPU visibility more efficiently.

@glenn-jocher glenn-jocher merged commit ffef771 into master Jan 10, 2021
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch January 10, 2021 20:26
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
taicaile pushed a commit to taicaile/yolov5 that referenced this pull request Oct 12, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant