Repository navigation
Closed
Labels
bug in sorterThe bug is in sorter code itself, not in SI
Description
sorting = ss.run_spykingcircus(recording=recording,
output_folder=f"/hdd/kampff/raw/Recordings/{dataset_id}/spykingcircus",
docker_image=True,
**sorter_params)
returns
Traceback (most recent call last):
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/sorters/runsorter.py", line 564, in run_sorter_container
sorting = SorterClass.get_result_from_folder(output_folder)
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/sorters/basesorter.py", line 281, in get_result_from_folder
sorting = cls._get_result_from_folder(output_folder)
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/sorters/spyking_circus/spyking_circus.py", line 169, in _get_result_from_folder
sorting = SpykingCircusSortingExtractor(folder_path=Path(output_folder) / 'recording')
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/extractors/spykingcircusextractors.py", line 67, in __init__
raise Exception(spykingcircus_folder, " is not a spyking circus folder")
Exception: (PosixPath('/hdd/kampff/raw/Recordings/c27/spykingcircus/recording'), ' is not a spyking circus folder')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/kyu/repos/deepinterpolation_validation/processing/sort_di_sc.py", line 52, in <module>
main()
File "/home/kyu/repos/deepinterpolation_validation/processing/sort_di_sc.py", line 30, in main
sorting = ss.run_spykingcircus(recording=recording,
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/sorters/runsorter.py", line 679, in run_spykingcircus
return run_sorter('spykingcircus', *args, **kwargs)
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/sorters/runsorter.py", line 135, in run_sorter
return run_sorter_container(
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/sorters/runsorter.py", line 571, in run_sorter_container
sorting = NpzSortingExtractor.load_from_folder(npz_sorting_path)
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/core/base.py", line 565, in load_from_folder
return BaseExtractor.load(folder)
File "/home/kyu/miniconda3/envs/di_val/lib/python3.9/site-packages/spikeinterface/core/base.py", line 561, in load
raise ValueError('spikeinterface.Base.load() file_path must be an existing folder or file')
ValueError: spikeinterface.Base.load() file_path must be an existing folder or file
Metadata
Metadata
Assignees
Labels
bug in sorterThe bug is in sorter code itself, not in SI
Activity
alejoe91 commentedon Aug 23, 2022
@khl02007 can you heck the
logfile in the output folder?khl02007 commentedon Aug 24, 2022
here are the contents of
spikeinterface_log.jsonyger commentedon Aug 29, 2022
Hi
It looks indeed like a crash of SC, without proper warnings/reasons. What is the amount of RAM that you have on the machine? Can you monitor a bit the usage during the run?
khl02007 commentedon Aug 30, 2022
@yger I have 64 GB of RAM. The recording is ~ 19 GB (~ 14 min, Neuropixels 1.0). I got this error when running with
num_workers=-1(default). When I changed this tonum_workers=1, sorting finishes without the error - so maybe it is a problem with RAM running out. But it is very slow (~4 hrs to sort). I will monitor the memory usage more and report back, but meanwhile do you see a way to speed things up?yger commentedon Nov 8, 2022
This can be similar to #1034, but as said, I think that such a small recording should work fine even with 32Gb of RAM, so I am surprised and puzzled. When you are launching it with several cores, is the code faster at least? Because could be that MPI is not well installed. What do you have when you do, in a Python terminal
khl02007 commentedon Nov 9, 2022
@yger I agree that the problem is probably related to MPI but I'm not sure how to fix it. It throws an error when more than 1 worker is used. This happens regardless of whether I use dockerized SC or not.
Here is the output:
Here is the error:
Aryo-Zare commentedon Nov 11, 2022
@yger
Continued from #1034 :
I tested the MPI version on my LAB computer as you instructed. This compupter has windows operating system.
Sorting in this computer worked without problem.
In the Linux server in which I had the problem :
Consequently I feel the problem is not necessarily from the amount of RAM, but is from MPICH.
I intially thought the amount of RAM (64GB) in my LAB computer is more than in the server, but I'm not sure about it. When I type the 'free' command in linux shell I see a lot more memory available. The reason I pointed the amount of available RAM is that I don't know the result of this command would give all the hard-disk space or only the RAM.
But if possible, I would like to test-run spyking-circus by Open-MPI on the server : If it runs without error, it means that not the RAM, but MPICH is the source of the problem.
How can I do that ?
Aryo-Zare commentedon Nov 15, 2022
@yger
@alejoe91
I have some new insights that I want to share. On my side, this problem is resolved !
As it turns out, it was not the amount of RAM or the MPI vendor that caused the problem. The cause of the problem was non-optimal choice of the number of parallel threads of execution (CPU core threads).
I performed some benchmarking tests (below) that brought some strange, but very exciting results. As I had mentioned before, the sorting of the same file ran without problem in the LAB workstation. I had initially pointed to the amount of RAM in that computer. But the importance was it's number of threads (or cores) : it has in total 20 CPU threads.
The server in my institute (at which I encountered this issue) has 144 parallel threads of execution (2 threads per core , 72 cores : 4 sockets * 18 cores per socket).
Below, I compare the spykingcircus run time while selecting different number of threads at each sorting trial in the server. The number of threads can be chosen by spikeinterface parameter (num_workers) :
My previous mindset was that the more the number of CPUs selected, the higher is the speed. Hence I selected the maximum number of CPUs in the server. This caused the program to crash.
As you see above, there is an optimal number of threads to choose (here 20), higher or lower than that which would decrease the speed, & even when very high would crash the program.
At num_workers : 60 , the amount of time needed for running the program exponentially grows.
I Googled about this phenomenon & found some technical reasons about it. In fact, one must define an optimal number of threads while doing parallel processing.
Here I mention some of the sources that had delighted me :
My suggestion is that in documentation of spikeinterface and spykingcircus we would add a suggestion to the user that guides them to benchmark the speed of execution of the program to find the condition with the highest speed. And that if they encounter crashes, one reason may be too many threads running in parallel.