Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: And now something completely different: Multithreading

Author: Robert Hyatt

Date: 08:14:24 12/03/03

Go up one level in this thread


On December 03, 2003 at 03:05:03, Tony Werten wrote:

>On December 02, 2003 at 04:19:24, Gian-Carlo Pascutto wrote:
>
>>On December 01, 2003 at 02:41:28, Tony Werten wrote:
>>
>>>When my masterthread is spinning, waiting for results from it's workers >threads, how do I keep it from burning CPU time ?
>>
>>Turn it into a worker thread.
>
>Brilliant !
>
>And then not having a masterthread hand out moves, but have the worker threads
>pick moves themselves from "some global structure" ?

:)

That is why Crafty always starts exactly N-1 threads on an N processor box.
The original thread plus the new N-1 are just enough to keep all 4
processors busy.  The data structures are a bit messy, because you reach
a point where there are no more moves at some point, and processors have
to go to work somewhere else as they finish.  And the _original_ process
has to be the one to "return" if you are using are using a recursive search,
of course.

But I do that and it has worked just fine for years.

>
>And then have only the "master thread" return a score in the search (upwards
>that is) and have the worker just "disconnect" and reconnect at another movelist
>in the global structure ?

Yes...
I call those "reconnects" "split points".

>
>I think I'm starting to see the picture now.
>
>A "master" thread filling an array index by depth wich contains all the moves
>from that depth and a flag SHAREABLE (or not). Then the workers pick moves (
>preferably as high as possible) and  post result ( if important)

I would not go with the global stuff.  You have to stop and think why.  IE
at ply=5, two processors split.  No problem.  But now processor 1 wants
to split at ply=7 with processor 3, while processor 2 wants to split at
ply=7 with processor 4.  note that 1 and 2 are the ones splitting at ply=5.

A global structure will not allow that.


>
>Tony
>
>>
>>--
>>GCP



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.