[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 09:59:34 EST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120116/13701078/attachment.html>


More information about the Concurrency-interest mailing list