Parallelizing a serial algorithm

Posted by user643813 on Stack Overflow See other posts from Stack Overflow or by user643813
Published on 2012-05-02T15:11:05Z Indexed on 2012/05/31 22:40 UTC
Read the original article Hit count: 179

Hej folks,

I am working on porting a Text mining/Natural language application from single-core to a Map-Reduce style system. One of the steps involves a while loop similar to this:

Queue<Element>;

while (!queue.empty()) {
    Element e = queue.next();
    Set<Element> result = calculateResultSet(e);

    if (!result.empty()) {
        queue.addAll(result);
    }
}

Each iteration depends on the result of the one before (kind of). There is no way of determining the number of iterations this loop will have to perform.

Is there a way of parallelizing a serial algorithm such as this one? I am trying to think of a feedback mechanism, that is able to provide its own input, but how would one go about parallelizing it?

Thanks for any help/remarks

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about mapreduce