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

feat: add use_cuda for caiman #116

Merged
merged 1 commit into from
Jul 11, 2024
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
9 changes: 9 additions & 0 deletions element_interface/run_caiman.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
except: # noqa E722
pass # TODO: remove bare except

try:
import torch
cuda_is_available = torch.cuda.is_available()
except:
cuda_is_available = False
pass

import caiman as cm
from caiman.source_extraction.cnmf import params as params
from caiman.source_extraction.cnmf.cnmf import CNMF
Expand Down Expand Up @@ -36,6 +43,8 @@ def run_caiman(
parameters["fnames"] = file_paths
parameters["fr"] = sampling_rate

parameters["use_cuda"] = cuda_is_available # Use CUDA if available

if "indices" in parameters:
indices = parameters.pop(
"indices"
Expand Down
Loading