Skip to content

Commit

Permalink
Merge pull request #78 from ad12/master
Browse files Browse the repository at this point in the history
  • Loading branch information
frankong committed May 3, 2021
2 parents 6373e21 + 11ac71c commit f815e1c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sigpy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@
This module contains flags to turn on and off optional modules.
"""
import warnings
from importlib import util

cupy_enabled = util.find_spec("cupy") is not None
if cupy_enabled:
try:
import cupy # noqa
except ImportError as e:
warnings.warn(
f"Importing cupy failed. "
f"For more details, see the error stack below:\n{e}"
)
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
Expand Down

0 comments on commit f815e1c

Please sign in to comment.