[gecode-users] multiple non parallel search in different threads

TeXitoi texitoi+news at texitoi.eu
Wed Nov 30 11:59:56 CET 2011


"Christian Schulte" <cschulte at kth.se> writes:

> Hi,
> 
> You should first try to make independent clones so that you can use them
> with different threads:
> 
> a) Suppose you have a space s.
> b) You compute the fixpoint by s->status(). If s->status() return SS_FAILED
> you are done.
> c) Create two clones c1 and c2 by c1 = s->clone(false) and c2 =
> s->clone(false).

I have added a method that is :

MySpace *MySpace::safeClone()
{
    if (status() != SS_FAILED) {
        MySpace *that = static_cast<MySpace*>(clone(false));
        that->status();
        return that;
    } else return 0;
}

and do every clone with it.

> d) Now you can use c1 and c2 in two different threads with the normal DFS
> engines.

If I understand correctly, my code should work, but it doesn't.

I'll try on linux to see if I can reproduce it (tested on OpenBSD and
Cygwin, I do not have a big confidence on threads on these platforms).
And if I can, I'll try to write a small example showing the problem.

-- 
Guillaume Pinot                               http://www.texitoi.eu

« Il semble que la perfection soit atteinte non quand il n'y a plus
rien à ajouter, mais quand il n'y a plus rien à retrancher. »
                      -- Antoine de Saint-Exupéry, Terre des hommes

()  ASCII ribbon campaign      -- Against HTML e-mail
/\  http://www.asciiribbon.org -- Against proprietary attachments




More information about the users mailing list