From 2fb3f76399a9d7fd32ac7f039ef6c98bd2915504 Mon Sep 17 00:00:00 2001 From: Serianol <65077855+Serianol@users.noreply.github.com> Date: Mon, 17 Aug 2020 12:36:13 +0200 Subject: [PATCH] Update Makefile --- src/Makefile | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 453967add7e..a8736a150d4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -34,6 +34,7 @@ BINDIR = $(PREFIX)/bin ### Built-in benchmark for pgo-builds PGOBENCH = ./$(EXE) bench +PGOGENSFEN = ./$(EXE) gensfen depth 3 loop 100000 ### Source and object files SRCS = benchmark.cpp bitbase.cpp bitboard.cpp endgame.cpp evaluate.cpp main.cpp \ @@ -270,9 +271,9 @@ endif ### ========================================================================== ### 3.1 Selecting compiler (default = gcc) -CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS) +CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS) $(LEARNCXXFLAGS) DEPENDFLAGS += -std=c++17 -LDFLAGS += $(EXTRALDFLAGS) +LDFLAGS += $(EXTRALDFLAGS) $(LEARNLDFLAGS) ifeq ($(COMP),) COMP=gcc @@ -763,6 +764,26 @@ learn: config-sanity EXTRACXXFLAGS=' -DEVAL_LEARN -DEVAL_NNUE -DENABLE_TEST_CMD -DUSE_BLAS -I/mingw64/include/OpenBLAS -fopenmp ' \ EXTRALDFLAGS=' -lopenblas -fopenmp -Wl,-s ' \ all + +profile-learn: config-sanity objclean profileclean + @echo "" + @echo "Step 1/4. Building instrumented executable ..." + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make) \ + LEARNCXXFLAGS=' -DEVAL_LEARN -DEVAL_NNUE -DENABLE_TEST_CMD -DUSE_BLAS -I/mingw64/include/OpenBLAS -fopenmp ' \ + LEARNLDFLAGS=' -lopenblas -fopenmp -Wl,-s ' + @echo "" + @echo "Step 2/4. Running benchmark for pgo-build ..." + $(PGOGENSFEN) + @echo "" + @echo "Step 3/4. Building optimized executable ..." + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use) \ + LEARNCXXFLAGS=' -DEVAL_LEARN -DEVAL_NNUE -DENABLE_TEST_CMD -DUSE_BLAS -I/mingw64/include/OpenBLAS -fopenmp ' \ + LEARNLDFLAGS=' -lopenblas -fopenmp -Wl,-s ' + @echo "" + @echo "Step 4/4. Deleting profile data ..." + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean + rm generated_kifu.bin .depend: -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null