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

Christian Schulte cschulte at kth.se
Wed Nov 30 12:06:54 CET 2011


In which thread do you create the search engines? In the main thread or in
your slave threads?

It is pretty unlikely that this is buggy in Gecode as the parallel search
engines that come with Gecode do more or less what you do.

Cygwin is not a supported platform and we also have close to no experience
on FreeBSD. Use Windows, Mac, or Linux, there things should work.

BTW: There is no need to call status on a fresh clone.

Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of TeXitoi
Sent: Wednesday, November 30, 2011 12:00 PM
To: users at gecode.org
Subject: Re: [gecode-users] multiple non parallel search in different
threads

"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


_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list