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

Improve performance for high-channel count #34

Open
magland opened this issue Feb 4, 2021 · 4 comments
Open

Improve performance for high-channel count #34

magland opened this issue Feb 4, 2021 · 4 comments

Comments

@magland
Copy link
Owner

magland commented Feb 4, 2021

No description provided.

@magland
Copy link
Owner Author

magland commented Feb 4, 2021

Here's a useful context manager for timing section of code:

import time

class Timer:
    def __init__(self, *, label='', verbose=False):
      self._label = label
      self._start_time = None
      self._stop_time = None
      self._verbose = verbose

    def elapsed(self):
      if self._stop_time is None:
        return time.time() - self._start_time
      else:
        return self._stop_time - self._start_time

    def __enter__(self):
      self._start_time = time.time()
      return self

    def __exit__(self, exc_type, exc_value, exc_tb):
      self._stop_time = time.time()
      if self._verbose:
        print(f"Elapsed time time for {self._label}: {self.elapsed()} sec")

with Timer(label='sleep', verbose=True) as timer:
  # some expensive operation
  time.sleep(3)

print(timer.elapsed())

@magland
Copy link
Owner Author

magland commented Feb 4, 2021

Run mountainsort4 on 18-ch recording, 10-60 minutes. And try to determine where the bottleneck is:

This is the file you'll need to put thing timing tests:
https://github.com/magland/ml_ms4alg/blob/master/ml_ms4alg/ms4alg.py

@magland
Copy link
Owner Author

magland commented Feb 4, 2021

Different parts to time:

  • Preparing hdf5 file
  • Detection
  • feature extraction
  • Clustering (branch_cluster)
  • Compute templates (compute_templates_from_timeseries_model)

Also useful to know the scaling properties of the above steps (as channel number or duration increases)

I suggest trying
duration: 10 minutes, 20 minutes (compare timings)
channel count: 9, 18 (compare timings)

@magland
Copy link
Owner Author

magland commented Feb 4, 2021

May also be helpful to see how timings scale with changes in adjacency_radius (nbhd size).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant