-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: optimize compute_inner_product with parallel computation #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use rayon sum
instead for better performance.
@jonathanpwang this one is alright? |
your last commit seems to be empty |
@jonathanpwang I dunno what's wrong with the previous one, but now it seems to be all alright |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Lints broken |
@jonathanpwang |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to include rayon = 1.8 in Cargo.toml
I will just merge and fix in followup
Description:
This PR optimizes the
compute_inner_product
function by implementing parallel computation for large vectors while maintaining efficient sequential computation for small ones.Changes:
The optimization uses the existing
parallelize
infrastructure to split the computation into chunks and process them in parallel, which should improve performance for large vectors while maintaining efficiency for smaller ones.Tests:
This change maintains backward compatibility and follows the project's coding style.