-
Notifications
You must be signed in to change notification settings - Fork 113
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
Parallel version of random walks #172
Conversation
👋 @Kostas-Pallikaris what is the status of this PR? Is it ready for review? |
Codecov Report
@@ Coverage Diff @@
## develop #172 +/- ##
========================================
Coverage 55.44% 55.44%
========================================
Files 85 85
Lines 4801 4801
Branches 2111 2111
========================================
Hits 2662 2662
Misses 889 889
Partials 1250 1250
|
@Kostas-Pallikaris, thanks for the revised version! |
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.
Thanks for this PR!
I have some comments.
I would also suggest to include all walks in one file in include/random_walks
e.g. multithread_walks.hpp
.
It would be very useful to add an example that uses the new functionality as a use case.
|
||
omp_set_num_threads(num_threads); | ||
unsigned int jj = 0, d= P.dimension(), m = P.num_of_hyperplanes; | ||
std::vector<int> num_points_per_thread(num_threads, 0); |
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.
What about this
std::vector<int> num_points_per_thread(rnum%num_threads, rnum/num_threads+1);
std::vector<int> a(num_threads - rnum%num_threads, rnum/num_threads);
num_points_per_thread.insert(num_points_per_thread.end(), a.begin(), a.end());
instead of the double loop? Seems simpler and more efficient.
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.
Thank you @vissarion. I've implemented this.
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.
I am ok with merging now. Thanks!
I have one more minor comment
}; | ||
|
||
template <> | ||
struct policy_storing<BCDHRWalk_multithread> |
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.
you do not have to repeat it here, just inherit the method from policy_storing<BRDHRWalk_multithread>
i.e.
template <>
struct policy_storing<BCDHRWalk_multithread> : policy_storing<BRDHRWalk_multithread>
{}
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.
Thank you @vissarion. I've implemented this change.
This PR provides multi-threaded version for the following random walks:
The interface is written in C++ and uses the library
openmp
.