diff --git a/README.md b/README.md index d894e649..99168e3f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Stockfish NNUE is a port of a shogi neural network named NNUE (efficiently updateable neural network backwards) to Stockfish 11. To learn more about the Stockfish chess engine, look [here](stockfish.md) for an overview and [here](https://github.com/official-stockfish/Stockfish) for the official repository. +======= ## Building To compile: @@ -34,6 +35,23 @@ Additional options: - `blas=[yes/no]` - whether to use an external BLAS library. Default is `no`. Using an external BLAS library may have a significantly improve learning performance and by default expects openBLAS to be installed. +### Building Instructions for Mac + +1. Ensure that you have OpenBlas Installed +``` +brew install openblas +``` +2. Go to src then build using the makefile +``` +cd src +make learn ARCH=x86-64 COMP=gcc +``` +or +``` +cd src +make profile-learn ARCH=x86-64 COMP=gcc +``` + ## Training Guide ### Generating Training Data diff --git a/src/Makefile b/src/Makefile index 7f1eaa86..6f72809a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -920,6 +920,32 @@ icc-profile-use: EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \ all +learn: config-sanity + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ + EXTRACXXFLAGS=' -DEVAL_LEARN -DEVAL_NNUE -DENABLE_TEST_CMD -DUSE_BLAS -I/usr/local/opt/openblas/include' \ + EXTRALDFLAGS=' -L/usr/local/opt/openblas/lib -Wl,-s -lcblas' \ + 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/usr/local/opt/openblas/include' \ + LEARNLDFLAGS=' -L/usr/local/opt/openblas/lib -Wl,-s -lcblas' + @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/usr/local/opt/openblas/include' \ + LEARNLDFLAGS=' -L/usr/local/opt/openblas/lib -Wl,-s -lcblas' + @echo "" + @echo "Step 4/4. Deleting profile data ..." + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean + rm generated_kifu.bin + .depend: -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@