benfred / implicit

Fast Python Collaborative Filtering for Implicit Feedback Datasets
https://benfred.github.io/implicit/
MIT License
3.57k stars 612 forks source link

Dynamically detect CUDA availability #518

Closed benfred closed 2 years ago

benfred commented 2 years ago

Rather than just relying on the _cuda extension being built, also check to see if we have valid GPU devices. If there aren't GPU devices available, a warning saying:

UserWarning: CUDA extension is built, but disabling GPU support because of 'Cuda Error:
no CUDA-capable device is detected

will be logged, and GPU compatability disabled.