David Chase | 7 Jul 02:34
Favicon

Re: Parallel vs. sequential loops


On 2008-07-06, at 5:29 PM, Jon Harrop wrote:
>
> Exactly. The "best" subdivision must be guided by cost information  
> and these
> naive parallel "for" loops fail to convey any such information. So the
> subdivision is completely naive and, consequently, the only parallel
> construct that has been discussed here so far will silently introduce
> catastrophic performance degradation into user code when they least  
> expect
> it.

Just checking, but you do understand that if I write

   for i <- a.indices do
      ... something with a[i] ...
   end

that the subdivision chosen is "best" for access to a, because
it is chosen by a?

When you say "naive", is that what you are talking about?
In practice (from the talks I've seen) even truly naive recursive
subdivision is substantially better than "catastrophic".  Plain
old count-from-the-beginning iteration, that's what I call  
"catastrophic".

Yes, there are still problems to solve, but I want to be sure that we
understand each other.

And, if you do think that this is "catastrophic" even for the example
I provide above, what would YOU write?  Can you figure out a way to do
it that still resembles "what a mathematician would write"?

David


Gmane