Skip to content

Commit ae16755

Browse files
committed
fixed critical issue that got introduced with the pre-commits: removed required imports for executor and parallelization init are now imported again
1 parent 190e3c2 commit ae16755

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

src/pyflowreg/_runtime.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,16 @@ def _detect_optional_features(cls) -> None:
114114
"""Detect other optional features and accelerators."""
115115
# GPU support via CuPy
116116
try:
117-
import_module("cuda")
118-
cls._config["available_features"].add("gpu_cupy")
119-
except ImportError:
117+
warnings.filterwarnings(
118+
"ignore",
119+
message="CUDA path could not be detected",
120+
category=UserWarning,
121+
module=r"cupy\._environment",
122+
)
123+
cp = import_module("cupy")
124+
if cp.cuda.runtime.getDeviceCount() > 0:
125+
cls._config["available_features"].add("gpu_cupy")
126+
except (ImportError, Exception):
120127
pass
121128

122129
# GPU support via PyTorch

src/pyflowreg/core/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ def to_tensor(a):
185185

186186
# CUDA backend (only if cupy is available)
187187
try:
188+
import warnings
189+
190+
# Suppress CuPy CUDA path warning during availability check
191+
warnings.filterwarnings(
192+
"ignore",
193+
message="CUDA path could not be detected",
194+
category=UserWarning,
195+
module=r"cupy\._environment",
196+
)
188197
import cupy as cp # noqa: F401
189198

190199
CUPY_AVAILABLE = True

src/pyflowreg/motion_correction/compensate_recording.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from pyflowreg.motion_correction.OF_options import OutputFormat, ChannelNormalization
1515

1616
# Import to trigger executor registration (side effect)
17+
import pyflowreg.motion_correction.parallelization as _parallelization # noqa: F401
1718

1819

1920
@dataclass

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def initialize_runtime_context():
2525
RuntimeContext.init(force=True)
2626

2727
# Import parallelization module to trigger executor registration
28+
import pyflowreg.motion_correction.parallelization # noqa: F401
2829

2930

3031
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)