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

Vitaly Davidovich vitalyd at gmail.com
Mon Jan 16 15:11:03 EST 2012


If your hash function is trivial, then this test is probably stressing the
memory interconnect more than anything else; all the cores are going to
compete for bus bandwidth to service memory fetches.

Can you try making your hash function more expensive compute wise? The
problem needs to become compute bound rather than memory bound ...
 On Jan 16, 2012 2:55 PM, "Yuheng Long" <csgzlong at iastate.edu> wrote:

> > I tried 10000000 elements in my machines, which takes about 4 seconds.
> I increase the size, which takes about 20 seconds (I assume/hope 20
> seconds
> is expensive enough),
> but still, using the withIndexedMapping, I got no benefits.
>
> Thank you.
>
> On Mon, Jan 16, 2012 at 1:50 PM, Yuheng Long <csgzlong at iastate.edu> wrote:
>
>> 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/4e809b60/attachment.html>


More information about the Concurrency-interest mailing list