-
Notifications
You must be signed in to change notification settings - Fork 185
Conversation
Codecov Report
@@ Coverage Diff @@
## master #960 +/- ##
==========================================
+ Coverage 99.85% 99.85% +<.01%
==========================================
Files 78 79 +1
Lines 2669 2677 +8
==========================================
+ Hits 2665 2673 +8
Misses 4 4 |
@SohamTamba This should work for now but how about doing it in a distributed way? You might get a better performance using |
This issue with I tried using
|
ok! |
@sbromberger Can you please review it? |
I'll make the change in |
@somil55 For Ego Twitter graph which has 80,000 vertices, the threaded implementation has the same run time as the distributed implementation when The run-time of the distributed increases because the graph has to be copied in every process. Benefit of distributed: The code will be more memory efficient since the processes don't share memory. Disadvantage of distributed: Each process must copy the graph, increasing run-time. I think the threaded implementation would be better because it seems unlikely for Let me know if you want me to PR the distributed implementation. |
@SohamTamba In that case, threaded version seems more practical. What do you think @sbromberger? |
Why not both with a kwarg in a wrapper function? |
That makes sense.
|
34aa568
to
106f08c
Compare
@sbromberger Btw it turns out |
src/utils.jl
Outdated
@@ -61,8 +61,29 @@ end | |||
generate_min_set(g, gen_func, Reps) | |||
Generate a vector `Reps` times using `gen_func(g)` and return the vector with the least elements. | |||
""" | |||
generate_min_set(g::AbstractGraph{T}, gen_func, Reps::Integer) where T<: Integer = | |||
mapreduce(gen_func, (x, y)->length(x)<length(y) ? x : y, Iterators.repeated(g, Reps)) | |||
function generate_min_set(g::AbstractGraph{T}, gen_func::Function, Reps::Integer) where T<: Integer |
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.
why is Reps
capitalized? Afaik we don't do that anywhere else.
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.
That is the convention I had noticed online.
I can change it to reps
instead.
src/utils.jl
Outdated
""" | ||
generate_min_set(g, gen_func, Reps) | ||
generate_min_set(g, gen_func, Reps; parallel=:threads) |
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.
Why is Reps
capitalized? AFAIK we don't do that anywhere else for variables greater than 1 or 2 chars.
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.
Also, with the new Parallel
module, this should probably go into Parallel/utils.jl
.
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've included it in the parallel module.
Should I replace the implementation using mapreduce
from the sequential model?
106f08c
to
d61238b
Compare
I was just thinking, |
On another note, I noticed I tested Should I create a separate PR to fix it? |
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.
Looks good but would prefer a variable rename so that all non-struct vars are lower case.
src/Parallel/utils.jl
Outdated
""" | ||
generate_min_set(g, gen_func, Reps; parallel=:threads) | ||
|
||
Generate a vector `Reps` times using `gen_func(g)` and return the vector with the least elements. |
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.
This is so minor, but it bothers me: can we make sure standard variables are lower case?
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.
Yeah.
I thought I had done that.
Must be an issue from rebasing.
665fdaa
to
fed0aaf
Compare
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.
Looks great. Thanks!
…r#984) * Fix kruskal_mst for working with abstract graphs * Remove abstract edge type in kruskal * Fix edgetype
We will probably want to move this into SimpleGraphs at some point, but until then, I think this is good.
* attempt 32-bit compatibility * don't allow downsampling to Int32: introduces accuracy bugs * add 0.7 and nightly tests * allow integers in betweenness centrality * attempt to fix parallel 32-bit * work around splitrange issue * Revert "work around splitrange issue" This reverts commit 58cbcf8. * splitrange overload
* Add simple_cycles_limited_length. * Revisions after review comments. Merging because it looks like codecov is hung up.
Fix zenodo error
* OneTo * fixes reverse (sbromberger#994) We will probably want to move this into SimpleGraphs at some point, but until then, I think this is good. * Lots more doctests (sbromberger#995) * SimpleGraph(SimpleGraph) plus tests. (sbromberger#998) * added documentation for SimpleGraph and SimpleDiGraph constructors (sbromberger#1001) * fixes edgeiter equality (sbromberger#1002) * 32-bit compatibility (sbromberger#999) * attempt 32-bit compatibility * don't allow downsampling to Int32: introduces accuracy bugs * add 0.7 and nightly tests * allow integers in betweenness centrality * attempt to fix parallel 32-bit * work around splitrange issue * Revert "work around splitrange issue" This reverts commit 58cbcf8. * splitrange overload * MultiThreaded Centrality Measures Implementations (sbromberger#987) * misc doc fixes (sbromberger#1003) * Fix sbromberger#999 (sbromberger#1004) * Parallel BFS Generate Reduce
mapreduce
expects other processors to have access to data.Otherwise, it executes sequentially.
I used
@threads
instead to run it in parallel.cc @somil55