Smp concepts

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
Posts: 782
Joined: Mon Dec 15, 2008 10:45 am

Re: Smp concepts

Post by Desperado » Thu Jun 05, 2014 7:46 pm

call stack

Well, i agree that playing out the path is not like playing out the uci movelist section and to start a search.
Second, i really underestimated this point. I realized it while walking from work to the hotel, i had
half an hour to think about it on fresh air. It is still to do.

Let's say we have a PathData structure which may look like this:

Code: Select all

struct PathData
  Movelist ml;
  search_t s;
  int movelistNumber;
  int terminateAtPly;
  SplitpointData* pSplitpointData;

1. Step

Now, Thread B hooks in and copies the PathData from another thread to the depth where it wants
to start. Outplaying the moves with the current movelistNumber. If we have m1...mN...mX Thread B is
interested in mN...mX. ( at each PathData )

2. Step

Outplaying the moves has to be done over search calls of course. Thread B is doing the following.

Code: Select all

Ply  0: WHILEMOVES(PathData[Thread B][ 0].ml.GetMove()) { playMove(); search[s]() ; undoMove(); } // start with movelistNumber
Ply  1: WHILEMOVES(PathData[Thread B][ 1].ml.GetMove()) { playMove(); search[s]() ; undoMove(); } // start with movelistNumber
Ply  2: WHILEMOVES(PathData[Thread B][ 2].ml.GetMove()) { playMove(); search[s]() ; undoMove(); } // start with movelistNumber
Ply 10: WHILEMOVES(PathData[Thread B][10].ml.GetMove()) { playMove(); search[s]() ; undoMove(); } // start with movelistNumber
The parameter s indicates a call to a singleThreadedSearch / SplitSearch.
The moves are outplayed. The call stack is built. Now Thread B is ready to go.
References to SplitpointData are valid because it is global data. Some further settings can / must be done.
Please don't nail me down to some details about data organisation / settings. That is certainly all doable and all this
is appearing from nowhere while i am writing this.

3. Step

Code: Select all

PathData[Thread A].terminateAtPly = 10;
This is possible now too. If Thread a now is back to ply 10 it will be stopped.
This stopping works like any other stop mechanism. Just stop searching.
Are you realizing that i did not mention at which ply Thread A currently is. Because it doesn't matter.
Yes, at least at ply 10, because we copied the the PathData from it. But it can be anywhere between 10...MAXPLY.
Of course we need to take care that Thread a is not slipping away ( finishs the ply where we want to hook in ).

But anyway, that all looks to complicate to me, even if it might work, i guess there is not enough profit for such complexity.

However, still to manage.

Post Reply