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

cuda_torchdiffeq_integrator.py: check if pytorch is built with cuda capabilities #2613

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
has_cupy = True
has_torch = True
has_torchdiffeq = True
has_torch_without_cuda = False

try:
import cupy as cp
Expand All @@ -24,6 +25,8 @@
import torch
import torch.utils
import torch.utils.dlpack
if torch.version.cuda is None:
has_torch_without_cuda = True
except ImportError:
has_torch = False

Expand All @@ -46,6 +49,10 @@ def __init__(self,
raise ImportError(
'torch and torchdiffeq are required to use Torch-based integrators.'
)
if has_torch_without_cuda:
raise ImportError(
'Please install a compatible version of PyTorch with CUDA support.'
)
if not has_torchdiffeq:
raise ImportError(
'torchdiffeq is required to use Torch-based integrators.')
Expand Down