Make fix #49

Merged
rektdie merged 4 commits from make_fix into main 2025-04-10 06:18:06 +02:00
6 changed files with 35 additions and 39 deletions

No files matched your search

+14 -18
View File
@@ -1,16 +1,11 @@
# Define the directories
# Define directories
SRC_DIR := source
OBJ_DIR := obj
# Set default C++ compiler, but allow override from the command line
CXX ?= g++
# Set default executable name, but allow override from the command line
CXX ?= clang++
EXE ?= Eleanor
EVALFILE := ./nnue.bin
EVALFILE = ./nnue.bin
# Determine platform
ifeq ($(OS),Windows_NT)
EXE_EXT := .exe
MKDIR := mkdir
@@ -25,29 +20,30 @@ endif
MAKEFLAGS += -j
# List of source files
# Source and object files
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
OBJS := $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS))
# Link the executable
$(EXE)$(EXE_EXT): $(SRCS)
$(CXX) $(CXXFLAGS) -DEVALFILE=\"$(EVALFILE)\" $(SRCS) ./external/fmt/format.cc -o $@ -O3 -lpthread -march=native -flto -ftree-vectorize
# Final binary
$(EXE)$(EXE_EXT): $(OBJS)
$(CXX) $(CXXFLAGS) -DEVALFILE=\"$(EVALFILE)\" $^ ./external/fmt/format.cc -o $@ -O3 -fuse-ld=lld -march=native -flto -static
# Rule to compile source files to object files
# Compile .cpp -> .o
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CXX) -std=c++23 -c -o $@ $< -O3 -lpthread -march=native -flto -ftree-vectorize
$(CXX) -std=c++20 -c -o $@ $< -O3 -march=native -fuse-ld=lld -flto -static
# Create the object directory if it doesn't exist
# Create object directory
$(OBJ_DIR):
$(MKDIR) $(OBJ_DIR)
# Clean up build artifacts
# Clean up and rebuild
.PHONY: clean
clean:
ifeq ($(OS),Windows_NT)
@if exist $(OBJ_DIR) $(RM) $(OBJ_DIR)
@if exist $(EXE)$(EXE_EXT) $(DEL) $(EXE)$(EXE_EXT)
else
@rm -rf $(OBJ_DIR)
@rm -f $(EXE)$(EXE_EXT)
@$(RM) $(OBJ_DIR)
@$(DEL) $(EXE)$(EXE_EXT)
endif
$(MAKE)
+2 -2
View File
@@ -10,8 +10,8 @@ constexpr int noEPTarget = -1;
constexpr int MAX_MOVES = 218;
thread_local inline int positionIndex = 0;
thread_local inline U64 positionHistory[1000];
inline int positionIndex = 0;
inline U64 positionHistory[1000];
class Board {
public:
+7 -7
View File
@@ -10,16 +10,16 @@
namespace SEARCH {
thread_local U64 nodes = 0;
thread_local U64 nodesToGo = 0;
thread_local bool benchStarted = false;
U64 nodes = 0;
U64 nodesToGo = 0;
bool benchStarted = false;
thread_local static inline int timeToSearch = 0;
thread_local static inline bool doingNullMove = false;
static inline int timeToSearch = 0;
static inline bool doingNullMove = false;
thread_local inline PVLine pvLine;
inline PVLine pvLine;
thread_local Stopwatch sw;
Stopwatch sw;
void InitLMRTable() {
for (int depth = 0; depth <= MAX_DEPTH; depth++) {
+5 -5
View File
@@ -19,15 +19,15 @@ constexpr int MAX_DEPTH = 64;
constexpr int MAX_PLY = 128;
constexpr int MAX_HISTORY = 16384;
thread_local extern U64 nodes;
thread_local extern bool benchStarted;
extern U64 nodes;
extern bool benchStarted;
constexpr int inf = 100000;
thread_local inline bool searchStopped = false;
inline bool searchStopped = false;
// [id][ply]
thread_local inline int killerMoves[2][MAX_PLY];
inline int killerMoves[2][MAX_PLY];
inline int lmrTable[MAX_DEPTH+1][MAX_MOVES];
@@ -75,7 +75,7 @@ public:
}
};
thread_local inline History history;
inline History history;
class PVLine {
private:
+5 -5
View File
@@ -3,20 +3,20 @@
class Stopwatch {
private:
std::chrono::high_resolution_clock::time_point start =
std::chrono::high_resolution_clock::now();
std::chrono::steady_clock::time_point start =
std::chrono::steady_clock::now();
public:
void Restart() {
start = std::chrono::high_resolution_clock::now();
start = std::chrono::steady_clock::now();
}
int GetElapsedMS() {
auto current = std::chrono::high_resolution_clock::now();
auto current = std::chrono::steady_clock::now();
return std::chrono::duration_cast<std::chrono::milliseconds>(current - start).count();
}
double GetElapsedSec() {
auto current = std::chrono::high_resolution_clock::now();
auto current = std::chrono::steady_clock::now();
return std::chrono::duration_cast<
std::chrono::duration<double>>(current - start).count();
}
+2 -2
View File
@@ -21,7 +21,7 @@ constexpr U64 maxHash = (64* 1000000) / sizeof(TTEntry);
// 5 MB
constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry);
thread_local inline U64 hashSize = defaultHash;
inline U64 hashSize = defaultHash;
constexpr int invalidEntry = 111111;
@@ -61,4 +61,4 @@ public:
void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move besteMove);
};
thread_local inline TTable TT;
inline TTable TT;