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

deprecate or improve @parallel for #19578

Closed
amitmurthy opened this issue Dec 13, 2016 · 19 comments
Closed

deprecate or improve @parallel for #19578

amitmurthy opened this issue Dec 13, 2016 · 19 comments
Assignees
Labels
needs decision A decision on this change is needed parallelism Parallel or distributed computation stdlib Julia's standard library

Comments

@amitmurthy
Copy link
Contributor

amitmurthy commented Dec 13, 2016

This issue is to debate changes to @parallel for, if any.

Options:

  1. Deprecate @parallel for - the syntax, while convenient, differs from a typical for loop w.r.t. the iterables that can be supported, local variables, error handling, etc. The unstated assumption that an @parallel for is just a for loop executed in parallel is not always correct. pmap with batching can be used in scenarios where @parallel for was previously used with the additional benefits of retrying on errors and elastic nodes (since pmap uses worker pools).

  2. Keep @parallel for with some changes
    a. Make the non-reducer case blocking by default. Today you need to prefix a @sync to detect errors which would otherwise be discarded silently. See Optimization to ALS-WR abhijithch/RecSys.jl#36 (comment).

    b. Generalize it to support more types of iterators

    c. Any other improvements?

@amitmurthy amitmurthy added the parallelism Parallel or distributed computation label Dec 13, 2016
@amitmurthy
Copy link
Contributor Author

cc: @andreasnoack

@amitmurthy amitmurthy added the needs decision A decision on this change is needed label Dec 13, 2016
@aviks
Copy link
Member

aviks commented Dec 13, 2016

I'd vote for keeping one paradigm that works well. So +1 to deprecate @parallel forand put all marketing behind pmap.

@andreasnoack
Copy link
Member

@parallel for has a proven track record of confusing people and, I think, with good reasons. It wants to pretend that it is a normal for loop - just parallel - but as @amitmurthy points out, the semantics are different. It is kind of misleading advertising to pretend that you can get parallelism just by annotating a for loop with a macro. It can easily go wrong and it often requires explanation so I think we'd be off with providing alternatives.

Our @parallel (op) for is a parallel (map)reduce underneath and the semantics are also similar to mapredure (the map is merged into the reduction operator). Therefore, I think it would be simpler to expose a parallel mapreduce. I don't think that users would expect to be able to update an array from the outer scope in a parallel mapreduce. In contrast, this is frequently happening in a @parallel for because it is a common pattern to update an array with a normal for loop.

@amitmurthy
Copy link
Contributor Author

Considering @ararslan changed his vote, it is currently 4 to 1 in favor of removing @parallel. However, given the low number of responses, I'll take the easy way out and push it up to @StefanKarpinski to take a call on this.

@amitmurthy amitmurthy added this to the 0.6.0 milestone Jan 5, 2017
@JeffBezanson
Copy link
Member

I agree with deprecating this. "Parallel for" syntax of some kind I think only makes sense with shared memory, since then there is at least hope of matching serial behavior. At the very least it would have to be renamed, since we have two forms of parallelism now.

Certainly the reducing form can be deprecated to parallel mapreduce. We already have most of the machinery there with the preduce function that the macro uses.

@amitmurthy
Copy link
Contributor Author

Now that you mention it, usage in the context of SharedArrays is most appropriate. Suggest we deprecate it for one cycle, and plan on moving it to SharedArrays (just the file for now, under SharedArrays module when we have it). The documentation can be updated right away to restrict its mention to SharedArrays only.

@StefanKarpinski
Copy link
Member

This doesn't seem quite ready or release blocking. Sorry, @amitmurthy!

@StefanKarpinski StefanKarpinski removed this from the 0.6.0 milestone Feb 2, 2017
@sbromberger
Copy link
Contributor

Please don't deprecate @parallel until we have an easy and performant replacement in pmap: #21940.

@andreasnoack andreasnoack added the triage This should be discussed on a triage call label Sep 28, 2017
@JeffBezanson JeffBezanson added this to the 1.0 milestone Sep 28, 2017
@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Sep 28, 2017
@JeffBezanson
Copy link
Member

We should sort out which names refer to distributed vs. shared memory for 1.0.

@StefanKarpinski StefanKarpinski added the stdlib Julia's standard library label Nov 20, 2017
@schnaitterm
Copy link

@parallel for looks, to me at least, to be almost identical to #pragma OMP PARALLEL FOR for OpenMP in C++, except that it looks like it's distributed instead of threaded?

@JeffBezanson
Copy link
Member

I suggest simply renaming @parallel to @distributed to get this out of the way for 1.0. Part of the stdlib now, but probably still should be taken care of quickly.

@mtcs
Copy link

mtcs commented Feb 8, 2018

Hi, I am a PhD student in parallel and distributed computing, and just recently found out about the effort of including native parallel and distributed support in the language. I think it is great.
I do agree that the naming for Julia's directives are a little confusing on what is local parallelism and what is distributed parallelism, as both have its advantages and drawbacks.

I do suggest though, that you keep distributed/parallel macros (OpenMP style) and functional programming map/reduce since they are part of two different programming styles. But I think that the reduce operation should be also handled by a specialization of the reduce function, a map_reduce function would be inconsistent.

I also think that using local parallelism, with co-routines or threads should be simpler and more straightforward then distributed parallelism because the need for local parallelism is much more common.

What I think I missed from multi-threading are critical sessions and atomic instructions. Do you intent to implementing them for 1.0?

@feierbach
Copy link

feierbach commented Oct 12, 2018

And the resolution is? neither @parallel nor @distributed seems to be present in 1.0.1 What happened?

@ararslan
Copy link
Member

It's called @distributed and it lives in the Distributed stdlib package since 0.7.

@feierbach
Copy link

Got it. Didn't realize I had to use 'using Distributed' to get it.
In 1.0.1 looks like I have to add many 'using' statements.

@schnaitterm
Copy link

In 1.0.1 looks like I have to add many 'using' statements.

1.0 Moved a lot of stuff out of base. The reasoning is discussed in the 1.0 release blog post.

@feierbach
Copy link

Thanks, schnaltterm, Lots of good info in those release notes.

@t-pollington
Copy link

Could it be possible to add help?> parallel and say it's deprecated? It's surprising how the term @parallel still exists in a lot of Julia forums and it's not immediately obvious to a newbie like me that it's in Distributed package as distributed().

Also just to share some user experience, my only shaky awareness of parallelism is through the ubiquitous par for from other languages. Going off of Julia pages, it took a while to decipher the 3/4 types of parallelism that Julia offers and figure out which of those was stable and for a single desktop CPU, ie Distributed. I was searching forever getting stuff about @parallel and reaching a dead end. Perhaps users landing on your parallel page could be steered more quickly to the right category through the use of the deprecated @parallel term that still exists in the ether!

@laborg
Copy link
Contributor

laborg commented Feb 14, 2022

I'll close this as the renaming to @distributed has happend quite some time ago. Given that depwarnings are off by default now and v0.7 can be used to find such deprecations I don't think a custom depwarning will be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs decision A decision on this change is needed parallelism Parallel or distributed computation stdlib Julia's standard library
Projects
None yet
Development

No branches or pull requests