Skip to content
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
9 changes: 7 additions & 2 deletions src/cellflow/preprocessing/_wknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,13 @@ def _build_nn(
try:
from cuml.neighbors import NearestNeighbors

jax.devices("gpu")
except ImportError:
has_gpu = any(d.platform == "gpu" for d in jax.devices())
if has_gpu:
jax.devices("gpu")
else:
raise RuntimeError("No GPU backend available")

except (ImportError, RuntimeError):
logger.info(
"cuML is not installed or GPU is not available. Falling back to neighborhood estimation using CPU with pynndescent."
)
Expand Down
Loading