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

Vectorize similarity calculations #637

Open
tornikeo opened this issue May 3, 2024 · 0 comments
Open

Vectorize similarity calculations #637

tornikeo opened this issue May 3, 2024 · 0 comments

Comments

@tornikeo
Copy link
Contributor

tornikeo commented May 3, 2024

Is your feature request related to a problem? Please describe.
Using Numpy matmul for some vector similarity functions, instead of @njit, can speed up processing from

CPU times: user 2.05 s, sys: 19.4 ms, total: 2.07 s
Wall time: 2.41 s

to:

CPU times: user 47.4 ms, sys: 8.95 ms, total: 56.4 ms
Wall time: 62.7 ms

On 1k x 1k spectra, each of 1k size. Purely on CPU.

Here's a colab notebook to replicate the speedup.

Describe the solution you'd like
I already have some functions vectorized over at cudams. I'd like to move some of them to base matchms repo.

If that sounds fine with that proposal, I'll open a PR for it in a bit. Maybe there's some reason to avoid adding vectorized version (maybe somehow lower readability?)

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