Remove conditional compilation on EVAL_LEARN

This commit is contained in:
Tomasz Sobczyk
2020-09-12 16:19:24 +02:00
parent 8d499e6efa
commit d33e7a9b07
32 changed files with 6 additions and 144 deletions
-4
View File
@@ -1,8 +1,6 @@
#ifndef _EVALUATE_COMMON_H_ #ifndef _EVALUATE_COMMON_H_
#define _EVALUATE_COMMON_H_ #define _EVALUATE_COMMON_H_
#if defined(EVAL_LEARN)
// A common header-like function for modern evaluation functions. // A common header-like function for modern evaluation functions.
#include <string> #include <string>
@@ -21,6 +19,4 @@ namespace Eval
double get_eta(); double get_eta();
} }
#endif // defined(EVAL_LEARN)
#endif // _EVALUATE_KPPT_COMMON_H_ #endif // _EVALUATE_KPPT_COMMON_H_
-5
View File
@@ -43,11 +43,8 @@ namespace Eval {
return UseNNUEMode::False; return UseNNUEMode::False;
else if (mode == "true") else if (mode == "true")
return UseNNUEMode::True; return UseNNUEMode::True;
#ifdef EVAL_LEARN
else if (mode == "pure") else if (mode == "pure")
return UseNNUEMode::Pure; return UseNNUEMode::Pure;
#endif
return UseNNUEMode::False; return UseNNUEMode::False;
} }
@@ -955,11 +952,9 @@ make_v:
/// evaluation of the position from the point of view of the side to move. /// evaluation of the position from the point of view of the side to move.
Value Eval::evaluate(const Position& pos) { Value Eval::evaluate(const Position& pos) {
#ifdef EVAL_LEARN
if (useNNUE == UseNNUEMode::Pure) { if (useNNUE == UseNNUEMode::Pure) {
return NNUE::evaluate(pos); return NNUE::evaluate(pos);
} }
#endif
bool classical = useNNUE == UseNNUEMode::False bool classical = useNNUE == UseNNUEMode::False
|| abs(eg_value(pos.psq_score())) * 16 > NNUEThreshold1 * (16 + pos.rule50_count()); || abs(eg_value(pos.psq_score())) * 16 > NNUEThreshold1 * (16 + pos.rule50_count());
+2 -5
View File
@@ -29,11 +29,8 @@ namespace Eval {
enum struct UseNNUEMode enum struct UseNNUEMode
{ {
False, False,
True True,
Pure
#ifdef EVAL_LEARN
,Pure
#endif
}; };
std::string trace(const Position& pos); std::string trace(const Position& pos);
-3
View File
@@ -1,5 +1,3 @@
#if defined(EVAL_LEARN)
#include "convert.h" #include "convert.h"
#include "multi_think.h" #include "multi_think.h"
@@ -606,4 +604,3 @@ namespace Learner
convert(args); convert(args);
} }
} }
#endif
-2
View File
@@ -5,7 +5,6 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#if defined(EVAL_LEARN)
namespace Learner { namespace Learner {
void convert_bin_from_pgn_extract( void convert_bin_from_pgn_extract(
const std::vector<std::string>& filenames, const std::vector<std::string>& filenames,
@@ -32,6 +31,5 @@ namespace Learner {
void convert(std::istringstream& is); void convert(std::istringstream& is);
} }
#endif
#endif #endif
+1 -4
View File
@@ -1,6 +1,4 @@
#if defined(EVAL_LEARN) #include "gensfen.h"
#include "gensfen.h"
#include "packed_sfen.h" #include "packed_sfen.h"
#include "multi_think.h" #include "multi_think.h"
@@ -1207,4 +1205,3 @@ namespace Learner
std::cout << "gensfen finished." << endl; std::cout << "gensfen finished." << endl;
} }
} }
#endif
-2
View File
@@ -5,12 +5,10 @@
#include <sstream> #include <sstream>
#if defined(EVAL_LEARN)
namespace Learner { namespace Learner {
// Automatic generation of teacher position // Automatic generation of teacher position
void gen_sfen(Position& pos, std::istringstream& is); void gen_sfen(Position& pos, std::istringstream& is);
} }
#endif
#endif #endif
-4
View File
@@ -17,8 +17,6 @@
// → I will not be involved in the engine because it is a problem that the GUI should assist. // → I will not be involved in the engine because it is a problem that the GUI should assist.
// etc.. // etc..
#if defined(EVAL_LEARN)
#include "learn.h" #include "learn.h"
#include "convert.h" #include "convert.h"
@@ -2048,5 +2046,3 @@ namespace Learner
} }
} // namespace Learner } // namespace Learner
#endif // EVAL_LEARN
-4
View File
@@ -1,8 +1,6 @@
#ifndef _LEARN_H_ #ifndef _LEARN_H_
#define _LEARN_H_ #define _LEARN_H_
#if defined(EVAL_LEARN)
// ---------------------- // ----------------------
// Floating point for learning // Floating point for learning
// ---------------------- // ----------------------
@@ -78,6 +76,4 @@ namespace Learner
void learn(Position& pos, std::istringstream& is); void learn(Position& pos, std::istringstream& is);
} }
#endif
#endif // ifndef _LEARN_H_ #endif // ifndef _LEARN_H_
-4
View File
@@ -1,7 +1,5 @@
#include "learning_tools.h" #include "learning_tools.h"
#if defined (EVAL_LEARN)
#include "misc.h" #include "misc.h"
using namespace Eval; using namespace Eval;
@@ -18,5 +16,3 @@ namespace EvalLearningTools
uint64_t Weight::eta1_epoch; uint64_t Weight::eta1_epoch;
uint64_t Weight::eta2_epoch; uint64_t Weight::eta2_epoch;
} }
#endif
-3
View File
@@ -3,8 +3,6 @@
// A set of machine learning tools related to the weight array used for machine learning of evaluation functions // A set of machine learning tools related to the weight array used for machine learning of evaluation functions
#if defined (EVAL_LEARN)
#include "learn.h" #include "learn.h"
#include "misc.h" // PRNG , my_insertion_sort #include "misc.h" // PRNG , my_insertion_sort
@@ -98,5 +96,4 @@ namespace EvalLearningTools
}; };
} }
#endif // defined (EVAL_LEARN)
#endif #endif
+1 -6
View File
@@ -1,6 +1,4 @@
#if defined(EVAL_LEARN) #include "multi_think.h"
#include "multi_think.h"
#include "tt.h" #include "tt.h"
#include "uci.h" #include "uci.h"
@@ -118,6 +116,3 @@ void MultiThink::go_think()
Options[s.first] = std::string(s.second); Options[s.first] = std::string(s.second);
} }
#endif // defined(EVAL_LEARN)
-4
View File
@@ -1,8 +1,6 @@
#ifndef _MULTI_THINK_ #ifndef _MULTI_THINK_
#define _MULTI_THINK_ #define _MULTI_THINK_
#if defined(EVAL_LEARN)
#include "learn.h" #include "learn.h"
#include "misc.h" #include "misc.h"
@@ -151,6 +149,4 @@ protected:
std::mutex task_mutex; std::mutex task_mutex;
}; };
#endif // defined(EVAL_LEARN) && defined(YANEURAOU_2018_OTAFUKU_ENGINE)
#endif #endif
-3
View File
@@ -4,7 +4,6 @@
#include <vector> #include <vector>
#include <cstdint> #include <cstdint>
#if defined(EVAL_LEARN)
namespace Learner { namespace Learner {
// packed sfen // packed sfen
@@ -45,5 +44,3 @@ namespace Learner {
using PSVector = std::vector<PackedSfenValue>; using PSVector = std::vector<PackedSfenValue>;
} }
#endif #endif
#endif
+1 -6
View File
@@ -1,6 +1,4 @@
#if defined (EVAL_LEARN) #include "sfen_packer.h"
#include "sfen_packer.h"
#include "packed_sfen.h" #include "packed_sfen.h"
@@ -402,6 +400,3 @@ namespace Learner {
return sfen; return sfen;
} }
} }
#endif // USE_SFEN_PACKER
-4
View File
@@ -1,8 +1,6 @@
#ifndef _SFEN_PACKER_H_ #ifndef _SFEN_PACKER_H_
#define _SFEN_PACKER_H_ #define _SFEN_PACKER_H_
#if defined(EVAL_LEARN)
#include "types.h" #include "types.h"
#include "learn/packed_sfen.h" #include "learn/packed_sfen.h"
@@ -20,5 +18,3 @@ namespace Learner {
} }
#endif #endif
#endif
-4
View File
@@ -1,7 +1,5 @@
// Code for learning NNUE evaluation function // Code for learning NNUE evaluation function
#if defined(EVAL_LEARN)
#include <random> #include <random>
#include <fstream> #include <fstream>
#include <filesystem> #include <filesystem>
@@ -238,5 +236,3 @@ double get_eta() {
} }
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
-4
View File
@@ -3,8 +3,6 @@
#ifndef _EVALUATE_NNUE_LEARNER_H_ #ifndef _EVALUATE_NNUE_LEARNER_H_
#define _EVALUATE_NNUE_LEARNER_H_ #define _EVALUATE_NNUE_LEARNER_H_
#if defined(EVAL_LEARN)
#include "../learn/learn.h" #include "../learn/learn.h"
namespace Eval { namespace Eval {
@@ -41,6 +39,4 @@ void CheckHealth();
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
#endif #endif
-4
View File
@@ -3,8 +3,6 @@
#ifndef _NNUE_TRAINER_H_ #ifndef _NNUE_TRAINER_H_
#define _NNUE_TRAINER_H_ #define _NNUE_TRAINER_H_
#if defined(EVAL_LEARN)
#include "../nnue_common.h" #include "../nnue_common.h"
#include "../features/index_list.h" #include "../features/index_list.h"
@@ -120,6 +118,4 @@ std::shared_ptr<T> MakeAlignedSharedPtr(ArgumentTypes&&... arguments) {
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
#endif #endif
@@ -3,8 +3,6 @@
#ifndef _NNUE_TRAINER_AFFINE_TRANSFORM_H_ #ifndef _NNUE_TRAINER_AFFINE_TRANSFORM_H_
#define _NNUE_TRAINER_AFFINE_TRANSFORM_H_ #define _NNUE_TRAINER_AFFINE_TRANSFORM_H_
#if defined(EVAL_LEARN)
#include "../../learn/learn.h" #include "../../learn/learn.h"
#include "../layers/affine_transform.h" #include "../layers/affine_transform.h"
#include "trainer.h" #include "trainer.h"
@@ -296,6 +294,4 @@ class Trainer<Layers::AffineTransform<PreviousLayer, OutputDimensions>> {
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
#endif #endif
-4
View File
@@ -3,8 +3,6 @@
#ifndef _NNUE_TRAINER_CLIPPED_RELU_H_ #ifndef _NNUE_TRAINER_CLIPPED_RELU_H_
#define _NNUE_TRAINER_CLIPPED_RELU_H_ #define _NNUE_TRAINER_CLIPPED_RELU_H_
#if defined(EVAL_LEARN)
#include "../../learn/learn.h" #include "../../learn/learn.h"
#include "../layers/clipped_relu.h" #include "../layers/clipped_relu.h"
#include "trainer.h" #include "trainer.h"
@@ -137,6 +135,4 @@ class Trainer<Layers::ClippedReLU<PreviousLayer>> {
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
#endif #endif
@@ -3,8 +3,6 @@
#ifndef _NNUE_TRAINER_FEATURE_TRANSFORMER_H_ #ifndef _NNUE_TRAINER_FEATURE_TRANSFORMER_H_
#define _NNUE_TRAINER_FEATURE_TRANSFORMER_H_ #define _NNUE_TRAINER_FEATURE_TRANSFORMER_H_
#if defined(EVAL_LEARN)
#include "../../learn/learn.h" #include "../../learn/learn.h"
#include "../nnue_feature_transformer.h" #include "../nnue_feature_transformer.h"
#include "trainer.h" #include "trainer.h"
@@ -372,6 +370,4 @@ class Trainer<FeatureTransformer> {
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
#endif #endif
-4
View File
@@ -3,8 +3,6 @@
#ifndef _NNUE_TRAINER_INPUT_SLICE_H_ #ifndef _NNUE_TRAINER_INPUT_SLICE_H_
#define _NNUE_TRAINER_INPUT_SLICE_H_ #define _NNUE_TRAINER_INPUT_SLICE_H_
#if defined(EVAL_LEARN)
#include "../../learn/learn.h" #include "../../learn/learn.h"
#include "../layers/input_slice.h" #include "../layers/input_slice.h"
#include "trainer.h" #include "trainer.h"
@@ -246,6 +244,4 @@ class Trainer<Layers::InputSlice<OutputDimensions, Offset>> {
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
#endif #endif
-4
View File
@@ -3,8 +3,6 @@
#ifndef _NNUE_TRAINER_SUM_H_ #ifndef _NNUE_TRAINER_SUM_H_
#define _NNUE_TRAINER_SUM_H_ #define _NNUE_TRAINER_SUM_H_
#if defined(EVAL_LEARN)
#include "../../learn/learn.h" #include "../../learn/learn.h"
#include "../layers/sum.h" #include "../layers/sum.h"
#include "trainer.h" #include "trainer.h"
@@ -185,6 +183,4 @@ class Trainer<Layers::Sum<PreviousLayer>> {
} // namespace Eval } // namespace Eval
#endif // defined(EVAL_LEARN)
#endif #endif
-6
View File
@@ -32,10 +32,8 @@
#include "uci.h" #include "uci.h"
#include "syzygy/tbprobe.h" #include "syzygy/tbprobe.h"
#if defined(EVAL_LEARN)
#include "learn/packed_sfen.h" #include "learn/packed_sfen.h"
#include "learn/sfen_packer.h" #include "learn/sfen_packer.h"
#endif
using std::string; using std::string;
@@ -1352,8 +1350,6 @@ bool Position::pos_is_ok() const {
return true; return true;
} }
#if defined(EVAL_LEARN)
// Add a function that directly unpacks for speed. It's pretty tough. // Add a function that directly unpacks for speed. It's pretty tough.
// Write it by combining packer::unpack() and Position::set(). // Write it by combining packer::unpack() and Position::set().
// If there is a problem with the passed phase and there is an error, non-zero is returned. // If there is a problem with the passed phase and there is an error, non-zero is returned.
@@ -1385,5 +1381,3 @@ void Position::sfen_pack(Learner::PackedSfen& sfen)
{ {
sfen = Learner::sfen_pack(*this); sfen = Learner::sfen_pack(*this);
} }
#endif
-4
View File
@@ -30,10 +30,8 @@
#include "nnue/nnue_accumulator.h" #include "nnue/nnue_accumulator.h"
#if defined(EVAL_LEARN)
#include "learn/packed_sfen.h" #include "learn/packed_sfen.h"
#include "learn/sfen_packer.h" #include "learn/sfen_packer.h"
#endif
/// StateInfo struct stores information needed to restore a Position object to /// StateInfo struct stores information needed to restore a Position object to
@@ -177,7 +175,6 @@ public:
// Used by NNUE // Used by NNUE
StateInfo* state() const; StateInfo* state() const;
#if defined(EVAL_LEARN)
// --sfenization helper // --sfenization helper
friend int Learner::set_from_packed_sfen(Position& pos, const Learner::PackedSfen& sfen, StateInfo* si, Thread* th, bool mirror); friend int Learner::set_from_packed_sfen(Position& pos, const Learner::PackedSfen& sfen, StateInfo* si, Thread* th, bool mirror);
@@ -199,7 +196,6 @@ public:
// Returns the position of the ball on the c side. // Returns the position of the ball on the c side.
Square king_square(Color c) const { return pieceList[make_piece(c, KING)][0]; } Square king_square(Color c) const { return pieceList[make_piece(c, KING)][0]; }
#endif // EVAL_LEARN
private: private:
// Initialization helpers (used while setting up a position) // Initialization helpers (used while setting up a position)
-10
View File
@@ -54,9 +54,7 @@ using std::string;
using Eval::evaluate; using Eval::evaluate;
using namespace Search; using namespace Search;
#if defined(EVAL_LEARN)
bool Search::prune_at_shallow_depth_on_pv_node = false; bool Search::prune_at_shallow_depth_on_pv_node = false;
#endif
namespace { namespace {
@@ -991,9 +989,7 @@ moves_loop: // When in check, search starts from here
ss->moveCount = ++moveCount; ss->moveCount = ++moveCount;
if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000 if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000
#if defined(EVAL_LEARN)
&& !Limits.silent && !Limits.silent
#endif
) )
sync_cout << "info depth " << depth sync_cout << "info depth " << depth
<< " currmove " << UCI::move(move, pos.is_chess960()) << " currmove " << UCI::move(move, pos.is_chess960())
@@ -1011,9 +1007,7 @@ moves_loop: // When in check, search starts from here
// Step 12. Pruning at shallow depth (~200 Elo) // Step 12. Pruning at shallow depth (~200 Elo)
if ( !rootNode if ( !rootNode
#ifdef EVAL_LEARN
&& (PvNode ? prune_at_shallow_depth_on_pv_node : true) && (PvNode ? prune_at_shallow_depth_on_pv_node : true)
#endif
&& pos.non_pawn_material(us) && pos.non_pawn_material(us)
&& bestValue > VALUE_TB_LOSS_IN_MAX_PLY) && bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
{ {
@@ -1564,10 +1558,8 @@ moves_loop: // When in check, search starts from here
// Check for legality just before making the move // Check for legality just before making the move
if ( if (
#if defined(EVAL_LEARN)
// HACK: pos.piece_on(from_sq(m)) sometimes will be NO_PIECE during machine learning. // HACK: pos.piece_on(from_sq(m)) sometimes will be NO_PIECE during machine learning.
!pos.pseudo_legal(move) || !pos.pseudo_legal(move) ||
#endif // EVAL_LEARN
!pos.legal(move) !pos.legal(move)
) )
{ {
@@ -1978,7 +1970,6 @@ void Tablebases::rank_root_moves(Position& pos, Search::RootMoves& rootMoves) {
// --- expose the functions such as fixed depth search used for learning to the outside // --- expose the functions such as fixed depth search used for learning to the outside
#if defined (EVAL_LEARN)
namespace Learner namespace Learner
{ {
@@ -2278,4 +2269,3 @@ namespace Learner
} }
} }
#endif
-9
View File
@@ -32,10 +32,7 @@ namespace Search {
/// Threshold used for countermoves based pruning /// Threshold used for countermoves based pruning
constexpr int CounterMovePruneThreshold = 0; constexpr int CounterMovePruneThreshold = 0;
#if defined(EVAL_LEARN)
extern bool prune_at_shallow_depth_on_pv_node; extern bool prune_at_shallow_depth_on_pv_node;
#endif
/// Stack struct keeps track of the information we need to remember from nodes /// Stack struct keeps track of the information we need to remember from nodes
/// shallower and deeper in the tree during the search. Each search thread has /// shallower and deeper in the tree during the search. Each search thread has
@@ -90,9 +87,7 @@ struct LimitsType {
time[WHITE] = time[BLACK] = inc[WHITE] = inc[BLACK] = npmsec = movetime = TimePoint(0); time[WHITE] = time[BLACK] = inc[WHITE] = inc[BLACK] = npmsec = movetime = TimePoint(0);
movestogo = depth = mate = perft = infinite = 0; movestogo = depth = mate = perft = infinite = 0;
nodes = 0; nodes = 0;
#if defined (EVAL_LEARN)
silent = false; silent = false;
#endif
} }
bool use_time_management() const { bool use_time_management() const {
@@ -103,11 +98,9 @@ struct LimitsType {
TimePoint time[COLOR_NB], inc[COLOR_NB], npmsec, movetime, startTime; TimePoint time[COLOR_NB], inc[COLOR_NB], npmsec, movetime, startTime;
int movestogo, depth, mate, perft, infinite; int movestogo, depth, mate, perft, infinite;
int64_t nodes; int64_t nodes;
#if defined (EVAL_LEARN)
// Silent mode that does not output to the screen (for continuous self-play in process) // Silent mode that does not output to the screen (for continuous self-play in process)
// Do not output PV at this time. // Do not output PV at this time.
bool silent; bool silent;
#endif
}; };
extern LimitsType Limits; extern LimitsType Limits;
@@ -117,7 +110,6 @@ void clear();
} // namespace Search } // namespace Search
#if defined(EVAL_LEARN)
namespace Learner { namespace Learner {
// A pair of reader and evaluation value. Returned by Learner::search(),Learner::qsearch(). // A pair of reader and evaluation value. Returned by Learner::search(),Learner::qsearch().
@@ -126,6 +118,5 @@ namespace Learner {
ValueAndPV qsearch(Position& pos); ValueAndPV qsearch(Position& pos);
ValueAndPV search(Position& pos, int depth_, size_t multiPV = 1, uint64_t nodesLimit = 0); ValueAndPV search(Position& pos, int depth_, size_t multiPV = 1, uint64_t nodesLimit = 0);
} }
#endif
#endif // #ifndef SEARCH_H_INCLUDED #endif // #ifndef SEARCH_H_INCLUDED
-4
View File
@@ -28,9 +28,7 @@
TranspositionTable TT; // Our global transposition table TranspositionTable TT; // Our global transposition table
#ifdef EVAL_LEARN
bool TranspositionTable::enable_transposition_table = true; bool TranspositionTable::enable_transposition_table = true;
#endif
/// TTEntry::save() populates the TTEntry with a new node's data, possibly /// TTEntry::save() populates the TTEntry with a new node's data, possibly
/// overwriting an old position. Update is not atomic and can be racy. /// overwriting an old position. Update is not atomic and can be racy.
@@ -120,12 +118,10 @@ void TranspositionTable::clear() {
TTEntry* TranspositionTable::probe(const Key key, bool& found) const { TTEntry* TranspositionTable::probe(const Key key, bool& found) const {
#ifdef EVAL_LEARN
if (!enable_transposition_table) { if (!enable_transposition_table) {
found = false; found = false;
return first_entry(0); return first_entry(0);
} }
#endif
TTEntry* const tte = first_entry(key); TTEntry* const tte = first_entry(key);
const uint16_t key16 = (uint16_t)key; // Use the low 16 bits as key inside the cluster const uint16_t key16 = (uint16_t)key; // Use the low 16 bits as key inside the cluster
-2
View File
@@ -84,9 +84,7 @@ public:
return &table[mul_hi64(key, clusterCount)].entry[0]; return &table[mul_hi64(key, clusterCount)].entry[0];
} }
#ifdef EVAL_LEARN
static bool enable_transposition_table; static bool enable_transposition_table;
#endif
private: private:
friend struct TTEntry; friend struct TTEntry;
+1 -6
View File
@@ -245,7 +245,6 @@ double UCI::win_rate_model_double(double v, int ply) {
// Call qsearch(),search() directly for testing // Call qsearch(),search() directly for testing
// -------------------- // --------------------
#if defined(EVAL_LEARN)
void qsearch_cmd(Position& pos) void qsearch_cmd(Position& pos)
{ {
cout << "qsearch : "; cout << "qsearch : ";
@@ -277,8 +276,6 @@ void search_cmd(Position& pos, istringstream& is)
cout << endl; cout << endl;
} }
#endif
/// UCI::loop() waits for a command from stdin, parses it and calls the appropriate /// UCI::loop() waits for a command from stdin, parses it and calls the appropriate
/// function. Also intercepts EOF from stdin to ensure gracefully exiting if the /// function. Also intercepts EOF from stdin to ensure gracefully exiting if the
/// GUI dies unexpectedly. When called with some command line arguments, e.g. to /// GUI dies unexpectedly. When called with some command line arguments, e.g. to
@@ -334,7 +331,7 @@ void UCI::loop(int argc, char* argv[]) {
else if (token == "d") sync_cout << pos << sync_endl; else if (token == "d") sync_cout << pos << sync_endl;
else if (token == "eval") trace_eval(pos); else if (token == "eval") trace_eval(pos);
else if (token == "compiler") sync_cout << compiler_info() << sync_endl; else if (token == "compiler") sync_cout << compiler_info() << sync_endl;
#if defined (EVAL_LEARN)
else if (token == "gensfen") Learner::gen_sfen(pos, is); else if (token == "gensfen") Learner::gen_sfen(pos, is);
else if (token == "learn") Learner::learn(pos, is); else if (token == "learn") Learner::learn(pos, is);
else if (token == "convert") Learner::convert(is); else if (token == "convert") Learner::convert(is);
@@ -343,8 +340,6 @@ void UCI::loop(int argc, char* argv[]) {
else if (token == "qsearch") qsearch_cmd(pos); else if (token == "qsearch") qsearch_cmd(pos);
else if (token == "search") search_cmd(pos, is); else if (token == "search") search_cmd(pos, is);
#endif
// test command // test command
else if (token == "test") test_cmd(pos, is); else if (token == "test") test_cmd(pos, is);
else else
-8
View File
@@ -42,14 +42,12 @@ void on_threads(const Option& o) { Threads.set(size_t(o)); }
void on_tb_path(const Option& o) { Tablebases::init(o); } void on_tb_path(const Option& o) { Tablebases::init(o); }
void on_use_NNUE(const Option& ) { Eval::init_NNUE(); } void on_use_NNUE(const Option& ) { Eval::init_NNUE(); }
void on_eval_file(const Option& ) { Eval::init_NNUE(); } void on_eval_file(const Option& ) { Eval::init_NNUE(); }
#ifdef EVAL_LEARN
void on_prune_at_shallow_depth_on_pv_node(const Option& o) { void on_prune_at_shallow_depth_on_pv_node(const Option& o) {
Search::prune_at_shallow_depth_on_pv_node = o; Search::prune_at_shallow_depth_on_pv_node = o;
} }
void on_enable_transposition_table(const Option& o) { void on_enable_transposition_table(const Option& o) {
TranspositionTable::enable_transposition_table = o; TranspositionTable::enable_transposition_table = o;
} }
#endif
/// Our case insensitive less() function as required by UCI protocol /// Our case insensitive less() function as required by UCI protocol
bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const { bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {
@@ -86,11 +84,7 @@ void init(OptionsMap& o) {
o["SyzygyProbeDepth"] << Option(1, 1, 100); o["SyzygyProbeDepth"] << Option(1, 1, 100);
o["Syzygy50MoveRule"] << Option(true); o["Syzygy50MoveRule"] << Option(true);
o["SyzygyProbeLimit"] << Option(7, 0, 7); o["SyzygyProbeLimit"] << Option(7, 0, 7);
#if defined(EVAL_LEARN)
o["Use NNUE"] << Option("true var true var false var pure", "true", on_use_NNUE); o["Use NNUE"] << Option("true var true var false var pure", "true", on_use_NNUE);
#else
o["Use NNUE"] << Option("true var true var false", "true", on_use_NNUE);
#endif
// The default must follow the format nn-[SHA256 first 12 digits].nnue // The default must follow the format nn-[SHA256 first 12 digits].nnue
// for the build process (profile-build and fishtest) to work. // for the build process (profile-build and fishtest) to work.
o["EvalFile"] << Option("nn-82215d0fd0df.nnue", on_eval_file); o["EvalFile"] << Option("nn-82215d0fd0df.nnue", on_eval_file);
@@ -102,7 +96,6 @@ void init(OptionsMap& o) {
o["SkipLoadingEval"] << Option(false); o["SkipLoadingEval"] << Option(false);
// how many moves to use a fixed move // how many moves to use a fixed move
// o["BookMoves"] << Option(16, 0, 10000); // o["BookMoves"] << Option(16, 0, 10000);
#if defined(EVAL_LEARN)
// When learning the evaluation function, you can change the folder to save the evaluation function. // When learning the evaluation function, you can change the folder to save the evaluation function.
// Evalsave by default. This folder shall be prepared in advance. // Evalsave by default. This folder shall be prepared in advance.
// Automatically create a folder under this folder like "0/", "1/", ... and save the evaluation function file there. // Automatically create a folder under this folder like "0/", "1/", ... and save the evaluation function file there.
@@ -111,7 +104,6 @@ void init(OptionsMap& o) {
o["PruneAtShallowDepthOnPvNode"] << Option(false, on_prune_at_shallow_depth_on_pv_node); o["PruneAtShallowDepthOnPvNode"] << Option(false, on_prune_at_shallow_depth_on_pv_node);
// Enable transposition table. // Enable transposition table.
o["EnableTranspositionTable"] << Option(true, on_enable_transposition_table); o["EnableTranspositionTable"] << Option(true, on_enable_transposition_table);
#endif
} }