I have started parallel chess programming, focusing on YBWC algorithm. Have just read some papers and took a look at Viper code. I understand the main idea but still miss a lot of technique details which some of I ask here:
1) When copy data for a new thread, should I copy all history moves? I am trying to store board and some information with history moves so worry much about the copy amount. If yes, do you know any technique to reduce the copy (such as copy only from the last capture?)?
2) In Viper code, I see the code of search function which I confuse much looks like below:
Code: Select all
for (all moves) {
...
if (split(...))
break;
}
3) From my understanding, I write the following pseudo code for the main search function, (can someone correct me please?):
Code: Select all
for (all moves) {
if (move is illegal) continue;
makemove();
search(-beta, -alpha); // call recursive alphabeta
undomove();
/*
* Until here the search made at least one legal move, so we call split
* function to check if there any available thread. If yes, copy data for
* it and then wake it up to get help
*/
split();
// Not break, the main thread will continue as usual
}
/*
* At this point, the master thread ran out of moves, if there is any slave thread
* still working, the main thread will go to idle to wait. When slave threads
* complete their tasks, they will wake the master thread up. If there is no
* slave working, finish the search as usual
*/
if (there is any working slave thread)
goToIdleState();
/*
* Update hash table and return as usual here
*/
Pham