Closed vkonan closed 1 year ago
A running mcorr or cnmf item prints stuff as it's processing. You can also monitor your CPU and RAM usage. If your RAM is overflowing that can be a common reason for it to "hang" (it usually just takes a very long time and doesn't really hang). You can reduce number of processes to spawn using the MESMERIZE_N_PROCESSES environment variable, this also reduces RAM usage.
Thanks! Also, is there a way to use the cluster in mesmerize, akin to cm.cluster.setup_cluster(...) ? I tried this but got an error: df.iloc[-1].caiman.cluster.setup_cluster(...)
Nope you can't directly access that, all available functions under the caiman
accessor are these: https://mesmerize-core.readthedocs.io/en/latest/api/common.html
What are you trying to set with caiman.cluster
?
I was just hoping to speed up the graph_nmf or sparse_nmf. Currently, greedy_roi takes 76s, while graph/sparse_nmf take 1800s on the same data.
Yes they are much slower and I'm not sure if initialization is multithreaded so that wouldn't help you. I know one of them is also very RAM intensive.
For sparse_nmf also see this, should be out in the next release: https://github.com/flatironinstitute/CaImAn/pull/1078
Cluster should work for dendritic: you can run on patches and then run refit()
on initial answer on the full image because often dendrites span very large bits of the FOV. I don't have a ton of practical experience with this, but it is in the demo. The initial run often will have them very spatially restricted to the patches, but then running it on refit (which is fast) will then push beyond those initial estimates. For sparse-nmf I'd drop the number of iterations way down, like even to 20. Not saying it will work, but I'd explore that as just another parameter because it can sometimes converge very fast (and I've seen it get less sparse with more iterations).
I should stress the dendritic analysis has not be super stress-tested, and sparse_nmf has not been used a lot. I'm glad people are starting to push on it. :)
Just note that Eric's comments here are for using caiman
directly. If you want to run refit
with mesmerize
you can set "refit"
in the parmas dict to True
, it goes outside of "main" (main is for algo params).
params = {"main": {...cnmf params here ...}, "refit": True}
Thanks to you both for the prompt replies!
Am I correct to assume that the multithreading is not something that will be implemented in mesmerize? If not, I don't see mesmerize being a practical method to process dendritic data.
Would you also recommend the following workflow?
Am I correct to assume that the multithreading is not something that will be implemented in mesmerize? If not, I don't see mesmerize being a practical method to process dendritic data.
Multiprocessing is used, you can set MESMERIZE_N_PROCESSES
. I'm just not entirely sure if those initialization options are parallelized, but CNMF is. By default it is n_threads - 1
If the mesmerize method is not parallelized, it might explain the longer processing time.
MESMERIZE_N_PROCESSES
is used to set n_processes
for setup_cluster()
, this is where it is used: https://github.com/nel-lab/mesmerize-core/blob/master/mesmerize_core/algorithms/cnmf.py#L46-L57
Are you setting the same number of processes and params for both? Is RAM usage the same during both? What OS are you on (it does work on Linux & Windows as far as I know, haven't looked at this specifically on mac), I wonder if MESMERIZE_N_PROCESSES
is not being use for some reason in your case, or if it's a params thing.
Just checked the n_processes in both methods and they're both 7 (i have 8 cores). I have to retract my statement about the 1800s processing time. The discrepancy seems to have been caused by differences in 'ssub' and 'tsub' params (1 vs 2). They're processing at about the same time. Thanks for catching that, Kushal.
I'm closing this issue because all my questions regarding processing time have been answered. Thanks, all!
Yea you want to watch out for the subsampling params, if your spatial resolution is already at the limit you want to set it to 1.
On Tue, May 23, 2023, 18:33 Vaibhav Konanur @.***> wrote:
Just checked the n_processes in both methods and they're both 7 (i have 8 cores). I have to retract my statement about the 1800s processing time. The discrepancy seems to have been caused by differences in 'ssub' and 'tsub' params (1 vs 2). They're processing at about the same time. Thanks for catching that, Kushal.
I'm closing this issue because all my questions regarding processing time have been answered. Thanks, all!
— Reply to this email directly, view it on GitHub https://github.com/nel-lab/mesmerize-core/issues/203#issuecomment-1560212487, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRHZJQS7ZZO5235JKHDXHU3LFANCNFSM6AAAAAAYIHF3SI . You are receiving this because you commented.Message ID: @.***>
I'm fairly new to python and still getting used to the notebook interface, so I apologize if there is a solution to this already that I'm missing:
Is there a way to tell whether a cnmf or motion correction process is running or just hung up? Is there a way to add a progress bar or something to estimate how far in the algorithm process it is in?
Thanks, V