nebgnahz / cv-rs

Rust wrapper for OpenCV (manual at this point)
https://nebgnahz.github.io/cv-rs/cv/
MIT License
204 stars 41 forks source link

CUDA not available causes SIGSEV #123

Open vadixidav opened 5 years ago

vadixidav commented 5 years ago

When CUDA is not available at runtime, but cv-rs is built with the "cuda" feature enabled, then the program emits this message: OpenCV(3.4.1) Error: Gpu API call (no CUDA-capable device is detected) in allocate. Then an exception is thrown with that error which is not caught and blows up the stack. We need to catch exceptions for when CUDA is not available and either panic! on the Rust side, or give Result back via the API.

Pzixel commented 5 years ago

CResutlt has relevant method to catch it. We could just use it. Panic may be a bad thing since GPU may appear after (e.g. dynamic videocard switch on laptop).