Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
SFisGOD committed Aug 10, 2021
1 parent 029a0c2 commit 4e42257
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace {
int nbw[2][11] =
{
0,0, 0,0, 0,0, 0,0,0,0,0,
318, 6, 6,8250,192,95,147,232,1073,225,99
318, 600, 600,825,192,950,147,232,1073,225,990
};

TUNE(SetRange(-40,40), nw, nbw[0]);
Expand Down Expand Up @@ -482,12 +482,12 @@ void Thread::search() {
ft[n] = temp[n];
}

double fallingEval = (ft[0] + ft[1] * (mainThread->bestPreviousScore - bestValue)
+ ft[2] * (mainThread->iterValue[iterIdx] - bestValue)) / (ft[3] / 10.0);
double fallingEval = (ft[0] + (ft[1]/100.0) * (mainThread->bestPreviousScore - bestValue)
+ (ft[2]/100.0) * (mainThread->iterValue[iterIdx] - bestValue)) / (ft[3]/1.0);
fallingEval = std::clamp(fallingEval, 0.5, 1.5);

// If the bestMove is stable over several iterations, reduce time accordingly
timeReduction = lastBestMoveDepth + 9 < completedDepth ? ft[4]/100.0 : ft[5]/100.0;
timeReduction = lastBestMoveDepth + 9 < completedDepth ? ft[4]/100.0 : ft[5]/1000.0;
double reduction = (ft[6]/100.0 + mainThread->previousTimeReduction) / ((ft[7]/100.0) * timeReduction);

// Use part of the gained time from a previous stable move for the current move
Expand All @@ -496,7 +496,7 @@ void Thread::search() {
totBestMoveChanges += th->bestMoveChanges;
th->bestMoveChanges = 0;
}
double bestMoveInstability = ft[8]/1000.0 + std::max(1.0, ft[9]/100.0 - (ft[10]/10.0) / rootDepth)
double bestMoveInstability = ft[8]/1000.0 + std::max(1.0, ft[9]/100.0 - (ft[10]/100.0) / rootDepth)
* totBestMoveChanges / Threads.size();

double totalTime = Time.optimum() * fallingEval * reduction * bestMoveInstability;
Expand Down

11 comments on commit 4e42257

@ppigazzini
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SFisGOD my worker (WSL2 - gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) fails building this code in fishtest:

Step 1/4. Building instrumented executable ...
make ARCH=x86-64-modern COMP=gcc gcc-profile-make
make[1]: Entering directory '/home/usrft/fishtest/worker/tmpyc_cg84o/SFisGOD-Stockfish-4e42257/src'
make ARCH=x86-64-modern COMP=gcc \

g++ -DNNUE_EMBEDDING_OFF -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -Wall -Wcast-qual -fno-exceptions -std=c++17  -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto -Wall -Wcast-qual -fno-exceptions -std=c++17 -fprofile-generate=profdir -pedantic -Wextra -Wshadow -m64 -DUSE_PTHREADS -DNDEBUG -O3 -DIS_64BIT -msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2 -flto   -c -o thread.o thread.cpp
search.cpp: In member function ‘virtual void Stockfish::Thread::search()’:
search.cpp:485:55: error: ambiguous overload for ‘operator*’ (operand types are ‘double’ and ‘Stockfish::Value’)
  485 |           double fallingEval = (ft[0] + (ft[1]/100.0) * (mainThread->bestPreviousScore - bestValue)
      |                                         ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               |                                        |
      |                                               double                                   Stockfish::Value
search.cpp:485:55: note: candidate: ‘operator*(double, int)’ <built-in>
  485 |           double fallingEval = (ft[0] + (ft[1]/100.0) * (mainThread->bestPreviousScore - bestValue)
      |                                         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from evaluate.h:25,
                 from search.cpp:27:
types.h:317:13: note: candidate: ‘constexpr Stockfish::Value Stockfish::operator*(int, Stockfish::Value)’
  317 | constexpr T operator*(int i, T d) { return T(i * int(d)); }        \
      |             ^~~~~~~~
types.h:324:1: note: in expansion of macro ‘ENABLE_FULL_OPERATORS_ON’
  324 | ENABLE_FULL_OPERATORS_ON(Value)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
search.cpp:486:55: error: ambiguous overload for ‘operator*’ (operand types are ‘double’ and ‘Stockfish::Value’)
  486 |                                       + (ft[2]/100.0) * (mainThread->iterValue[iterIdx] - bestValue)) / (ft[3]/1.0);
      |                                         ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               |                                         |
      |                                               double                                    Stockfish::Value
search.cpp:486:55: note: candidate: ‘operator*(double, int)’ <built-in>
  486 |                                       + (ft[2]/100.0) * (mainThread->iterValue[iterIdx] - bestValue)) / (ft[3]/1.0);
      |                                         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from evaluate.h:25,
                 from search.cpp:27:
types.h:317:13: note: candidate: ‘constexpr Stockfish::Value Stockfish::operator*(int, Stockfish::Value)’
  317 | constexpr T operator*(int i, T d) { return T(i * int(d)); }        \
      |             ^~~~~~~~
types.h:324:1: note: in expansion of macro ‘ENABLE_FULL_OPERATORS_ON’
  324 | ENABLE_FULL_OPERATORS_ON(Value)
      | ^~~~~~~~~~~~~~~~~~~~~~~~

@ppigazzini
Copy link

@ppigazzini ppigazzini commented on 4e42257 Aug 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fishtest task has only Windows workers, see https://tests.stockfishchess.org/tests/view/61122d732a8a49ac5be79996

@SFisGOD
Copy link
Owner Author

@SFisGOD SFisGOD commented on 4e42257 Aug 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppigazzini Thanks for notifying me. I'll let it finish with just windows workers since the games played are already 541728/800000

@ppigazzini
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SFisGOD Linux workers download the code and fail the double building, this wastes some CPU, the test was set to prio -1.
Perhaps better to fix the bug and reschedule a new SPSA with new starting points.
Great work with SPSA optimization :)

@ppigazzini
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SFisGOD please lower the prio to -1 or, better, reschedule the test with the bug fixed.
We are working hard to squeeze the last bit of efficiency from fishtest, it's a pity to waste the CPU resources because a buggy code.

@SFisGOD
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppigazzini Okay I'll stop the test. Sorry for that.

@ppigazzini
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the branch for a while. I want to debug the worker (it should stop the task after an error in building) and the mingw building on Windows (I suspect some difference in flags wrt Linux).

@ppigazzini
Copy link

@ppigazzini ppigazzini commented on 4e42257 Aug 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your experience, is it more successful to run SPSA on the net parameters wrt other code parameters?

@SFisGOD
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppigazzini For checking purposes official-stockfish#3651

@SFisGOD
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppigazzini 7 successful checks now

@ppigazzini
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SFisGOD this official-stockfish#3671 should avoid the problem.

Please sign in to comment.