-
Notifications
You must be signed in to change notification settings - Fork 27
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
Rust query modules with parallelisation #328
Comments
@risufaj very nice module / issue 😃 Thanks for pinging! Yes, Rust API is not as polished as C/C++, but there is a plan to improve it, this will help 💪 I'll try to deep-dive in the following days, in the meantime, if you have some suggestions on the API side, feel free to dump them here or make a new PR with the improvements 👀 |
There are definitely workarounds. For example, in my use case, I'm practically doing random walks as an approximations for personalized pagerank. Then, it is enough to calculate the neighbors for each node and store this information in a HashMap for instance, and use rayon to paralellize the loops over those. This is very likely not optimized, but I just tried it today to show that it works. Also, from what I understand, something similar to this is done for the C++ implementation of pagerank. However, it makes sense to have a better and more general solution, that also doesn't require to first go over the whole graph and then do what you need to do every time the query module is called. I know I'm not proposing anything concrete yet, but we'll get there. |
@risufaj I've put your code into the #336 PR and made it compilable with the It's not a huge priority for me now, but I'll try to figure out / implement thread safety in the following days/weeks. If you have any suggestions, just put them here or contribute directly to the PR 😃 |
Thank you @gitbuda |
Hello,
I've been trying to develop a query module in rust that tries to parallelize some loops using the rayon library. The parallelization loops involve accessing nodes and edges. However, I get this error :
G cannot be shared between threads
safely where G is a MemgraphGraph object. I've seen that some of the query modules in C++ have parallelisation, but I haven't been able to find anything for rust.Here is some code to reproduce this.
Cargo.toml
The src folder contains these files:
lib.rs
example.rs
Any help on how to move this forward would be great.
The text was updated successfully, but these errors were encountered: