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

try/except protection to warn for cudnn_enabled #101

Merged
merged 2 commits into from
Nov 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions sigpy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,26 @@
cupy_enabled = False

if cupy_enabled: # pragma: no cover
cudnn_enabled = util.find_spec("cupy.cuda.cudnn") is not None
nccl_enabled = util.find_spec("cupy.cuda.nccl") is not None
try:
cudnn_enabled = util.find_spec("cupy.cuda.cudnn") is not None
if cudnn_enabled:
from cupy import cudnn
except ImportError as e:
warnings.warn(
f"Importing cupy.cuda.cudnn failed. "
f"For more details, see the error stack below:\n{e}"
)
cudnn_enabled = False
try:
nccl_enabled = util.find_spec("cupy.cuda.nccl") is not None
if nccl_enabled:
from cupy.cuda import nccl # noqa: F401
except ImportError as e:
warnings.warn(
f"Importing cupy.cuda.nccl failed. "
f"For more details, see the error stack below:\n{e}"
)
nccl_enabled = False
else:
cudnn_enabled = False
nccl_enabled = False
Expand Down