[concurrency-interest] Problem getting any speed up in using the withIndexedMapping method in the ParallelArray class

erkin.kanlioglu at gmail.com erkin.kanlioglu at gmail.com
Mon Jan 16 14:38:07 EST 2012


Is there any guideline(rough) how compute dependent an operation should be to get benefit from ParallelArray ?

Creating ParallelArray<int[]> (int[2^21][16]) vs ParallelArray<Integer> for pure a function like hashing gave 10x boost in my local for array size 2^25.



On 16 Jan 2012, at 19:00, Vitaly Davidovich <vitalyd at gmail.com> wrote:

> Hashing integers in a linearly-traversed array is going to be pretty quick even on a single core (unless your hash function does something expensive); for parallel to give you benefit, you may have to throw more work at the problem.  How large is the int array that you're scanning?
> 
> On Mon, Jan 16, 2012 at 9:59 AM, Yuheng Long <csgzlong at iastate.edu> wrote:
> To whom it concerns,
>           I tried to parallelize a for loop these days which iterates the elements (Integer) of an array and applies a pure hash function on each of the elements
> and substitute the original elements with the results.
>           So I used the withIndexedMapping method in the ParallelArray class to parallelize the code.
>           I try both my 4 cores and my 24 cores machines. I did not get any speedup.
>           The code snippet is listed below. Would you please tell me what I did wrong or explain why I did not get any speedup in the implementation at all?
>           I would like to send out the complete code if necessary. Thank you.
> 
> Hash h = new Hash();
> ForkJoinPool fjp = new ForkJoinPool();
> ParallelArray<Integer> pa = ParallelArray.createUsingHandoff(elementData, fjp);
> pa.replaceWithMappedIndex(h);               
> 
> public class Hash implements Ops.IntAndObjectToObject<Integer, Integer> {
>    public Integer op (int index, Integer o) {
>         int key = o;
>         /* key = the hash computation code */
>         return key;
>    }
> }
> 
> Thank you very much,
> Sincerely,
> Yuheng
> 
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> 
> 
> 
> 
> -- 
> Vitaly
> 617-548-7007 (mobile)
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120116/007f3fa1/attachment.html>


More information about the Concurrency-interest mailing list