Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Multithreading and how to use it

Author: Robert Hyatt

Date: 08:11:58 08/12/01

Go up one level in this thread


On August 12, 2001 at 09:06:02, Kim Roper Jensen wrote:

>I have made a little chess program with some very ordinary stuff, and would like
>to implement multiprocessing( i just recently bought a dual 1GHz with 2Gb of
>memory, its real cheap here in denmark it only costed approx $1000)
>
>But i wondered how do you guys implement it, i was thinking about having a pool
>of threads that the search could grab if there is some available, then it would
>be easy to test to see which amount of threads would be the most efficient and
>it could be adjusted easily.
>
>Or do you just have a finite amount of threads that you start at once ????


I do it this way, yes.  I did it like this in Cray Blitz and liked the overall
result.


>
>I just had some thoughts that maybe the amount of threads that would yield the
>best perfomance could change in the course of the game and it would be more
>efficient to adjust the poolsize of threads in the different stages of the game.


As a general rule, you never want more threads than cpus.  That causes context
switching and extra overhead, as well as intermittent delays when threads are
not running because of other threads preempting them.


>
>and how about having each thread using its own hashtable ?? This maybe sound
>silly but the we shouldnt check all kinds of things( is there another thread
>locking the table at the location etc.) maybe the there would be some small
>speed benefit( I mean, I read that implementing hashtables only gives approx. 70
>ratingpoints, so maybe it isnt so critical to use one big table)

Transpositions occur across searches done by different threads.  A global hash
table is best.  However, if you are not using a cluster, Crafty has a neat
non-locking hash table algorithm that eliminates any synchronization or errors
that might occur due to lack of locks.  If you are using message passing such
as MPI, PVM, etc, then shared hashing becomes more complicated, but still just
as important.




>
>just some thoughts ............
>
>(if it sounds really crazy, then it must be because its late and im tired :) )



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.