Author: Daniel Shawul
Date: 19:40:48 11/18/04
Go up one level in this thread
On November 18, 2004 at 07:58:01, Anthony Cozzie wrote:
>On November 18, 2004 at 07:36:58, Daniel Shawul wrote:
>
>>i have made a wrapper class for the lock/unlock operations
>>that i do at a struct SPLIT.
>>SPLIT
>>{
>> //HANDLE lock;
>> CRITICAL_SECTION cs;
>> other data...
>>}
>> At codeguru site i read that critical sections are faster than
>>mutexes.But for me they are *very very slower*. I am sure i am doing something
>>wrong but don't know what?
>>Another question is how profitable is using methods like InterLockedExchange,
>>i mean going low level, for SMP chess engines?
>>
>>SPLIT::SPLIT()
>>{
>> //lock = CreateMutex(NULL,0,NULL);
>> InitializeCriticalSection(& cs);
>>}
>>SPLIT::~SPLIT()
>>{
>> //CloseHandle();
>> DeleteCriticalSection(& cs);
>>}
>>SPLIT::Lock()
>>{
>> //WaitForSingleObject(lock,INFINITE);
>> EnterCriticalSection(& cs);
>>}
>>SPLIT::UnLock()
>>{
>> //ReleaseMutex(lock);
>> LeaveCriticalSection(& cs);
>>}
>>
>>best
>>daniel
>
>You want a spinlock, not a mutex/semaphore/criticalsection/other OS trick.
>Split is supposed to be _cheap_. If you block on a critical section, the
>processor may put your process into the idle queue and run something else.
>
>Read my other post. You need to spend a few weeks 1) looking over the Crafty
>code 2) reading the DTS paper 3) _thinking_ about your design and how you want
>it to work and under what circumstances (2? 4? 8? 500? processors). IMHO,
>writing a parallel chess program is one of _the toughest_ programming tasks out
>there, and you are seriously underestimating it. I spent probably 6 weeks just
>designing - and I threw out at least 10 designs - before I settled on what I
>have. Then I spent 2 weeks implementing, and I'm still working races out of the
>system 6 months later (it crashes once every few days right now). And this is
>on only two processors!
>
I am not underestimating parallel search. IMO it seems to me you are over-
estimating it :) I have already finished implementing abdada,and another type of
splitting that Scott Gasch described to me very well in email. He also gave me a
lot of advice how I should do each thing step by step. However bad it is,i have
something which can generate n threads in parallel and search in parallel.
Problem is how to optimize it and that i will do in time.
About studying crafty code, so far i haven't but someday i will when i want
my parallel search to be more advanced.
daniel
p.s: your comment is really frustrating but..
>anthony
This page took 0.01 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.