From ca6cb4e6c72b230baa265b25a1758ff1d8e2d1d3 Mon Sep 17 00:00:00 2001 From: David Wu Date: Sun, 10 May 2020 19:30:28 +0000 Subject: [PATCH] Also have analysis log to dir --- cpp/command/analysis.cpp | 13 ++++++++++++- cpp/configs/analysis_example.cfg | 11 ++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cpp/command/analysis.cpp b/cpp/command/analysis.cpp index 93f22e32e..841a70b97 100644 --- a/cpp/command/analysis.cpp +++ b/cpp/command/analysis.cpp @@ -1,6 +1,8 @@ #include "../core/global.h" #include "../core/config_parser.h" #include "../core/timer.h" +#include "../core/datetime.h" +#include "../core/makedir.h" #include "../search/asyncbot.h" #include "../program/setup.h" #include "../program/playutils.h" @@ -67,7 +69,16 @@ int MainCmds::analysis(int argc, const char* const* argv) { } Logger logger; - logger.addFile(cfg.getString("logFile")); + if(cfg.contains("logFile") && cfg.contains("logDir")) + throw StringError("Cannot specify both logFile and logDir in config"); + else if(cfg.contains("logFile")) + logger.addFile(cfg.getString("logFile")); + else { + MakeDir::make(cfg.getString("logDir")); + Rand rand; + logger.addFile(cfg.getString("logDir") + "/" + DateTime::getCompactDateTimeString() + "-" + Global::uint32ToHexString(rand.nextUInt()) + ".log"); + } + logger.setLogToStderr(true); logger.write("Analysis Engine starting..."); diff --git a/cpp/configs/analysis_example.cfg b/cpp/configs/analysis_example.cfg index 567bb2573..0d4e3fe98 100644 --- a/cpp/configs/analysis_example.cfg +++ b/cpp/configs/analysis_example.cfg @@ -6,7 +6,10 @@ # Logs------------------------------------------------------------------------------------ # Where to output log? -logFile = gtp.log +logDir = analysis_logs # Each run of KataGo will log to a separate file in this dir +# logFile = analysis.log # Use this instead of logDir to just specify a single file directly + +# Analysis------------------------------------------------------------------------------------ # Controls the number of moves after the first move in a variation. # analysisPVLen = 15 @@ -14,6 +17,12 @@ logFile = gtp.log # Report winrates for analysis as (BLACK|WHITE|SIDETOMOVE). reportAnalysisWinratesAs = BLACK +# Uncomment and and set to a positive value to make KataGo explore the top move(s) less deeply and accurately, +# but explore and give evaluations to a greater variety of moves, for analysis (does NOT affect play). +# A value like 0.03 or 0.06 will give various mildly but still noticeably wider searches. +# An extreme value like 1 will distribute many playouts across every move on the board, even very bad moves. +# wideRootNoise = 0.0 + # Bot behavior--------------------------------------------------------------------------------------- # Handicap -------------