Fix search result aggregation

This reverts my earlier change that only the root node gets to output best move after fixing problem with MPI_Allreduce by our custom operator(BestMoveOp). This function is not commutable and we must ensure that its output is consistent among all nodes.
This commit is contained in:
noobpwnftw
2018-07-13 16:51:26 +08:00
committed by Stéphane Nicolet
parent 8a95d269eb
commit 2405b38165
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -58,8 +58,8 @@ static void BestMove(void* in, void* inout, int* len, MPI_Datatype* datatype) {
MoveInfo* r = static_cast<MoveInfo*>(inout);
for (int i=0; i < *len; ++i)
{
if ( l[i].depth > r[i].depth
&& (l[i].score >= r[i].score || l[i].score >= VALUE_MATE_IN_MAX_PLY))
if ( (l[i].depth > r[i].depth || (l[i].depth == r[i].depth && l[i].rank < r[i].rank))
&& (l[i].score >= r[i].score))
r[i] = l[i];
}
}
@@ -102,7 +102,7 @@ void init() {
MPI_Type_create_hindexed_block(3, 1, MIdisps.data(), MPI_INT, &MIDatatype);
MPI_Type_commit(&MIDatatype);
MPI_Op_create(BestMove, true, &BestMoveOp);
MPI_Op_create(BestMove, false, &BestMoveOp);
MPI_Comm_dup(MPI_COMM_WORLD, &InputComm);
MPI_Comm_dup(MPI_COMM_WORLD, &TTComm);