-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Support parallelizing over collections that have non-Int lengths #28651
Conversation
Changes `splitrange` to use `Integer` instead of `Int` so that mixed-width ints can be used. This fixes the following LightGraphs issue on 32-bit machines: ``` julia> g = Graph(10,20) {10, 20} undirected simple Int32 graph julia> Parallel.stress_centrality(g); julia> g = Graph{Int64}(g) {10, 20} undirected simple Int64 graph julia> Parallel.stress_centrality(g); ERROR: MethodError: no method matching splitrange(::Int64, ::Int32) Closest candidates are: splitrange(::Int32, ::Int32) at /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.0/Distributed/src/macros.jl:235 ```
@pfitzseb on Slack (I agree wholeheartedly):
|
A slightly better fix is to change the calls to |
@JeffBezanson - ref #28652. Thank you. |
I'll leave it to someone else to decide, then. My #28652 alternative was closed (I disagree with the closure, but whatever). In any rate, I've fixed it locally. |
Gah. Didn't mean to close this. What path do we want to take? |
update per @jeffbezansons' suggestions
Ping on this - any chance it could be merged soon? This fixes LightGraphs on 32-bit machines. |
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, would be great to have a test though.
Bump for test and this can be merged. |
|
Check the branch out locally or go to https://github.com/sbromberger/julia/tree/patch-1 and edit with GitHub. |
added test.
Moved to before `addprocs` since we don't need remote workers for the `splitrange` test.
This test doesn't test what was implemented (and thus fails). |
@@ -15,6 +15,11 @@ include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl")) | |||
1 | |||
end | |||
|
|||
# PR #28651 |
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.
Maybe
for T in (Int64, Int128)
n = @distributed (+) for i in Base.OneTo(T(10))
i
end
@test n == 55
end
This only happens whenever length
returns something that is not an Int
which is relatively rare.
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.
Yep. I had something written out last night but yours is simpler. Thanks.
Yup. The test was for the "old" fix. Sorry 'bout that. I've just pushed new tests (hat tip: @andreasnoack) that hopefully will work. |
Thanks Seth! Note to whoever merges this, please do a squash merge. |
It'd be better for my reputation if you did a fixup instead, but I'll take a squash :) |
The commit messages can be modified when squashing so all traces of Github editing can be removed ;) |
Travis failure is OSX-only and seems to be unrelated:
|
Changes
splitrange
to useInteger
instead ofInt
so that mixed-width ints can be used. This fixes the following LightGraphs issue on 32-bit machines: