Skip to content
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

reorder pmap arguments to allow do-block syntax #26783

Merged
merged 2 commits into from
Apr 12, 2018

Conversation

mweastwood
Copy link
Contributor

This fixes #26684

Now you can do something like:

julia> using Distributed

julia> addprocs(4)
4-element Array{Int64,1}:
 2
 3
 4
 5

julia> pmap(WorkerPool([2, 3, 4]), 1:10) do x
           myid()
       end
10-element Array{Int64,1}:
 2
 3
 4
 3
 2
 4
 3
 2
 4
 3

I wasn't entirely sure where I should put the deprecations, so I put them near the pmap definition, but happy to move them if there's a better location.

pmap(f, c1, c...; kwargs...) = pmap(a->f(a...), zip(c1, c...); kwargs...)

@deprecate pmap(p::AbstractWorkerPool, f, c; kwargs...) pmap(f, p, c; kwargs...)
@deprecate pmap(p::AbstractWorkerPool, f, c1, c...; kwargs...) pmap(f, p, c1, c...; kwargs...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should go in base/deprecated.jl near the bottom with a reference to the issue this closes. Other entries in that file should provide a decent example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was confused because this is an stdlib package. Do those deprecations still live in base/deprecated.jl?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're absolutely right, sorry about that, I had forgotten that pmap moved to the stdlib. In that case it looks like other Distributed deprecations are done in stdlib/Distributed/src/Distributed.jl near the bottom.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries! Just pushed another commit that moves them to Distributed.jl

@ararslan ararslan added parallelism Parallel or distributed computation deprecation This change introduces or involves a deprecation labels Apr 12, 2018
Copy link
Member

@ararslan ararslan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@JeffBezanson JeffBezanson added the triage This should be discussed on a triage call label Apr 12, 2018
@StefanKarpinski StefanKarpinski removed the triage This should be discussed on a triage call label Apr 12, 2018
@StefanKarpinski StefanKarpinski added this to the 1.0 milestone Apr 12, 2018
@JeffBezanson JeffBezanson merged commit 4131580 into JuliaLang:master Apr 12, 2018
@mweastwood mweastwood deleted the pmap-do-block-syntax branch April 12, 2018 20:20
mbauman added a commit that referenced this pull request Apr 12, 2018
* origin/master:
  A few more #26670 fixes (#26773)
  Revert "deprecate using the value of `.=`. fixes #25954" (#26754)
  change dim arguments for `diff` and `unique` to keyword args (#26776)
  reorder pmap arguments to allow do-block syntax (#26783)
  correct deprecated parametric method syntax (#26789)
  [NewOptimizer] handle new IR nodes correctly in binary format
  [NewOptimizer] support line number emission from new IR format
  fix #26453, require obviously-concrete lower bound for a var to be diagonal (#26567)
  fix #26743, spurious `return` path in try-finally in tail position (#26753)
  Also lift SelectInst addrspaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation parallelism Parallel or distributed computation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pmap argument order does not allow for do-block syntax
4 participants