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

Yuheng Long csgzlong at iastate.edu
Mon Jan 16 14:50:34 EST 2012


Hi Vitaly,

Well, I agree it may not be that expensive, but if it this operation/logic
in the system and it is done many many time,
perhaps, you still want to parallelize it, do not you?

> for parallel to give you benefit, you may have to throw more work at the
problem
What do you mean by "you may have to throw more work at the problem".
Would you elaborate, please? What are the problems here?

I tried 10000000 elements in my machines, which takes about 4 seconds.
According to my experience, benchmarks/operations that take more than a
second,
it becomes easier to parallelize (I mean simple parallelization code does
show relatively good speedups.)

Thank you very much,
Sincerely,
Yuheng


On Mon, Jan 16, 2012 at 1:00 PM, 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)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120116/23f2b4fe/attachment-0001.html>


More information about the Concurrency-interest mailing list