old crashing lazy-smp | bench 1801941
This commit is contained in:
1 parent
cce6f5dd0c
commit
eac21b424a
7 files changed
+69
-42
No files matched your search
@@ -64,7 +64,9 @@ constexpr std::array<std::string_view, 50> fenPositions = {
|
|||||||
void RunBenchmark() {
|
void RunBenchmark() {
|
||||||
Board board;
|
Board board;
|
||||||
|
|
||||||
|
TTable BenchTT;
|
||||||
auto ctx = std::make_unique<SearchContext>();
|
auto ctx = std::make_unique<SearchContext>();
|
||||||
|
ctx->TT = &BenchTT;
|
||||||
|
|
||||||
Stopwatch sw;
|
Stopwatch sw;
|
||||||
for (int i = 0; i < fenPositions.size(); i++) {
|
for (int i = 0; i < fenPositions.size(); i++) {
|
||||||
|
|||||||
+27
-24
@@ -207,18 +207,18 @@ static bool ShouldStop(SearchContext* ctx) {
|
|||||||
if constexpr (mode == normal) {
|
if constexpr (mode == normal) {
|
||||||
if (ctx->nodes % 1024 == 0) {
|
if (ctx->nodes % 1024 == 0) {
|
||||||
if (ctx->sw.GetElapsedMS() >= ctx->timeToSearch) {
|
if (ctx->sw.GetElapsedMS() >= ctx->timeToSearch) {
|
||||||
ctx->searchStopped = true;
|
searchStopped = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if constexpr (mode == nodesMode) {
|
} else if constexpr (mode == nodesMode) {
|
||||||
if (ctx->nodes > ctx->nodesToGo) {
|
if (ctx->nodes > ctx->nodesToGo) {
|
||||||
ctx->searchStopped = true;
|
searchStopped = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if constexpr (mode == datagen) {
|
} else if constexpr (mode == datagen) {
|
||||||
if (ctx->nodes > DATAGEN::HARD_NODES) {
|
if (ctx->nodes > DATAGEN::HARD_NODES) {
|
||||||
ctx->searchStopped = true;
|
searchStopped = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
|
|||||||
|
|
||||||
TTEntry entry;
|
TTEntry entry;
|
||||||
if (!ctx->excluded) {
|
if (!ctx->excluded) {
|
||||||
entry = ctx->TT.GetEntry(board.hashKey);
|
entry = ctx->TT->GetEntry(board.hashKey);
|
||||||
if (entry.hashKey == board.hashKey) {
|
if (entry.hashKey == board.hashKey) {
|
||||||
bestScore = entry.score;
|
bestScore = entry.score;
|
||||||
}
|
}
|
||||||
@@ -293,13 +293,13 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
|
|||||||
ctx->positionHistory[copy.positionIndex] = copy.hashKey;
|
ctx->positionHistory[copy.positionIndex] = copy.hashKey;
|
||||||
ctx->nodes++;
|
ctx->nodes++;
|
||||||
|
|
||||||
ctx->TT.PrefetchEntry(copy.hashKey);
|
ctx->TT->PrefetchEntry(copy.hashKey);
|
||||||
|
|
||||||
int score = -Quiescence<isPV, mode>(copy, -beta, -alpha, ply + 1, ctx).score;
|
int score = -Quiescence<isPV, mode>(copy, -beta, -alpha, ply + 1, ctx).score;
|
||||||
|
|
||||||
if (score >= beta) {
|
if (score >= beta) {
|
||||||
if (!ctx->excluded) {
|
if (!ctx->excluded) {
|
||||||
ctx->TT.WriteEntry(board.hashKey, 0, score, CutNode, currMove, ttpv);
|
ctx->TT->WriteEntry(board.hashKey, 0, score, CutNode, currMove, ttpv);
|
||||||
}
|
}
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
@@ -314,9 +314,9 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
|
|||||||
}
|
}
|
||||||
|
|
||||||
results.score = bestScore;
|
results.score = bestScore;
|
||||||
if (ctx->searchStopped) return 0;
|
if (searchStopped) return 0;
|
||||||
if (!ctx->excluded) {
|
if (!ctx->excluded) {
|
||||||
ctx->TT.WriteEntry(board.hashKey, 0, results.score, nodeType, results.bestMove, ttpv);
|
ctx->TT->WriteEntry(board.hashKey, 0, results.score, nodeType, results.bestMove, ttpv);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
|
|
||||||
TTEntry entry;
|
TTEntry entry;
|
||||||
if (!ctx->excluded)
|
if (!ctx->excluded)
|
||||||
entry = ctx->TT.GetEntry(board.hashKey);
|
entry = ctx->TT->GetEntry(board.hashKey);
|
||||||
|
|
||||||
const bool ttHit = entry.hashKey == board.hashKey;
|
const bool ttHit = entry.hashKey == board.hashKey;
|
||||||
const bool ttpv = isPV | entry.ttpv;
|
const bool ttpv = isPV | entry.ttpv;
|
||||||
@@ -406,11 +406,11 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
|
|
||||||
const int reduction = 4 + improving + depth / 3;
|
const int reduction = 4 + improving + depth / 3;
|
||||||
|
|
||||||
ctx->TT.PrefetchEntry(copy.hashKey);
|
ctx->TT->PrefetchEntry(copy.hashKey);
|
||||||
|
|
||||||
int score = -PVS<false, mode>(copy, depth - reduction, -beta, -beta + 1, ply + 1, ctx, !cutnode).score;
|
int score = -PVS<false, mode>(copy, depth - reduction, -beta, -beta + 1, ply + 1, ctx, !cutnode).score;
|
||||||
|
|
||||||
if (ctx->searchStopped) return 0;
|
if (searchStopped) return 0;
|
||||||
if (score >= beta) {
|
if (score >= beta) {
|
||||||
if (depth <= 14 || ctx->minNmpPly > 0) {
|
if (depth <= 14 || ctx->minNmpPly > 0) {
|
||||||
return score > MATE_SCORE - MAX_DEPTH ? beta : score;
|
return score > MATE_SCORE - MAX_DEPTH ? beta : score;
|
||||||
@@ -469,10 +469,10 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
ply + 1, ctx, !cutnode).score;
|
ply + 1, ctx, !cutnode).score;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->searchStopped) return 0;
|
if (searchStopped) return 0;
|
||||||
|
|
||||||
if (score >= probcutBeta) {
|
if (score >= probcutBeta) {
|
||||||
ctx->TT.WriteEntry(board.hashKey, probcutDepth, score, CutNode, currMove, ttpv);
|
ctx->TT->WriteEntry(board.hashKey, probcutDepth, score, CutNode, currMove, ttpv);
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
@@ -551,7 +551,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
ctx->positionHistory[copy.positionIndex] = copy.hashKey;
|
ctx->positionHistory[copy.positionIndex] = copy.hashKey;
|
||||||
ctx->nodes++;
|
ctx->nodes++;
|
||||||
|
|
||||||
ctx->TT.PrefetchEntry(copy.hashKey);
|
ctx->TT->PrefetchEntry(copy.hashKey);
|
||||||
|
|
||||||
int extension = 0;
|
int extension = 0;
|
||||||
|
|
||||||
@@ -640,7 +640,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
ctx->nodesTable[currMove % 4096] += ctx->nodes - nodesBeforeSearch;
|
ctx->nodesTable[currMove % 4096] += ctx->nodes - nodesBeforeSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->searchStopped) return 0;
|
if (searchStopped) return 0;
|
||||||
|
|
||||||
if (currMove != 0 && currMove.IsQuiet()) {
|
if (currMove != 0 && currMove.IsQuiet()) {
|
||||||
seenQuiets[seenQuietsCount] = currMove;
|
seenQuiets[seenQuietsCount] = currMove;
|
||||||
@@ -732,7 +732,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ctx->excluded)
|
if (!ctx->excluded)
|
||||||
ctx->TT.WriteEntry(board.hashKey, depth, score, CutNode, currMove, ttpv);
|
ctx->TT->WriteEntry(board.hashKey, depth, score, CutNode, currMove, ttpv);
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,7 +754,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->searchStopped) return 0;
|
if (searchStopped) return 0;
|
||||||
if (!ctx->excluded) {
|
if (!ctx->excluded) {
|
||||||
|
|
||||||
if (!board.InCheck() && ((results.bestMove.IsQuiet() || !results.bestMove))
|
if (!board.InCheck() && ((results.bestMove.IsQuiet() || !results.bestMove))
|
||||||
@@ -765,7 +765,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
ctx->corrhist.UpdateAll(board, depth, corrHistBonus);
|
ctx->corrhist.UpdateAll(board, depth, corrHistBonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->TT.WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove, ttpv);
|
ctx->TT->WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove, ttpv);
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@@ -824,7 +824,7 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext* ctx) {
|
|||||||
|
|
||||||
double nodeScaling = 1;
|
double nodeScaling = 1;
|
||||||
|
|
||||||
if (!UCIEnabled && (mode == normal || mode == nodesMode)) {
|
if (!UCIEnabled && ctx->doPrint && (mode == normal || mode == nodesMode)) {
|
||||||
std::cout << termcolor::bold;
|
std::cout << termcolor::bold;
|
||||||
std::cout << std::setw(6) << std::left << "Depth"
|
std::cout << std::setw(6) << std::left << "Depth"
|
||||||
<< std::setw(10) << std::right << "Time"
|
<< std::setw(10) << std::right << "Time"
|
||||||
@@ -864,7 +864,7 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext* ctx) {
|
|||||||
|
|
||||||
aw.Set(currentResults.score);
|
aw.Set(currentResults.score);
|
||||||
|
|
||||||
if (ctx->searchStopped) {
|
if (searchStopped) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (currentResults.bestMove) {
|
if (currentResults.bestMove) {
|
||||||
@@ -872,17 +872,18 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext* ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (mode == normal || mode == nodesMode) {
|
if constexpr (mode == normal || mode == nodesMode) {
|
||||||
|
if (ctx->doPrint)
|
||||||
PrintSearchInfo(ctx, safeResults, depth, elapsed);
|
PrintSearchInfo(ctx, safeResults, depth, elapsed);
|
||||||
|
|
||||||
if constexpr (mode == normal) {
|
if constexpr (mode == normal) {
|
||||||
if (ctx->sw.GetElapsedMS() >= softTime) {
|
if (ctx->sw.GetElapsedMS() >= softTime) {
|
||||||
ctx->searchStopped = true;
|
searchStopped = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if constexpr (mode == datagen) {
|
} else if constexpr (mode == datagen) {
|
||||||
if (ctx->nodes >= DATAGEN::SOFT_NODES) {
|
if (ctx->nodes >= DATAGEN::SOFT_NODES) {
|
||||||
ctx->searchStopped = true;
|
searchStopped = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -894,7 +895,7 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext* ctx) {
|
|||||||
|
|
||||||
template <searchMode mode>
|
template <searchMode mode>
|
||||||
SearchResults SearchPosition(Board &board, SearchParams params, SearchContext* ctx) {
|
SearchResults SearchPosition(Board &board, SearchParams params, SearchContext* ctx) {
|
||||||
ctx->searchStopped = false;
|
searchStopped = false;
|
||||||
ctx->seldepth = 0;
|
ctx->seldepth = 0;
|
||||||
ctx->nodesTable = {};
|
ctx->nodesTable = {};
|
||||||
if constexpr (mode != bench) {
|
if constexpr (mode != bench) {
|
||||||
@@ -910,9 +911,11 @@ SearchResults SearchPosition(Board &board, SearchParams params, SearchContext* c
|
|||||||
|
|
||||||
if constexpr (mode != normal && mode != nodesMode) return results;
|
if constexpr (mode != normal && mode != nodesMode) return results;
|
||||||
|
|
||||||
|
if (ctx->doPrint) {
|
||||||
std::cout << "bestmove ";
|
std::cout << "bestmove ";
|
||||||
results.bestMove.PrintMove();
|
results.bestMove.PrintMove();
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@@ -957,7 +960,7 @@ void PrintSearchInfo(SearchContext* ctx, SearchResults& results, int depth, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout << " nodes " << ctx->nodes << " nps " << int(ctx->nodes/ctx->sw.GetElapsedSec());
|
std::cout << " nodes " << ctx->nodes << " nps " << int(ctx->nodes/ctx->sw.GetElapsedSec());
|
||||||
std::cout << " hashfull " << ctx->TT.GetUsedPercentage();
|
std::cout << " hashfull " << ctx->TT->GetUsedPercentage();
|
||||||
std::cout << " pv ";
|
std::cout << " pv ";
|
||||||
ctx->pvLine.Print(0, depth % 2 == 0);
|
ctx->pvLine.Print(0, depth % 2 == 0);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|||||||
+3
-3
@@ -207,6 +207,8 @@ public:
|
|||||||
|
|
||||||
class SearchContext {
|
class SearchContext {
|
||||||
public:
|
public:
|
||||||
|
bool doPrint = false;
|
||||||
|
|
||||||
U64 nodes = 0;
|
U64 nodes = 0;
|
||||||
U64 nodesToGo = 0;
|
U64 nodesToGo = 0;
|
||||||
int timeToSearch = 0;
|
int timeToSearch = 0;
|
||||||
@@ -218,7 +220,6 @@ public:
|
|||||||
Move excluded = Move();
|
Move excluded = Move();
|
||||||
|
|
||||||
int minNmpPly = 0;
|
int minNmpPly = 0;
|
||||||
bool searchStopped = false;
|
|
||||||
|
|
||||||
PVLine pvLine;
|
PVLine pvLine;
|
||||||
History history;
|
History history;
|
||||||
@@ -230,7 +231,7 @@ public:
|
|||||||
|
|
||||||
std::vector<U64> positionHistory;
|
std::vector<U64> positionHistory;
|
||||||
|
|
||||||
TTable TT;
|
TTable* TT = &SharedTT;
|
||||||
|
|
||||||
std::array<Stack, MAX_DEPTH> ss{};
|
std::array<Stack, MAX_DEPTH> ss{};
|
||||||
|
|
||||||
@@ -242,7 +243,6 @@ public:
|
|||||||
conthist.Clear();
|
conthist.Clear();
|
||||||
corrhist.Clear();
|
corrhist.Clear();
|
||||||
capthist.Clear();
|
capthist.Clear();
|
||||||
TT.Clear();
|
|
||||||
sw.Restart();
|
sw.Restart();
|
||||||
killerMoves = {};
|
killerMoves = {};
|
||||||
ss = {};
|
ss = {};
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "tt.h"
|
#include "tt.h"
|
||||||
|
|
||||||
|
TTable SharedTT;
|
||||||
|
|
||||||
void TTable::WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move bestMove, bool ttpv) {
|
void TTable::WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move bestMove, bool ttpv) {
|
||||||
TTBucket *bucket = &table[hashKey % table.size()];
|
TTBucket *bucket = &table[hashKey % table.size()];
|
||||||
TTEntry *current = nullptr;
|
TTEntry *current = nullptr;
|
||||||
|
|||||||
@@ -96,3 +96,5 @@ public:
|
|||||||
|
|
||||||
void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move bestMove, bool ttpv);
|
void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move bestMove, bool ttpv);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern TTable SharedTT;
|
||||||
+29
-15
@@ -91,17 +91,19 @@ static double ReadParam(const std::string& param, const std::string &command) {
|
|||||||
template <SEARCH::searchMode mode>
|
template <SEARCH::searchMode mode>
|
||||||
static void ThreadFunc(Board* board, SearchParams params, SEARCH::SearchContext* ctx) {
|
static void ThreadFunc(Board* board, SearchParams params, SEARCH::SearchContext* ctx) {
|
||||||
SEARCH::SearchPosition<mode>(*board, params, ctx);
|
SEARCH::SearchPosition<mode>(*board, params, ctx);
|
||||||
|
delete ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartSearchThread(Board& board, SearchParams params, SEARCH::SearchContext* ctx) {
|
static void StartSearchThread(Board& board, SearchParams params, SEARCH::SearchContext* ctx, int id) {
|
||||||
std::thread searchThread;
|
std::thread searchThread;
|
||||||
|
SEARCH::SearchContext* ctxCopy = new SEARCH::SearchContext(*ctx);
|
||||||
|
if (id == 0)
|
||||||
|
ctxCopy->doPrint = true;
|
||||||
if (params.nodes) {
|
if (params.nodes) {
|
||||||
searchThread = std::thread(ThreadFunc<SEARCH::nodesMode>, &board, params, ctx);
|
searchThread = std::thread(ThreadFunc<SEARCH::nodesMode>, &board, params, ctxCopy);
|
||||||
} else {
|
} else {
|
||||||
searchThread = std::thread(ThreadFunc<SEARCH::normal>, &board, params, ctx);
|
searchThread = std::thread(ThreadFunc<SEARCH::normal>, &board, params, ctxCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
searchThread.detach();
|
searchThread.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,24 +111,29 @@ static void StartSearchThread(Board& board, SearchParams params, SEARCH::SearchC
|
|||||||
// Unix/Linux implementation using pthread
|
// Unix/Linux implementation using pthread
|
||||||
template <SEARCH::searchMode mode>
|
template <SEARCH::searchMode mode>
|
||||||
static void* ThreadFunc(void* arg) {
|
static void* ThreadFunc(void* arg) {
|
||||||
auto* tup = static_cast<std::tuple<Board*, SearchParams, SEARCH::SearchContext*>*>(arg);
|
auto* tup = static_cast<std::tuple<Board, SearchParams, SEARCH::SearchContext*>*>(arg);
|
||||||
SEARCH::SearchPosition<mode>(*std::get<0>(*tup), std::get<1>(*tup), std::get<2>(*tup));
|
SEARCH::SearchContext* ctx = std::get<2>(*tup);
|
||||||
|
SEARCH::SearchPosition<mode>(std::get<0>(*tup), std::get<1>(*tup), ctx);
|
||||||
|
delete ctx;
|
||||||
delete tup;
|
delete tup;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartSearchThread(Board& board, SearchParams params, SEARCH::SearchContext* ctx) {
|
static void StartSearchThread(Board& board, SearchParams params, SEARCH::SearchContext* ctx, int id) {
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
pthread_attr_setstacksize(&attr, 8 * 1024 * 1024); // 8 MB stack
|
pthread_attr_setstacksize(&attr, 8 * 1024 * 1024); // 8 MB stack
|
||||||
|
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
|
||||||
|
SEARCH::SearchContext* ctxCopy = new SEARCH::SearchContext(*ctx);
|
||||||
|
if (id == 0)
|
||||||
|
ctxCopy->doPrint = true;
|
||||||
if (params.nodes) {
|
if (params.nodes) {
|
||||||
auto* arg = new std::tuple<Board*, SearchParams, SEARCH::SearchContext*>(&board, params, ctx);
|
auto* arg = new std::tuple<Board, SearchParams, SEARCH::SearchContext*>(board, params, ctxCopy);
|
||||||
pthread_create(&thread, &attr, ThreadFunc<SEARCH::nodesMode>, arg);
|
pthread_create(&thread, &attr, ThreadFunc<SEARCH::nodesMode>, arg);
|
||||||
} else {
|
} else {
|
||||||
auto* arg = new std::tuple<Board*, SearchParams, SEARCH::SearchContext*>(&board, params, ctx);
|
auto* arg = new std::tuple<Board, SearchParams, SEARCH::SearchContext*>(board, params, ctxCopy);
|
||||||
pthread_create(&thread, &attr, ThreadFunc<SEARCH::normal>, arg);
|
pthread_create(&thread, &attr, ThreadFunc<SEARCH::normal>, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,13 +160,20 @@ static void ParseGo(Board &board, std::string &command, SEARCH::SearchContext* c
|
|||||||
params.btime = 99999999;
|
params.btime = 99999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
StartSearchThread(board, params, ctx);
|
for (int i = 0; i < threads; i++) {
|
||||||
|
StartSearchThread(board, params, ctx, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetOption(std::string& command, SEARCH::SearchContext* ctx) {
|
static void SetOption(std::string& command, SEARCH::SearchContext* ctx) {
|
||||||
if (command.find("Hash") != std::string::npos) {
|
if (command.find("Hash") != std::string::npos) {
|
||||||
U64 hashSize = (ReadParam("value", command) * 1000000ULL) / sizeof(TTEntry);
|
U64 hashSize = (ReadParam("value", command) * 1000000ULL) / sizeof(TTEntry);
|
||||||
ctx->TT.Resize(hashSize);
|
ctx->TT->Resize(hashSize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command.find("Threads") != std::string::npos) {
|
||||||
|
threads = ReadParam("value", command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +223,7 @@ static void PrintEngineInfo() {
|
|||||||
std::cout << "id name Eleanor v3.0" << std::endl;
|
std::cout << "id name Eleanor v3.0" << std::endl;
|
||||||
std::cout << "id author rektdie" << std::endl;
|
std::cout << "id author rektdie" << std::endl;
|
||||||
std::cout << "option name Hash type spin default 8 min 1 max 1024" << std::endl;
|
std::cout << "option name Hash type spin default 8 min 1 max 1024" << std::endl;
|
||||||
std::cout << "option name Threads type spin default 1 min 1 max 1" << std::endl;
|
std::cout << "option name Threads type spin default 1 min 1 max 512" << std::endl;
|
||||||
|
|
||||||
#ifdef TUNING
|
#ifdef TUNING
|
||||||
PrintTunablesUCI();
|
PrintTunablesUCI();
|
||||||
@@ -245,7 +259,7 @@ void UCILoop(Board &board) {
|
|||||||
board.SetByFen(StartingFen);
|
board.SetByFen(StartingFen);
|
||||||
|
|
||||||
// Clearing
|
// Clearing
|
||||||
ctx->TT.Clear();
|
ctx->TT->Clear();
|
||||||
|
|
||||||
ctx->killerMoves = {};
|
ctx->killerMoves = {};
|
||||||
ctx->history.Clear();
|
ctx->history.Clear();
|
||||||
@@ -272,7 +286,7 @@ void UCILoop(Board &board) {
|
|||||||
// parse UCI "stop" command
|
// parse UCI "stop" command
|
||||||
if (input.find("stop") != std::string::npos) {
|
if (input.find("stop") != std::string::npos) {
|
||||||
// stop the loop
|
// stop the loop
|
||||||
ctx->searchStopped = true;
|
searchStopped = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
inline bool UCIEnabled = false;
|
inline bool UCIEnabled = false;
|
||||||
|
inline int threads = 1;
|
||||||
|
inline bool searchStopped = false;
|
||||||
|
|
||||||
class SearchParams {
|
class SearchParams {
|
||||||
public:
|
public:
|
||||||
@@ -13,6 +15,8 @@ public:
|
|||||||
int movesToGo = 0;
|
int movesToGo = 0;
|
||||||
int nodes = 0;
|
int nodes = 0;
|
||||||
|
|
||||||
|
int threads = 1;
|
||||||
|
|
||||||
SearchParams(){}
|
SearchParams(){}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user