Merge pull request #258 from kennyfrc/stockfish-nnue-2020-08-30-macos

mac-compatible makefile with instructions for stockfish-nnue-2020-08-30
This commit is contained in:
nodchip
2020-12-09 08:39:36 +09:00
committed by GitHub
2 changed files with 44 additions and 0 deletions

View File

@@ -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

View File

@@ -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) > $@