Skip to content

Commit

Permalink
- bench 1スレdepth指定で毎回探索ノード数が異なる件、修正。
Browse files Browse the repository at this point in the history
 やねうらお — 今日 07:24
 benchコマンドで探索node数が一致しない原因が一瞬で判明した。

 なんと、PV出力の時に局面を進めるためにdo_moveしているのだが、それによりnode数が加算されてるからであった。benchコマンドでは
 置換表を漁らないようにするなどの対策が必要であることがわかった。
  • Loading branch information
yaneurao committed Oct 29, 2023
1 parent f3ef7be commit e22387c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/testcmd/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ void bench_cmd(Position& current, istringstream& is)
// Optionsの影響を受けると嫌なので、その他の条件を固定しておく。
limits.enteringKingRule = EKR_NONE;

// ConsiderationModeをオフにしておかないとPV出力の時に置換表を漁るのでその時にdo_move()をして
// 探索ノード数が加算されてしまい、depth固定のbenchなのに探索ノード数が変化することがある。
Options["ConsiderationMode"] = false;

// テスト用の局面
// "default"=デフォルトの局面、"current"=現在の局面、それ以外 = ファイル名とみなしてそのsfenファイルを読み込む
if (fenFile == "default")
Expand All @@ -148,10 +152,12 @@ void bench_cmd(Position& current, istringstream& is)
SystemIO::ReadAllLines(fenFile, fens);

// 評価関数の読み込み等
is_ready();
//
// 備考)
// is_ready()でSearch::clear()が呼び出されて、やねうら王探索部のSearch::clear()でTT::clear()と、Thread::clear()が呼び出されて、
// そのなかでhistory tableなどすべてのテーブルがクリアされることは保証されている。

// TT.clear();
// → is_ready()のなかでsearch::clear()が呼び出されて、そのなかでTT.clear()しているのでこの初期化は不要。
is_ready();

// トータルの探索したノード数
#if !defined(YANEURAOU_ENGINE_DEEP)
Expand Down

0 comments on commit e22387c

Please sign in to comment.