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

Add features required for the migration of rusty-machine to nalgebra #498

Open
5 of 7 tasks
sebcrozet opened this issue Dec 9, 2018 · 2 comments
Open
5 of 7 tasks
Assignees
Labels
breaking change Fixing this issue, or merging this pull-request is likely to require breaking changes enhancement P-high High priority
Milestone

Comments

@sebcrozet
Copy link
Member

sebcrozet commented Dec 9, 2018

See that issue from rusty-machine.
So far, the following features are missing from nalgebra:

More element may be added to this list as I study the codebase of rusty-machine.

@sebcrozet sebcrozet added enhancement P-high High priority breaking change Fixing this issue, or merging this pull-request is likely to require breaking changes labels Dec 9, 2018
@sebcrozet sebcrozet self-assigned this Dec 9, 2018
@sebcrozet sebcrozet changed the title Add features required for the migrassion of rusty-machine to nalgebra Add features required for the migration of rusty-machine to nalgebra Dec 9, 2018
@sebcrozet sebcrozet added this to the v0.17 milestone Dec 9, 2018
@ralfbiedert
Copy link

Not sure if this belongs here, but I'm the author of ffsvm (a SVM classifier) and I also considered migrating to nalgebra for my math, and to simplify data exchange.

We use ffsvm in our company as a module in VR and gaming libraries, where literally every microsecond (and allocation) counts.

Right now there are 2 features missing in nalgebra that prevent me from making a switch. I generally believe they are essential for any performance sensitive SVM implementation; rusty-machine, ffsvm, or otherwise:

  • sparse vectors
  • properly aligned SIMD vectors

Sparse vectors are basically needed for high-dimensional SVMs, like word lists, where a vector might have +30k entries, out of which only very few are actually used. Using dense vectors here would be a big performance hit.

Conversely, for "fully dense" SVMs, properly aligned SIMD vectors are the way to go. When I started looking into ffsvm about a year ago I evolved the code from "naive" over "manual vectorization" to "actual SIMD":

perf

At least back then, there was a 2x speed difference between "trusting the compiler" and "do SIMD yourself". I wouldn't be surprised if that difference is up to >4x even today when considering various compiler flags, target platforms, ... On top of that (not properly reflected in the graph because the test vectors were so big) is a performance impact when dealing with unaligned SIMD data.

If I had to prioritize between these I'd pick SIMD over sparse vectors.

Long story short, I have seen you have tracking issues for these items already. However, I wanted to post this as more of a note that I would also love to align with rustsim / nalgebra, but those issues are holding me back.

@sebcrozet sebcrozet mentioned this issue Dec 11, 2018
4 tasks
@sebcrozet
Copy link
Member Author

@ralfbiedert Thank you for describing your needs and use-case! There is an increasing demand for SIMD and sparse vectors/matrices in nalgebra so those are the two big topics we will want to address in 2019. To help prioritize our work could you:

  • Provide in that issue details about the kind of operations you need on sparse vectors.
  • Provide in that issue details about the linear algebra operations you are using expensively in ffsvm. You seem to have a great deal of experience with SIMD, so we will greatly appreciate if you share any expertise about the best practices or even contribute to the nalgebra code if you which!

@sebcrozet sebcrozet modified the milestones: v0.17, v0.18 Feb 3, 2019
@sebcrozet sebcrozet modified the milestones: v0.18, v0.19 Mar 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Fixing this issue, or merging this pull-request is likely to require breaking changes enhancement P-high High priority
Projects
None yet
Development

No branches or pull requests

2 participants