Skip to content

Commit

Permalink
Check clock more often
Browse files Browse the repository at this point in the history
This patch changes the frequency with which the time is checked, changing
frequency from every 1024 counted nodes to every 512 counted nodes. The
master value was tuned for the old classical eval, the patch takes the
roughly 2x slowdown in nps with SFNNUEv7 into account. This could reduce
a bit the losses on time on fishtest, but they are probably unrelated.

passed STC:
https://tests.stockfishchess.org/tests/view/64bb8ae5dc56e1650abb1b11
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 76576 W: 19677 L: 19501 D: 37398
Ptnml(0-2): 274, 8592, 20396, 8736, 290

closes #4704

No functional change
  • Loading branch information
vondele authored and snicolet committed Jul 23, 2023
1 parent 5ea1cbc commit 4b29797
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ void MainThread::check_time() {
return;

// When using nodes, ensure checking rate is not lower than 0.1% of nodes
callsCnt = Limits.nodes ? std::min(1024, int(Limits.nodes / 1024)) : 1024;
callsCnt = Limits.nodes ? std::min(512, int(Limits.nodes / 1024)) : 512;

static TimePoint lastInfoTime = now();

Expand All @@ -1845,7 +1845,7 @@ void MainThread::check_time() {
if (ponder)
return;

if ( (Limits.use_time_management() && (elapsed > Time.maximum() - 10 || stopOnPonderhit))
if ( (Limits.use_time_management() && (elapsed > Time.maximum() || stopOnPonderhit))
|| (Limits.movetime && elapsed >= Limits.movetime)
|| (Limits.nodes && Threads.nodes_searched() >= (uint64_t)Limits.nodes))
Threads.stop = true;
Expand Down
2 changes: 1 addition & 1 deletion src/timeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void TimeManagement::init(Search::LimitsType& limits, Color us, int ply) {

// Never use more than 80% of the available time for this move
optimumTime = TimePoint(optScale * timeLeft);
maximumTime = TimePoint(std::min(0.8 * limits.time[us] - moveOverhead, maxScale * optimumTime));
maximumTime = TimePoint(std::min(0.8 * limits.time[us] - moveOverhead, maxScale * optimumTime)) - 10;

if (Options["Ponder"])
optimumTime += optimumTime / 4;
Expand Down

0 comments on commit 4b29797

Please sign in to comment.